1/*
2 *
3 * Copyright 2014 gRPC authors.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19package grpc
20
21import (
22	"bytes"
23	"compress/gzip"
24	"encoding/binary"
25	"fmt"
26	"io"
27	"io/ioutil"
28	"math"
29	"net/url"
30	"strings"
31	"sync"
32	"time"
33
34	"golang.org/x/net/context"
35	"google.golang.org/grpc/codes"
36	"google.golang.org/grpc/credentials"
37	"google.golang.org/grpc/encoding"
38	"google.golang.org/grpc/encoding/proto"
39	"google.golang.org/grpc/metadata"
40	"google.golang.org/grpc/peer"
41	"google.golang.org/grpc/stats"
42	"google.golang.org/grpc/status"
43	"google.golang.org/grpc/transport"
44)
45
46// Compressor defines the interface gRPC uses to compress a message.
47//
48// Deprecated: use package encoding.
49type Compressor interface {
50	// Do compresses p into w.
51	Do(w io.Writer, p []byte) error
52	// Type returns the compression algorithm the Compressor uses.
53	Type() string
54}
55
56type gzipCompressor struct {
57	pool sync.Pool
58}
59
60// NewGZIPCompressor creates a Compressor based on GZIP.
61//
62// Deprecated: use package encoding/gzip.
63func NewGZIPCompressor() Compressor {
64	c, _ := NewGZIPCompressorWithLevel(gzip.DefaultCompression)
65	return c
66}
67
68// NewGZIPCompressorWithLevel is like NewGZIPCompressor but specifies the gzip compression level instead
69// of assuming DefaultCompression.
70//
71// The error returned will be nil if the level is valid.
72//
73// Deprecated: use package encoding/gzip.
74func NewGZIPCompressorWithLevel(level int) (Compressor, error) {
75	if level < gzip.DefaultCompression || level > gzip.BestCompression {
76		return nil, fmt.Errorf("grpc: invalid compression level: %d", level)
77	}
78	return &gzipCompressor{
79		pool: sync.Pool{
80			New: func() interface{} {
81				w, err := gzip.NewWriterLevel(ioutil.Discard, level)
82				if err != nil {
83					panic(err)
84				}
85				return w
86			},
87		},
88	}, nil
89}
90
91func (c *gzipCompressor) Do(w io.Writer, p []byte) error {
92	z := c.pool.Get().(*gzip.Writer)
93	defer c.pool.Put(z)
94	z.Reset(w)
95	if _, err := z.Write(p); err != nil {
96		return err
97	}
98	return z.Close()
99}
100
101func (c *gzipCompressor) Type() string {
102	return "gzip"
103}
104
105// Decompressor defines the interface gRPC uses to decompress a message.
106//
107// Deprecated: use package encoding.
108type Decompressor interface {
109	// Do reads the data from r and uncompress them.
110	Do(r io.Reader) ([]byte, error)
111	// Type returns the compression algorithm the Decompressor uses.
112	Type() string
113}
114
115type gzipDecompressor struct {
116	pool sync.Pool
117}
118
119// NewGZIPDecompressor creates a Decompressor based on GZIP.
120//
121// Deprecated: use package encoding/gzip.
122func NewGZIPDecompressor() Decompressor {
123	return &gzipDecompressor{}
124}
125
126func (d *gzipDecompressor) Do(r io.Reader) ([]byte, error) {
127	var z *gzip.Reader
128	switch maybeZ := d.pool.Get().(type) {
129	case nil:
130		newZ, err := gzip.NewReader(r)
131		if err != nil {
132			return nil, err
133		}
134		z = newZ
135	case *gzip.Reader:
136		z = maybeZ
137		if err := z.Reset(r); err != nil {
138			d.pool.Put(z)
139			return nil, err
140		}
141	}
142
143	defer func() {
144		z.Close()
145		d.pool.Put(z)
146	}()
147	return ioutil.ReadAll(z)
148}
149
150func (d *gzipDecompressor) Type() string {
151	return "gzip"
152}
153
154// callInfo contains all related configuration and information about an RPC.
155type callInfo struct {
156	compressorType        string
157	failFast              bool
158	stream                *clientStream
159	traceInfo             traceInfo // in trace.go
160	maxReceiveMessageSize *int
161	maxSendMessageSize    *int
162	creds                 credentials.PerRPCCredentials
163	contentSubtype        string
164	codec                 baseCodec
165}
166
167func defaultCallInfo() *callInfo {
168	return &callInfo{failFast: true}
169}
170
171// CallOption configures a Call before it starts or extracts information from
172// a Call after it completes.
173type CallOption interface {
174	// before is called before the call is sent to any server.  If before
175	// returns a non-nil error, the RPC fails with that error.
176	before(*callInfo) error
177
178	// after is called after the call has completed.  after cannot return an
179	// error, so any failures should be reported via output parameters.
180	after(*callInfo)
181}
182
183// EmptyCallOption does not alter the Call configuration.
184// It can be embedded in another structure to carry satellite data for use
185// by interceptors.
186type EmptyCallOption struct{}
187
188func (EmptyCallOption) before(*callInfo) error { return nil }
189func (EmptyCallOption) after(*callInfo)        {}
190
191// Header returns a CallOptions that retrieves the header metadata
192// for a unary RPC.
193func Header(md *metadata.MD) CallOption {
194	return HeaderCallOption{HeaderAddr: md}
195}
196
197// HeaderCallOption is a CallOption for collecting response header metadata.
198// The metadata field will be populated *after* the RPC completes.
199// This is an EXPERIMENTAL API.
200type HeaderCallOption struct {
201	HeaderAddr *metadata.MD
202}
203
204func (o HeaderCallOption) before(c *callInfo) error { return nil }
205func (o HeaderCallOption) after(c *callInfo) {
206	if c.stream != nil {
207		*o.HeaderAddr, _ = c.stream.Header()
208	}
209}
210
211// Trailer returns a CallOptions that retrieves the trailer metadata
212// for a unary RPC.
213func Trailer(md *metadata.MD) CallOption {
214	return TrailerCallOption{TrailerAddr: md}
215}
216
217// TrailerCallOption is a CallOption for collecting response trailer metadata.
218// The metadata field will be populated *after* the RPC completes.
219// This is an EXPERIMENTAL API.
220type TrailerCallOption struct {
221	TrailerAddr *metadata.MD
222}
223
224func (o TrailerCallOption) before(c *callInfo) error { return nil }
225func (o TrailerCallOption) after(c *callInfo) {
226	if c.stream != nil {
227		*o.TrailerAddr = c.stream.Trailer()
228	}
229}
230
231// Peer returns a CallOption that retrieves peer information for a unary RPC.
232// The peer field will be populated *after* the RPC completes.
233func Peer(p *peer.Peer) CallOption {
234	return PeerCallOption{PeerAddr: p}
235}
236
237// PeerCallOption is a CallOption for collecting the identity of the remote
238// peer. The peer field will be populated *after* the RPC completes.
239// This is an EXPERIMENTAL API.
240type PeerCallOption struct {
241	PeerAddr *peer.Peer
242}
243
244func (o PeerCallOption) before(c *callInfo) error { return nil }
245func (o PeerCallOption) after(c *callInfo) {
246	if c.stream != nil {
247		if x, ok := peer.FromContext(c.stream.Context()); ok {
248			*o.PeerAddr = *x
249		}
250	}
251}
252
253// FailFast configures the action to take when an RPC is attempted on broken
254// connections or unreachable servers.  If failFast is true, the RPC will fail
255// immediately. Otherwise, the RPC client will block the call until a
256// connection is available (or the call is canceled or times out) and will
257// retry the call if it fails due to a transient error.  gRPC will not retry if
258// data was written to the wire unless the server indicates it did not process
259// the data.  Please refer to
260// https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md.
261//
262// By default, RPCs are "Fail Fast".
263func FailFast(failFast bool) CallOption {
264	return FailFastCallOption{FailFast: failFast}
265}
266
267// FailFastCallOption is a CallOption for indicating whether an RPC should fail
268// fast or not.
269// This is an EXPERIMENTAL API.
270type FailFastCallOption struct {
271	FailFast bool
272}
273
274func (o FailFastCallOption) before(c *callInfo) error {
275	c.failFast = o.FailFast
276	return nil
277}
278func (o FailFastCallOption) after(c *callInfo) {}
279
280// MaxCallRecvMsgSize returns a CallOption which sets the maximum message size the client can receive.
281func MaxCallRecvMsgSize(s int) CallOption {
282	return MaxRecvMsgSizeCallOption{MaxRecvMsgSize: s}
283}
284
285// MaxRecvMsgSizeCallOption is a CallOption that indicates the maximum message
286// size the client can receive.
287// This is an EXPERIMENTAL API.
288type MaxRecvMsgSizeCallOption struct {
289	MaxRecvMsgSize int
290}
291
292func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error {
293	c.maxReceiveMessageSize = &o.MaxRecvMsgSize
294	return nil
295}
296func (o MaxRecvMsgSizeCallOption) after(c *callInfo) {}
297
298// MaxCallSendMsgSize returns a CallOption which sets the maximum message size the client can send.
299func MaxCallSendMsgSize(s int) CallOption {
300	return MaxSendMsgSizeCallOption{MaxSendMsgSize: s}
301}
302
303// MaxSendMsgSizeCallOption is a CallOption that indicates the maximum message
304// size the client can send.
305// This is an EXPERIMENTAL API.
306type MaxSendMsgSizeCallOption struct {
307	MaxSendMsgSize int
308}
309
310func (o MaxSendMsgSizeCallOption) before(c *callInfo) error {
311	c.maxSendMessageSize = &o.MaxSendMsgSize
312	return nil
313}
314func (o MaxSendMsgSizeCallOption) after(c *callInfo) {}
315
316// PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials
317// for a call.
318func PerRPCCredentials(creds credentials.PerRPCCredentials) CallOption {
319	return PerRPCCredsCallOption{Creds: creds}
320}
321
322// PerRPCCredsCallOption is a CallOption that indicates the per-RPC
323// credentials to use for the call.
324// This is an EXPERIMENTAL API.
325type PerRPCCredsCallOption struct {
326	Creds credentials.PerRPCCredentials
327}
328
329func (o PerRPCCredsCallOption) before(c *callInfo) error {
330	c.creds = o.Creds
331	return nil
332}
333func (o PerRPCCredsCallOption) after(c *callInfo) {}
334
335// UseCompressor returns a CallOption which sets the compressor used when
336// sending the request.  If WithCompressor is also set, UseCompressor has
337// higher priority.
338//
339// This API is EXPERIMENTAL.
340func UseCompressor(name string) CallOption {
341	return CompressorCallOption{CompressorType: name}
342}
343
344// CompressorCallOption is a CallOption that indicates the compressor to use.
345// This is an EXPERIMENTAL API.
346type CompressorCallOption struct {
347	CompressorType string
348}
349
350func (o CompressorCallOption) before(c *callInfo) error {
351	c.compressorType = o.CompressorType
352	return nil
353}
354func (o CompressorCallOption) after(c *callInfo) {}
355
356// CallContentSubtype returns a CallOption that will set the content-subtype
357// for a call. For example, if content-subtype is "json", the Content-Type over
358// the wire will be "application/grpc+json". The content-subtype is converted
359// to lowercase before being included in Content-Type. See Content-Type on
360// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for
361// more details.
362//
363// If CallCustomCodec is not also used, the content-subtype will be used to
364// look up the Codec to use in the registry controlled by RegisterCodec. See
365// the documentation on RegisterCodec for details on registration. The lookup
366// of content-subtype is case-insensitive. If no such Codec is found, the call
367// will result in an error with code codes.Internal.
368//
369// If CallCustomCodec is also used, that Codec will be used for all request and
370// response messages, with the content-subtype set to the given contentSubtype
371// here for requests.
372func CallContentSubtype(contentSubtype string) CallOption {
373	return ContentSubtypeCallOption{ContentSubtype: strings.ToLower(contentSubtype)}
374}
375
376// ContentSubtypeCallOption is a CallOption that indicates the content-subtype
377// used for marshaling messages.
378// This is an EXPERIMENTAL API.
379type ContentSubtypeCallOption struct {
380	ContentSubtype string
381}
382
383func (o ContentSubtypeCallOption) before(c *callInfo) error {
384	c.contentSubtype = o.ContentSubtype
385	return nil
386}
387func (o ContentSubtypeCallOption) after(c *callInfo) {}
388
389// CallCustomCodec returns a CallOption that will set the given Codec to be
390// used for all request and response messages for a call. The result of calling
391// String() will be used as the content-subtype in a case-insensitive manner.
392//
393// See Content-Type on
394// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for
395// more details. Also see the documentation on RegisterCodec and
396// CallContentSubtype for more details on the interaction between Codec and
397// content-subtype.
398//
399// This function is provided for advanced users; prefer to use only
400// CallContentSubtype to select a registered codec instead.
401func CallCustomCodec(codec Codec) CallOption {
402	return CustomCodecCallOption{Codec: codec}
403}
404
405// CustomCodecCallOption is a CallOption that indicates the codec used for
406// marshaling messages.
407// This is an EXPERIMENTAL API.
408type CustomCodecCallOption struct {
409	Codec Codec
410}
411
412func (o CustomCodecCallOption) before(c *callInfo) error {
413	c.codec = o.Codec
414	return nil
415}
416func (o CustomCodecCallOption) after(c *callInfo) {}
417
418// The format of the payload: compressed or not?
419type payloadFormat uint8
420
421const (
422	compressionNone payloadFormat = iota // no compression
423	compressionMade
424)
425
426// parser reads complete gRPC messages from the underlying reader.
427type parser struct {
428	// r is the underlying reader.
429	// See the comment on recvMsg for the permissible
430	// error types.
431	r io.Reader
432
433	// The header of a gRPC message. Find more detail at
434	// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
435	header [5]byte
436}
437
438// recvMsg reads a complete gRPC message from the stream.
439//
440// It returns the message and its payload (compression/encoding)
441// format. The caller owns the returned msg memory.
442//
443// If there is an error, possible values are:
444//   * io.EOF, when no messages remain
445//   * io.ErrUnexpectedEOF
446//   * of type transport.ConnectionError
447//   * of type transport.StreamError
448// No other error values or types must be returned, which also means
449// that the underlying io.Reader must not return an incompatible
450// error.
451func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byte, err error) {
452	if _, err := p.r.Read(p.header[:]); err != nil {
453		return 0, nil, err
454	}
455
456	pf = payloadFormat(p.header[0])
457	length := binary.BigEndian.Uint32(p.header[1:])
458
459	if length == 0 {
460		return pf, nil, nil
461	}
462	if int64(length) > int64(maxInt) {
463		return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max length allowed on current machine (%d vs. %d)", length, maxInt)
464	}
465	if int(length) > maxReceiveMessageSize {
466		return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", length, maxReceiveMessageSize)
467	}
468	// TODO(bradfitz,zhaoq): garbage. reuse buffer after proto decoding instead
469	// of making it for each message:
470	msg = make([]byte, int(length))
471	if _, err := p.r.Read(msg); err != nil {
472		if err == io.EOF {
473			err = io.ErrUnexpectedEOF
474		}
475		return 0, nil, err
476	}
477	return pf, msg, nil
478}
479
480// encode serializes msg and returns a buffer of message header and a buffer of msg.
481// If msg is nil, it generates the message header and an empty msg buffer.
482// TODO(ddyihai): eliminate extra Compressor parameter.
483func encode(c baseCodec, msg interface{}, cp Compressor, outPayload *stats.OutPayload, compressor encoding.Compressor) ([]byte, []byte, error) {
484	var (
485		b    []byte
486		cbuf *bytes.Buffer
487	)
488	const (
489		payloadLen = 1
490		sizeLen    = 4
491	)
492	if msg != nil {
493		var err error
494		b, err = c.Marshal(msg)
495		if err != nil {
496			return nil, nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error())
497		}
498		if outPayload != nil {
499			outPayload.Payload = msg
500			// TODO truncate large payload.
501			outPayload.Data = b
502			outPayload.Length = len(b)
503		}
504		if compressor != nil || cp != nil {
505			cbuf = new(bytes.Buffer)
506			// Has compressor, check Compressor is set by UseCompressor first.
507			if compressor != nil {
508				z, _ := compressor.Compress(cbuf)
509				if _, err := z.Write(b); err != nil {
510					return nil, nil, status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error())
511				}
512				z.Close()
513			} else {
514				// If Compressor is not set by UseCompressor, use default Compressor
515				if err := cp.Do(cbuf, b); err != nil {
516					return nil, nil, status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error())
517				}
518			}
519			b = cbuf.Bytes()
520		}
521	}
522	if uint(len(b)) > math.MaxUint32 {
523		return nil, nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b))
524	}
525
526	bufHeader := make([]byte, payloadLen+sizeLen)
527	if compressor != nil || cp != nil {
528		bufHeader[0] = byte(compressionMade)
529	} else {
530		bufHeader[0] = byte(compressionNone)
531	}
532
533	// Write length of b into buf
534	binary.BigEndian.PutUint32(bufHeader[payloadLen:], uint32(len(b)))
535	if outPayload != nil {
536		outPayload.WireLength = payloadLen + sizeLen + len(b)
537	}
538	return bufHeader, b, nil
539}
540
541func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool) *status.Status {
542	switch pf {
543	case compressionNone:
544	case compressionMade:
545		if recvCompress == "" || recvCompress == encoding.Identity {
546			return status.New(codes.Internal, "grpc: compressed flag set with identity or empty encoding")
547		}
548		if !haveCompressor {
549			return status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress)
550		}
551	default:
552		return status.Newf(codes.Internal, "grpc: received unexpected payload format %d", pf)
553	}
554	return nil
555}
556
557// For the two compressor parameters, both should not be set, but if they are,
558// dc takes precedence over compressor.
559// TODO(dfawley): wrap the old compressor/decompressor using the new API?
560func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, inPayload *stats.InPayload, compressor encoding.Compressor) error {
561	pf, d, err := p.recvMsg(maxReceiveMessageSize)
562	if err != nil {
563		return err
564	}
565	if inPayload != nil {
566		inPayload.WireLength = len(d)
567	}
568
569	if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil {
570		return st.Err()
571	}
572
573	if pf == compressionMade {
574		// To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor,
575		// use this decompressor as the default.
576		if dc != nil {
577			d, err = dc.Do(bytes.NewReader(d))
578			if err != nil {
579				return status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
580			}
581		} else {
582			dcReader, err := compressor.Decompress(bytes.NewReader(d))
583			if err != nil {
584				return status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
585			}
586			d, err = ioutil.ReadAll(dcReader)
587			if err != nil {
588				return status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
589			}
590		}
591	}
592	if len(d) > maxReceiveMessageSize {
593		// TODO: Revisit the error code. Currently keep it consistent with java
594		// implementation.
595		return status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", len(d), maxReceiveMessageSize)
596	}
597	if err := c.Unmarshal(d, m); err != nil {
598		return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message %v", err)
599	}
600	if inPayload != nil {
601		inPayload.RecvTime = time.Now()
602		inPayload.Payload = m
603		// TODO truncate large payload.
604		inPayload.Data = d
605		inPayload.Length = len(d)
606	}
607	return nil
608}
609
610type rpcInfo struct {
611	failfast bool
612}
613
614type rpcInfoContextKey struct{}
615
616func newContextWithRPCInfo(ctx context.Context, failfast bool) context.Context {
617	return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{failfast: failfast})
618}
619
620func rpcInfoFromContext(ctx context.Context) (s *rpcInfo, ok bool) {
621	s, ok = ctx.Value(rpcInfoContextKey{}).(*rpcInfo)
622	return
623}
624
625// Code returns the error code for err if it was produced by the rpc system.
626// Otherwise, it returns codes.Unknown.
627//
628// Deprecated: use status.FromError and Code method instead.
629func Code(err error) codes.Code {
630	if s, ok := status.FromError(err); ok {
631		return s.Code()
632	}
633	return codes.Unknown
634}
635
636// ErrorDesc returns the error description of err if it was produced by the rpc system.
637// Otherwise, it returns err.Error() or empty string when err is nil.
638//
639// Deprecated: use status.FromError and Message method instead.
640func ErrorDesc(err error) string {
641	if s, ok := status.FromError(err); ok {
642		return s.Message()
643	}
644	return err.Error()
645}
646
647// Errorf returns an error containing an error code and a description;
648// Errorf returns nil if c is OK.
649//
650// Deprecated: use status.Errorf instead.
651func Errorf(c codes.Code, format string, a ...interface{}) error {
652	return status.Errorf(c, format, a...)
653}
654
655// setCallInfoCodec should only be called after CallOptions have been applied.
656func setCallInfoCodec(c *callInfo) error {
657	if c.codec != nil {
658		// codec was already set by a CallOption; use it.
659		return nil
660	}
661
662	if c.contentSubtype == "" {
663		// No codec specified in CallOptions; use proto by default.
664		c.codec = encoding.GetCodec(proto.Name)
665		return nil
666	}
667
668	// c.contentSubtype is already lowercased in CallContentSubtype
669	c.codec = encoding.GetCodec(c.contentSubtype)
670	if c.codec == nil {
671		return status.Errorf(codes.Internal, "no codec registered for content-subtype %s", c.contentSubtype)
672	}
673	return nil
674}
675
676// parseDialTarget returns the network and address to pass to dialer
677func parseDialTarget(target string) (net string, addr string) {
678	net = "tcp"
679
680	m1 := strings.Index(target, ":")
681	m2 := strings.Index(target, ":/")
682
683	// handle unix:addr which will fail with url.Parse
684	if m1 >= 0 && m2 < 0 {
685		if n := target[0:m1]; n == "unix" {
686			net = n
687			addr = target[m1+1:]
688			return net, addr
689		}
690	}
691	if m2 >= 0 {
692		t, err := url.Parse(target)
693		if err != nil {
694			return net, target
695		}
696		scheme := t.Scheme
697		addr = t.Path
698		if scheme == "unix" {
699			net = scheme
700			if addr == "" {
701				addr = t.Host
702			}
703			return net, addr
704		}
705	}
706
707	return net, target
708}
709
710// The SupportPackageIsVersion variables are referenced from generated protocol
711// buffer files to ensure compatibility with the gRPC version used.  The latest
712// support package version is 5.
713//
714// Older versions are kept for compatibility. They may be removed if
715// compatibility cannot be maintained.
716//
717// These constants should not be referenced from any other code.
718const (
719	SupportPackageIsVersion3 = true
720	SupportPackageIsVersion4 = true
721	SupportPackageIsVersion5 = true
722)
723
724// Version is the current grpc version.
725const Version = "1.12.0"
726
727const grpcUA = "grpc-go/" + Version
728