• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H23-Apr-2020-

Documentation/H23-Apr-2020-

attributes/H23-Apr-2020-

backoff/H23-Apr-2020-

balancer/H23-Apr-2020-

benchmark/H23-Apr-2020-

binarylog/grpc_binarylog_v1/H23-Apr-2020-

channelz/H23-Apr-2020-

codes/H23-Apr-2020-

connectivity/H23-Apr-2020-

credentials/H23-Apr-2020-

encoding/H23-Apr-2020-

examples/H23-Apr-2020-

grpclog/H23-Apr-2020-

health/H23-Apr-2020-

internal/H23-Apr-2020-

interop/H23-Apr-2020-

keepalive/H23-Apr-2020-

metadata/H23-Apr-2020-

naming/H23-Apr-2020-

peer/H23-Apr-2020-

profiling/H23-Apr-2020-

reflection/H23-Apr-2020-

resolver/H23-Apr-2020-

security/advancedtls/H23-Apr-2020-

serviceconfig/H23-Apr-2020-

stats/H23-Apr-2020-

status/H23-Apr-2020-

stress/H23-Apr-2020-

tap/H23-Apr-2020-

test/H23-Apr-2020-

testdata/H23-Apr-2020-

xds/H23-Apr-2020-

.travis.ymlH A D23-Apr-20201.3 KiB

AUTHORSH A D23-Apr-202012

CODE-OF-CONDUCT.mdH A D23-Apr-2020138

CONTRIBUTING.mdH A D23-Apr-20203 KiB

GOVERNANCE.mdH A D23-Apr-2020141

LICENSEH A D23-Apr-202011.1 KiB

MAINTAINERS.mdH A D23-Apr-20201.3 KiB

MakefileH A D23-Apr-20201.2 KiB

README.mdH A D23-Apr-20204.9 KiB

backoff.goH A D23-Apr-20201.9 KiB

balancer.goH A D23-Apr-202011 KiB

balancer_conn_wrappers.goH A D23-Apr-20207.5 KiB

balancer_conn_wrappers_test.goH A D23-Apr-20204.1 KiB

balancer_switching_test.goH A D23-Apr-202016.1 KiB

balancer_test.goH A D23-Apr-202024 KiB

balancer_v1_wrapper.goH A D23-Apr-20209 KiB

call.goH A D23-Apr-20202.4 KiB

call_test.goH A D23-Apr-202014.3 KiB

clientconn.goH A D23-Apr-202047.4 KiB

clientconn_state_transition_test.goH A D23-Apr-202012.6 KiB

clientconn_test.goH A D23-Apr-202035.4 KiB

codec.goH A D23-Apr-20201.6 KiB

codec_test.goH A D23-Apr-2020895

codegen.shH A D23-Apr-2020635

dialoptions.goH A D23-Apr-202021 KiB

doc.goH A D23-Apr-2020755

go.modH A D23-Apr-2020542

go.sumH A D23-Apr-20206.2 KiB

grpc_test.goH A D23-Apr-2020780

install_gae.shH A D23-Apr-2020236

interceptor.goH A D23-Apr-20203.9 KiB

picker_wrapper.goH A D23-Apr-20206.3 KiB

picker_wrapper_test.goH A D23-Apr-20204.8 KiB

pickfirst.goH A D23-Apr-20204.8 KiB

pickfirst_test.goH A D23-Apr-202011.7 KiB

preloader.goH A D23-Apr-20201.8 KiB

proxy.goH A D23-Apr-20204 KiB

proxy_test.goH A D23-Apr-20205.6 KiB

resolver_conn_wrapper.goH A D23-Apr-20206.4 KiB

resolver_conn_wrapper_test.goH A D23-Apr-20206.9 KiB

rpc_util.goH A D23-Apr-202026.6 KiB

rpc_util_test.goH A D23-Apr-20208.2 KiB

server.goH A D23-Apr-202048.4 KiB

server_test.goH A D23-Apr-20203.1 KiB

service_config.goH A D23-Apr-202013.7 KiB

service_config_test.goH A D23-Apr-20209.1 KiB

stream.goH A D23-Apr-202044.8 KiB

trace.goH A D23-Apr-20202.9 KiB

trace_test.goH A D23-Apr-20201.2 KiB

version.goH A D23-Apr-2020683

vet.shH A D23-Apr-20204.6 KiB

README.md

1# gRPC-Go
2
3[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go)
4[![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc)
5[![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go)
6
7The Go implementation of [gRPC](https://grpc.io/): A high performance, open
8source, general RPC framework that puts mobile and HTTP/2 first. For more
9information see the [gRPC Quick Start:
10Go](https://grpc.io/docs/quickstart/go.html) guide.
11
12Installation
13------------
14
15To install this package, you need to install Go and setup your Go workspace on
16your computer. The simplest way to install the library is to run:
17
18```
19$ go get -u google.golang.org/grpc
20```
21
22With Go module support (Go 1.11+), simply `import "google.golang.org/grpc"` in
23your source code and `go [build|run|test]` will automatically download the
24necessary dependencies ([Go modules
25ref](https://github.com/golang/go/wiki/Modules)).
26
27If you are trying to access grpc-go from within China, please see the
28[FAQ](#FAQ) below.
29
30Prerequisites
31-------------
32gRPC-Go requires Go 1.9 or later.
33
34Documentation
35-------------
36- See [godoc](https://godoc.org/google.golang.org/grpc) for package and API
37  descriptions.
38- Documentation on specific topics can be found in the [Documentation
39  directory](Documentation/).
40- Examples can be found in the [examples directory](examples/).
41
42Performance
43-----------
44Performance benchmark data for grpc-go and other languages is maintained in
45[this
46dashboard](https://performance-dot-grpc-testing.appspot.com/explore?dashboard=5652536396611584&widget=490377658&container=1286539696).
47
48Status
49------
50General Availability [Google Cloud Platform Launch
51Stages](https://cloud.google.com/terms/launch-stages).
52
53FAQ
54---
55
56#### I/O Timeout Errors
57
58The `golang.org` domain may be blocked from some countries.  `go get` usually
59produces an error like the following when this happens:
60
61```
62$ go get -u google.golang.org/grpc
63package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
64```
65
66To build Go code, there are several options:
67
68- Set up a VPN and access google.golang.org through that.
69
70- Without Go module support: `git clone` the repo manually:
71
72  ```
73  git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc
74  ```
75
76  You will need to do the same for all of grpc's dependencies in `golang.org`,
77  e.g. `golang.org/x/net`.
78
79- With Go module support: it is possible to use the `replace` feature of `go
80  mod` to create aliases for golang.org packages.  In your project's directory:
81
82  ```
83  go mod edit -replace=google.golang.org/grpc=github.com/grpc/grpc-go@latest
84  go mod tidy
85  go mod vendor
86  go build -mod=vendor
87  ```
88
89  Again, this will need to be done for all transitive dependencies hosted on
90  golang.org as well.  Please refer to [this
91  issue](https://github.com/golang/go/issues/28652) in the golang repo regarding
92  this concern.
93
94#### Compiling error, undefined: grpc.SupportPackageIsVersion
95
96##### If you are using Go modules:
97
98Please ensure your gRPC-Go version is `require`d at the appropriate version in
99the same module containing the generated `.pb.go` files.  For example,
100`SupportPackageIsVersion6` needs `v1.27.0`, so in your `go.mod` file:
101
102```
103module <your module name>
104
105require (
106    google.golang.org/grpc v1.27.0
107)
108```
109
110##### If you are *not* using Go modules:
111
112Please update proto package, gRPC package and rebuild the proto files:
113 - `go get -u github.com/golang/protobuf/{proto,protoc-gen-go}`
114 - `go get -u google.golang.org/grpc`
115 - `protoc --go_out=plugins=grpc:. *.proto`
116
117#### How to turn on logging
118
119The default logger is controlled by the environment variables. Turn everything
120on by setting:
121
122```
123GRPC_GO_LOG_VERBOSITY_LEVEL=99 GRPC_GO_LOG_SEVERITY_LEVEL=info
124```
125
126#### The RPC failed with error `"code = Unavailable desc = transport is closing"`
127
128This error means the connection the RPC is using was closed, and there are many
129possible reasons, including:
130 1. mis-configured transport credentials, connection failed on handshaking
131 1. bytes disrupted, possibly by a proxy in between
132 1. server shutdown
133 1. Keepalive parameters caused connection shutdown, for example if you have configured
134    your server to terminate connections regularly to [trigger DNS lookups](https://github.com/grpc/grpc-go/issues/3170#issuecomment-552517779).
135    If this is the case, you may want to increase your [MaxConnectionAgeGrace](https://pkg.go.dev/google.golang.org/grpc/keepalive?tab=doc#ServerParameters),
136    to allow longer RPC calls to finish.
137
138It can be tricky to debug this because the error happens on the client side but
139the root cause of the connection being closed is on the server side. Turn on
140logging on __both client and server__, and see if there are any transport
141errors.
142