# README
#gRPC-Go
The Go implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the gRPC Quick Start guide.
Installation
To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run:
$ go get google.golang.org/grpc
Prerequisites
This requires Go 1.5 or later .
Constraints
The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the list, you need a discussion with gRPC-Go authors and consultants.
Documentation
See API documentation for package and API descriptions and find examples in the examples directory.
Status
Beta release
# Packages
Package benchmark implements the building blocks to setup end-to-end gRPC benchmarks.
Package codes defines the canonical error codes used by gRPC.
Package credentials implements various credentials supported by gRPC library, which encapsulate all the state needed by a client to authenticate with a server and make various assertions, e.g., about the client's identity, role, or whether it is authorized to make a particular call.
No description provided by the author
Package grpclog defines logging for grpc.
Package health provides some utility functions to health-check a server.
No description provided by the author
Package metadata define the structure of the metadata supported by gRPC library.
Package naming defines the naming API and related data structures for gRPC.
Package peer defines various peer information associated with RPCs and corresponding utils.
Package reflection implements server reflection service.
No description provided by the author
No description provided by the author
Package transport defines and implements message oriented communication channel
to complete various transactions (e.g., an RPC).
# Functions
Code returns the error code for err if it was produced by the rpc system.
Creds returns a ServerOption that sets credentials for server connections.
CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling.
Dial creates a client connection the given target.
ErrorDesc returns the error description of err if it was produced by the rpc system.
Errorf returns an error containing an error code and a description; Errorf returns nil if c is OK.
FailFast configures the action to take when an RPC is attempted on broken connections or unreachable servers.
Header returns a CallOptions that retrieves the header metadata for a unary RPC.
Invoke sends the RPC request on the wire and returns after response is received.
MaxConcurrentStreams returns a ServerOption that will apply a limit on the number of concurrent streams to each ServerTransport.
NewClientStream creates a new Stream for the client side.
NewGZIPCompressor creates a Compressor based on GZIP.
NewGZIPDecompressor creates a Decompressor based on GZIP.
NewServer creates a gRPC server which has no service registered and has not started to accept requests yet.
RoundRobin returns a Balancer that selects addresses round-robin.
RPCCompressor returns a ServerOption that sets a compressor for outbound message.
RPCDecompressor returns a ServerOption that sets a decompressor for inbound message.
SendHeader sends header metadata.
SetTrailer sets the trailer metadata that will be sent when an RPC returns.
StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the server.
Trailer returns a CallOptions that retrieves the trailer metadata for a unary RPC.
UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.
WithBackoffConfig configures the dialer to use the provided backoff parameters after connection failures.
WithBackoffMaxDelay configures the dialer to use the provided maximum delay when backing off after failed connection attempts.
WithBalancer returns a DialOption which sets a load balancer.
WithBlock returns a DialOption which makes caller of Dial blocks until the underlying connection is up.
WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling.
WithCompressor returns a DialOption which sets a CompressorGenerator for generating message compressor.
WithDecompressor returns a DialOption which sets a DecompressorGenerator for generating message decompressor.
WithDialer returns a DialOption that specifies a function to use for dialing network addresses.
WithInsecure returns a DialOption which disables transport security for this ClientConn.
WithPerRPCCredentials returns a DialOption which sets credentials which will place auth state on each outbound RPC.
WithTimeout returns a DialOption that configures a timeout for dialing a ClientConn initially.
WithTransportCredentials returns a DialOption which configures a connection level security credentials (e.g., TLS/SSL).
WithUserAgent returns a DialOption that specifies a user agent string for all the RPCs.
# Constants
Connecting indicates the ClienConn is connecting.
Idle indicates the ClientConn is idle.
Ready indicates the ClientConn is ready for work.
Shutdown indicates the ClientConn has started shutting down.
SupportPackageIsVersion3 is referenced from generated protocol buffer files to assert that that code is compatible with this version of the grpc package.
TransientFailure indicates the ClientConn has seen a failure but expects to recover.
# Variables
DefaultBackoffConfig uses values specified for backoff in https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
EnableTracing controls whether to trace RPCs using the golang.org/x/net/trace package.
ErrClientConnClosing indicates that the operation is illegal because the ClientConn is closing.
ErrClientConnTimeout indicates that the ClientConn cannot establish the underlying connections within the specified timeout.
ErrServerStopped indicates that the operation is now illegal because of the server being stopped.
# Structs
Address represents a server the client connects to.
BackoffConfig defines the parameters for the default gRPC backoff strategy.
BalancerGetOptions configures a Get call.
ClientConn represents a client connection to an RPC server.
MethodDesc represents an RPC service's method specification.
MethodInfo contains information about an RPC.
Server is a gRPC server to serve RPC requests.
ServiceDesc represents an RPC service's specification.
ServiceInfo contains unary RPC method info, streaming RPC methid info and metadata for a service.
StreamDesc represents a streaming RPC service's method specification.
StreamServerInfo consists of various information about a streaming RPC on server side.
UnaryServerInfo consists of various information about a unary RPC on server side.
# Interfaces
Balancer chooses network addresses for RPCs.
CallOption configures a Call before it starts or extracts information from a Call after it completes.
ClientStream defines the interface a client stream has to satisfy.
Codec defines the interface gRPC uses to encode and decode messages.
Compressor defines the interface gRPC uses to compress a message.
Decompressor defines the interface gRPC uses to decompress a message.
ServerStream defines the interface a server stream has to satisfy.
Stream defines the common interface a client or server stream has to satisfy.
# Type aliases
ConnectivityState indicates the state of a client connection.
DialOption configures how we set up the connection.
A ServerOption sets options.
StreamHandler defines the handler called by gRPC server to complete the execution of a streaming RPC.
StreamServerInterceptor provides a hook to intercept the execution of a streaming RPC on the server.
UnaryHandler defines the handler invoked by UnaryServerInterceptor to complete the normal execution of a unary RPC.
UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server.