pkg.go.dev Open in urlscan Pro
2600:1901:0:f535::  Public Scan

Submitted URL: http://google.golang.org/grpc/internal/transport
Effective URL: https://pkg.go.dev/google.golang.org/grpc/internal/transport
Submission: On July 21 via api from US — Scanned from DE

Form analysis 3 forms found in the DOM

/search

<form class="go-InputGroup go-ShortcutKey go-SearchForm-form" action="/search" data-shortcut="/" data-shortcut-alt="search" data-gtmc="search form" aria-label="Search for a package" role="search">
  <input name="q" class="go-Input js-searchFocus" aria-label="Search for a package" type="search" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" placeholder="Search packages or symbols" value="">
  <input name="m" value="" hidden="">
  <button class="go-Button go-Button--inverted" aria-label="Submit search">
    <img class="go-Icon" height="24" width="24" src="/static/shared/icon/search_gm_grey_24dp.svg" alt="">
  </button>
</form>

DIALOG

<form method="dialog" data-gmtc="jump to form" aria-label="Jump to Identifier">
  <div class="Dialog-title go-Modal-header">
    <h2>Jump to</h2>
    <button class="go-Button go-Button--inline" type="button" data-modal-close="" data-gtmc="modal button" aria-label="Close">
      <img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="">
    </button>
  </div>
  <div class="JumpDialog-filter">
    <input class="JumpDialog-input go-Input" autocomplete="off" type="text">
  </div>
  <div class="JumpDialog-body go-Modal-body">
    <div class="JumpDialog-list"></div>
  </div>
  <div class="go-Modal-actions">
    <button class="go-Button" data-test-id="close-dialog">Close</button>
  </div>
</form>

DIALOG

<form method="dialog">
  <div class="go-Modal-header">
    <h2>Keyboard shortcuts</h2>
    <button class="go-Button go-Button--inline" type="button" data-modal-close="" data-gtmc="modal button" aria-label="Close">
      <img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="">
    </button>
  </div>
  <div class="go-Modal-body">
    <table>
      <tbody>
        <tr>
          <td class="ShortcutsDialog-key">
            <strong>?</strong>
          </td>
          <td> : This menu</td>
        </tr>
        <tr>
          <td class="ShortcutsDialog-key">
            <strong>/</strong>
          </td>
          <td> : Search site</td>
        </tr>
        <tr>
          <td class="ShortcutsDialog-key">
            <strong>f</strong> or <strong>F</strong>
          </td>
          <td> : Jump to</td>
        </tr>
        <tr>
          <td class="ShortcutsDialog-key"><strong>y</strong> or <strong>Y</strong></td>
          <td> : Canonical URL</td>
        </tr>
      </tbody>
    </table>
  </div>
  <div class="go-Modal-actions">
    <button class="go-Button" data-test-id="close-dialog">Close</button>
  </div>
</form>

Text Content

Skip to Main Content
 * Why Go
   * Case Studies
     
     Common problems companies solve with Go
   
   * Use Cases
     
     Stories about how and why companies use Go
   
   * Security Policy
     
     How Go can help keep you secure by default
 * Learn
 * Docs
   * Effective Go
     
     Tips for writing clear, performant, and idiomatic Go code
   
   * Go User Manual
     
     A complete introduction to building software with Go
   
   * Standard library
     
     Reference documentation for Go's standard library
   
   * Release Notes
     
     Learn what's new in each Go release
 * Packages
 * Community
   * Recorded Talks
     
     Videos from prior events
   
   * Meetups
     
     Meet other local Go developers
   
   * Conferences
     
     Learn and network with Go developers from around the world
   
   * Go blog
     
     The Go project's official blog.
   
   * Go project
     
     Get help and stay informed from Go
   
   * Get connected
     
     
     
     

 * Why Go
   Why Go
    * Case Studies
    * Use Cases
    * Security Policy

 * Learn
 * Docs
   Docs
    * Effective Go
    * Go User Manual
    * Standard library
    * Release Notes

 * Packages
 * Community
   Community
    * Recorded Talks
    * Meetups
    * Conferences
    * Go blog
    * Go project
    * Get connected
      


 1. Discover Packages
 2. google.golang.org/grpc
 3. internal
 4. transport


TRANSPORT

package
Version: v1.65.0
Opens a new window with list of versions in this module.
Latest Latest

This package is not in the latest version of its module.

Go to latest Published: Jul 2, 2024 License: Apache-2.0
Opens a new window with license information.
Imports: 45
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Main Versions Licenses Imports Imported By


DETAILS

 * Valid go.mod file
   
   The Go module system was introduced in Go 1.11 and is the official dependency
   management solution for Go.

 * Redistributable license
   
   Redistributable licenses place minimal restrictions on how software can be
   used, modified, and redistributed.

 * Tagged version
   
   Modules with tagged versions give importers more predictable builds.

 * Stable version
   
   When a project reaches major version v1 it is considered stable.

 * Learn more about best practices


REPOSITORY

github.com/grpc/grpc-go


LINKS

 * Open Source Insights

Jump to ...
 * Documentation
   * Overview
   * Index
   * Constants
   * Variables
   * Functions
     * ContextErr(err)
     * GetConnection(ctx)
     * SetConnection(ctx, conn)
   * Types
     * type CallHdr
     * type ClientTransport
       * NewClientTransport(connectCtx, ctx, addr, opts, onClose)
     * type ConnectOptions
     * type ConnectionError
       * (e) Error()
       * (e) Origin()
       * (e) Temporary()
       * (e) Unwrap()
     * type GoAwayReason
     * type NewStreamError
       * (e) Error()
     * type Options
     * type ServerConfig
     * type ServerTransport
       * NewServerHandlerTransport(w, r, stats)
       * NewServerTransport(conn, config)
     * type Stream
       * (s) BytesReceived()
       * (s) ClientAdvertisedCompressors()
       * (s) ContentSubtype()
       * (s) Context()
       * (s) Done()
       * (s) GoString()
       * (s) Header()
       * (s) HeaderWireLength()
       * (s) Method()
       * (s) Read(p)
       * (s) RecvCompress()
       * (s) SendCompress()
       * (s) SendHeader(md)
       * (s) SetContext(ctx)
       * (s) SetHeader(md)
       * (s) SetSendCompress(name)
       * (s) SetTrailer(md)
       * (s) Status()
       * (s) Trailer()
       * (s) TrailersOnly()
       * (s) Unprocessed()
 * Source Files
 * Directories

DocumentationSource
FilesDirectoriesOverviewIndexConstantsVariablesFunctionsTypesContextErr(err)GetConnection(ctx)SetConnection(ctx,
conn)type CallHdrtype ClientTransporttype ConnectOptionstype ConnectionErrortype
GoAwayReasontype NewStreamErrortype Optionstype ServerConfigtype
ServerTransporttype StreamNewClientTransport(connectCtx, ctx, addr, opts,
onClose)(e) Error()(e) Origin()(e) Temporary()(e) Unwrap()(e)
Error()NewServerHandlerTransport(w, r, stats)NewServerTransport(conn, config)(s)
BytesReceived()(s) ClientAdvertisedCompressors()(s) ContentSubtype()(s)
Context()(s) Done()(s) GoString()(s) Header()(s) HeaderWireLength()(s)
Method()(s) Read(p)(s) RecvCompress()(s) SendCompress()(s) SendHeader(md)(s)
SetContext(ctx)(s) SetHeader(md)(s) SetSendCompress(name)(s) SetTrailer(md)(s)
Status()(s) Trailer()(s) TrailersOnly()(s) Unprocessed()


DOCUMENTATION ¶


OVERVIEW ¶

Package transport defines and implements message oriented communication channel
to complete various transactions (e.g., an RPC). It is meant for grpc-internal
usage and is not intended to be imported directly by users.


INDEX ¶

 * Variables
 * func ContextErr(err error) error
 * func GetConnection(ctx context.Context) net.Conn
 * func SetConnection(ctx context.Context, conn net.Conn) context.Context
 * type CallHdr
 * type ClientTransport
 * * func NewClientTransport(connectCtx, ctx context.Context, addr
     resolver.Address, opts ConnectOptions, ...) (ClientTransport, error)
 * type ConnectOptions
 * type ConnectionError
 * * func (e ConnectionError) Error() string
   * func (e ConnectionError) Origin() error
   * func (e ConnectionError) Temporary() bool
   * func (e ConnectionError) Unwrap() error
 * type GoAwayReason
 * type NewStreamError
 * * func (e NewStreamError) Error() string
 * type Options
 * type ServerConfig
 * type ServerTransport
 * * func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request,
     stats []stats.Handler) (ServerTransport, error)
   * func NewServerTransport(conn net.Conn, config *ServerConfig) (_
     ServerTransport, err error)
 * type Stream
 * * func (s *Stream) BytesReceived() bool
   * func (s *Stream) ClientAdvertisedCompressors() []string
   * func (s *Stream) ContentSubtype() string
   * func (s *Stream) Context() context.Context
   * func (s *Stream) Done() <-chan struct{}
   * func (s *Stream) GoString() string
   * func (s *Stream) Header() (metadata.MD, error)
   * func (s *Stream) HeaderWireLength() int
   * func (s *Stream) Method() string
   * func (s *Stream) Read(p []byte) (n int, err error)
   * func (s *Stream) RecvCompress() string
   * func (s *Stream) SendCompress() string
   * func (s *Stream) SendHeader(md metadata.MD) error
   * func (s *Stream) SetContext(ctx context.Context)
   * func (s *Stream) SetHeader(md metadata.MD) error
   * func (s *Stream) SetSendCompress(name string) error
   * func (s *Stream) SetTrailer(md metadata.MD) error
   * func (s *Stream) Status() *status.Status
   * func (s *Stream) Trailer() metadata.MD
   * func (s *Stream) TrailersOnly() bool
   * func (s *Stream) Unprocessed() bool


CONSTANTS ¶

This section is empty.


VARIABLES ¶

View Source

var (
	// ErrIllegalHeaderWrite indicates that setting header is illegal because of
	// the stream's state.
	ErrIllegalHeaderWrite = status.Error(codes.Internal, "transport: SendHeader called multiple times")
	// ErrHeaderListSizeLimitViolation indicates that the header list size is larger
	// than the limit set by peer.
	ErrHeaderListSizeLimitViolation = status.Error(codes.Internal, "transport: trying to send header list size larger than the limit set by peer")
)

View Source

var (
	// ErrConnClosing indicates that the transport is closing.
	ErrConnClosing = connectionErrorf(true, nil, "transport is closing")
)

View Source

var (

	// HTTPStatusConvTab is the HTTP status code to gRPC error code conversion table.
	HTTPStatusConvTab = map[int]codes.Code{

		http.StatusBadRequest: codes.Internal,

		http.StatusUnauthorized: codes.Unauthenticated,

		http.StatusForbidden: codes.PermissionDenied,

		http.StatusNotFound: codes.Unimplemented,

		http.StatusTooManyRequests: codes.Unavailable,

		http.StatusBadGateway: codes.Unavailable,

		http.StatusServiceUnavailable: codes.Unavailable,

		http.StatusGatewayTimeout: codes.Unavailable,
	}
)

View Source

var MaxStreamID = uint32(math.MaxInt32 * 3 / 4)

MaxStreamID is the upper bound for the stream ID before the current transport
gracefully closes and new transport is created for subsequent RPCs. This is set
to 75% of 2^31-1. Streams are identified with an unsigned 31-bit integer. It's
exported so that tests can override it.


FUNCTIONS ¶

FUNC CONTEXTERR ¶

func ContextErr(err error) error

ContextErr converts the error from context package into a status error.

FUNC GETCONNECTION ¶ ADDED IN V1.41.0

func GetConnection(ctx context.Context) net.Conn

GetConnection gets the connection from the context.

FUNC SETCONNECTION ¶ ADDED IN V1.60.0

func SetConnection(ctx context.Context, conn net.Conn) context.Context

SetConnection adds the connection to the context to be able to get information
about the destination ip and port for an incoming RPC. This also allows any
unary or streaming interceptors to see the connection.


TYPES ¶

TYPE CALLHDR ¶

type CallHdr struct {
	// Host specifies the peer's host.
	Host string

	// Method specifies the operation to perform.
	Method string

	// SendCompress specifies the compression algorithm applied on
	// outbound message.
	SendCompress string

	// Creds specifies credentials.PerRPCCredentials for a call.
	Creds credentials.PerRPCCredentials

	// ContentSubtype specifies the content-subtype for a request. For example, a
	// content-subtype of "proto" will result in a content-type of
	// "application/grpc+proto". The value of ContentSubtype must be all
	// lowercase, otherwise the behavior is undefined. See
	// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests
	// for more details.
	ContentSubtype string

	PreviousAttempts int // value of grpc-previous-rpc-attempts header to set

	DoneFunc func() // called when the stream is finished
}

CallHdr carries the information of a particular RPC.

TYPE CLIENTTRANSPORT ¶

type ClientTransport interface {
	// Close tears down this transport. Once it returns, the transport
	// should not be accessed any more. The caller must make sure this
	// is called only once.
	Close(err error)

	// GracefulClose starts to tear down the transport: the transport will stop
	// accepting new RPCs and NewStream will return error. Once all streams are
	// finished, the transport will close.
	//
	// It does not block.
	GracefulClose()

	// Write sends the data for the given stream. A nil stream indicates
	// the write is to be performed on the transport as a whole.
	Write(s *Stream, hdr []byte, data []byte, opts *Options) error

	// NewStream creates a Stream for an RPC.
	NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error)

	// CloseStream clears the footprint of a stream when the stream is
	// not needed any more. The err indicates the error incurred when
	// CloseStream is called. Must be called when a stream is finished
	// unless the associated transport is closing.
	CloseStream(stream *Stream, err error)

	// Error returns a channel that is closed when some I/O error
	// happens. Typically the caller should have a goroutine to monitor
	// this in order to take action (e.g., close the current transport
	// and create a new one) in error case. It should not return nil
	// once the transport is initiated.
	Error() <-chan struct{}

	// GoAway returns a channel that is closed when ClientTransport
	// receives the draining signal from the server (e.g., GOAWAY frame in
	// HTTP/2).
	GoAway() <-chan struct{}

	// GetGoAwayReason returns the reason why GoAway frame was received, along
	// with a human readable string with debug info.
	GetGoAwayReason() (GoAwayReason, string)

	// RemoteAddr returns the remote network address.
	RemoteAddr() net.Addr

	// IncrMsgSent increments the number of message sent through this transport.
	IncrMsgSent()

	// IncrMsgRecv increments the number of message received through this transport.
	IncrMsgRecv()
}

ClientTransport is the common interface for all gRPC client-side transport
implementations.

FUNC NEWCLIENTTRANSPORT ¶

func NewClientTransport(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onClose func(GoAwayReason)) (ClientTransport, error)

NewClientTransport establishes the transport with the required ConnectOptions
and returns it to the caller.

TYPE CONNECTOPTIONS ¶

type ConnectOptions struct {
	// UserAgent is the application user agent.
	UserAgent string
	// Dialer specifies how to dial a network address.
	Dialer func(context.Context, string) (net.Conn, error)
	// FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors.
	FailOnNonTempDialError bool
	// PerRPCCredentials stores the PerRPCCredentials required to issue RPCs.
	PerRPCCredentials []credentials.PerRPCCredentials
	// TransportCredentials stores the Authenticator required to setup a client
	// connection. Only one of TransportCredentials and CredsBundle is non-nil.
	TransportCredentials credentials.TransportCredentials
	// CredsBundle is the credentials bundle to be used. Only one of
	// TransportCredentials and CredsBundle is non-nil.
	CredsBundle credentials.Bundle
	// KeepaliveParams stores the keepalive parameters.
	KeepaliveParams keepalive.ClientParameters
	// StatsHandlers stores the handler for stats.
	StatsHandlers []stats.Handler
	// InitialWindowSize sets the initial window size for a stream.
	InitialWindowSize int32
	// InitialConnWindowSize sets the initial window size for a connection.
	InitialConnWindowSize int32
	// WriteBufferSize sets the size of write buffer which in turn determines how much data can be batched before it's written on the wire.
	WriteBufferSize int
	// ReadBufferSize sets the size of read buffer, which in turn determines how much data can be read at most for one read syscall.
	ReadBufferSize int
	// SharedWriteBuffer indicates whether connections should reuse write buffer
	SharedWriteBuffer bool
	// ChannelzParent sets the addrConn id which initiated the creation of this client transport.
	ChannelzParent *channelz.SubChannel
	// MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received.
	MaxHeaderListSize *uint32
	// UseProxy specifies if a proxy should be used.
	UseProxy bool
}

ConnectOptions covers all relevant options for communicating with the server.

TYPE CONNECTIONERROR ¶

type ConnectionError struct {
	Desc string
	// contains filtered or unexported fields
}

ConnectionError is an error that results in the termination of the entire
connection and the retry of all the active streams.

FUNC (CONNECTIONERROR) ERROR ¶

func (e ConnectionError) Error() string

FUNC (CONNECTIONERROR) ORIGIN ¶

func (e ConnectionError) Origin() error

Origin returns the original error of this connection error.

FUNC (CONNECTIONERROR) TEMPORARY ¶

func (e ConnectionError) Temporary() bool

Temporary indicates if this connection error is temporary or fatal.

FUNC (CONNECTIONERROR) UNWRAP ¶ ADDED IN V1.45.0

func (e ConnectionError) Unwrap() error

Unwrap returns the original error of this connection error or nil when the
origin is nil.

TYPE GOAWAYREASON ¶

type GoAwayReason uint8

GoAwayReason contains the reason for the GoAway frame received.

const (
	// GoAwayInvalid indicates that no GoAway frame is received.
	GoAwayInvalid GoAwayReason = 0
	// GoAwayNoReason is the default value when GoAway frame is received.
	GoAwayNoReason GoAwayReason = 1
	// GoAwayTooManyPings indicates that a GoAway frame with
	// ErrCodeEnhanceYourCalm was received and that the debug data said
	// "too_many_pings".
	GoAwayTooManyPings GoAwayReason = 2
)

TYPE NEWSTREAMERROR ¶ ADDED IN V1.40.0

type NewStreamError struct {
	Err error

	AllowTransparentRetry bool
}

NewStreamError wraps an error and reports additional information. Typically
NewStream errors result in transparent retry, as they mean nothing went onto the
wire. However, there are two notable exceptions:

 1. If the stream headers violate the max header list size allowed by the
    server. It's possible this could succeed on another transport, even if it's
    unlikely, but do not transparently retry.
 2. If the credentials errored when requesting their headers. In this case, it's
    possible a retry can fix the problem, but indefinitely transparently
    retrying is not appropriate as it is likely the credentials, if they can
    eventually succeed, would need I/O to do so.

FUNC (NEWSTREAMERROR) ERROR ¶ ADDED IN V1.40.0

func (e NewStreamError) Error() string

TYPE OPTIONS ¶

type Options struct {
	// Last indicates whether this write is the last piece for
	// this stream.
	Last bool
}

Options provides additional hints and information for message transmission.

TYPE SERVERCONFIG ¶

type ServerConfig struct {
	MaxStreams            uint32
	ConnectionTimeout     time.Duration
	Credentials           credentials.TransportCredentials
	InTapHandle           tap.ServerInHandle
	StatsHandlers         []stats.Handler
	KeepaliveParams       keepalive.ServerParameters
	KeepalivePolicy       keepalive.EnforcementPolicy
	InitialWindowSize     int32
	InitialConnWindowSize int32
	WriteBufferSize       int
	ReadBufferSize        int
	SharedWriteBuffer     bool
	ChannelzParent        *channelz.Server
	MaxHeaderListSize     *uint32
	HeaderTableSize       *uint32
}

ServerConfig consists of all the configurations to establish a server transport.

TYPE SERVERTRANSPORT ¶

type ServerTransport interface {
	// HandleStreams receives incoming streams using the given handler.
	HandleStreams(context.Context, func(*Stream))

	// WriteHeader sends the header metadata for the given stream.
	// WriteHeader may not be called on all streams.
	WriteHeader(s *Stream, md metadata.MD) error

	// Write sends the data for the given stream.
	// Write may not be called on all streams.
	Write(s *Stream, hdr []byte, data []byte, opts *Options) error

	// WriteStatus sends the status of a stream to the client.  WriteStatus is
	// the final call made on a stream and always occurs.
	WriteStatus(s *Stream, st *status.Status) error

	// Close tears down the transport. Once it is called, the transport
	// should not be accessed any more. All the pending streams and their
	// handlers will be terminated asynchronously.
	Close(err error)

	// Peer returns the peer of the server transport.
	Peer() *peer.Peer

	// Drain notifies the client this ServerTransport stops accepting new RPCs.
	Drain(debugData string)

	// IncrMsgSent increments the number of message sent through this transport.
	IncrMsgSent()

	// IncrMsgRecv increments the number of message received through this transport.
	IncrMsgRecv()
}

ServerTransport is the common interface for all gRPC server-side transport
implementations.

Methods may be called concurrently from multiple goroutines, but Write methods
for a given Stream will be called serially.

FUNC NEWSERVERHANDLERTRANSPORT ¶

func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error)

NewServerHandlerTransport returns a ServerTransport handling gRPC from inside an
http.Handler, or writes an HTTP error to w and returns an error. It requires
that the http Server supports HTTP/2.

FUNC NEWSERVERTRANSPORT ¶

func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error)

NewServerTransport creates a http2 transport with conn and configuration options
from config.

It returns a non-nil transport and a nil error on success. On failure, it
returns a nil transport and a non-nil error. For a special case where the
underlying conn gets closed before the client preface could be read, it returns
a nil transport and a nil error.

TYPE STREAM ¶

type Stream struct {
	// contains filtered or unexported fields
}

Stream represents an RPC in the transport layer.

FUNC (*STREAM) BYTESRECEIVED ¶

func (s *Stream) BytesReceived() bool

BytesReceived indicates whether any bytes have been received on this stream.

FUNC (*STREAM) CLIENTADVERTISEDCOMPRESSORS ¶ ADDED IN V1.54.0

func (s *Stream) ClientAdvertisedCompressors() []string

ClientAdvertisedCompressors returns the compressor names advertised by the
client via grpc-accept-encoding header.

FUNC (*STREAM) CONTENTSUBTYPE ¶

func (s *Stream) ContentSubtype() string

ContentSubtype returns the content-subtype for a request. For example, a
content-subtype of "proto" will result in a content-type of
"application/grpc+proto". This will always be lowercase. See
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for more
details.

FUNC (*STREAM) CONTEXT ¶

func (s *Stream) Context() context.Context

Context returns the context of the stream.

FUNC (*STREAM) DONE ¶

func (s *Stream) Done() <-chan struct{}

Done returns a channel which is closed when it receives the final status from
the server.

FUNC (*STREAM) GOSTRING ¶

func (s *Stream) GoString() string

GoString is implemented by Stream so context.String() won't race when printing
%#v.

FUNC (*STREAM) HEADER ¶

func (s *Stream) Header() (metadata.MD, error)

Header returns the header metadata of the stream.

On client side, it acquires the key-value pairs of header metadata once it is
available. It blocks until i) the metadata is ready or ii) there is no header
metadata or iii) the stream is canceled/expired.

On server side, it returns the out header after t.WriteHeader is called. It does
not block and must not be called until after WriteHeader.

FUNC (*STREAM) HEADERWIRELENGTH ¶ ADDED IN V1.60.0

func (s *Stream) HeaderWireLength() int

HeaderWireLength returns the size of the headers of the stream as received from
the wire. Valid only on the server.

FUNC (*STREAM) METHOD ¶

func (s *Stream) Method() string

Method returns the method for the stream.

FUNC (*STREAM) READ ¶

func (s *Stream) Read(p []byte) (n int, err error)

Read reads all p bytes from the wire for this stream.

FUNC (*STREAM) RECVCOMPRESS ¶

func (s *Stream) RecvCompress() string

RecvCompress returns the compression algorithm applied to the inbound message.
It is empty string if there is no compression applied.

FUNC (*STREAM) SENDCOMPRESS ¶ ADDED IN V1.54.0

func (s *Stream) SendCompress() string

SendCompress returns the send compressor name.

FUNC (*STREAM) SENDHEADER ¶

func (s *Stream) SendHeader(md metadata.MD) error

SendHeader sends the given header metadata. The given metadata is combined with
any metadata set by previous calls to SetHeader and then written to the
transport stream.

FUNC (*STREAM) SETCONTEXT ¶ ADDED IN V1.60.0

func (s *Stream) SetContext(ctx context.Context)

SetContext sets the context of the stream. This will be deleted once the stats
handler callouts all move to gRPC layer.

FUNC (*STREAM) SETHEADER ¶

func (s *Stream) SetHeader(md metadata.MD) error

SetHeader sets the header metadata. This can be called multiple times. Server
side only. This should not be called in parallel to other data writes.

FUNC (*STREAM) SETSENDCOMPRESS ¶

func (s *Stream) SetSendCompress(name string) error

SetSendCompress sets the compression algorithm to the stream.

FUNC (*STREAM) SETTRAILER ¶

func (s *Stream) SetTrailer(md metadata.MD) error

SetTrailer sets the trailer metadata which will be sent with the RPC status by
the server. This can be called multiple times. Server side only. This should not
be called parallel to other data writes.

FUNC (*STREAM) STATUS ¶

func (s *Stream) Status() *status.Status

Status returns the status received from the server. Status can be read safely
only after the stream has ended, that is, after Done() is closed.

FUNC (*STREAM) TRAILER ¶

func (s *Stream) Trailer() metadata.MD

Trailer returns the cached trailer metedata. Note that if it is not called after
the entire stream is done, it could return an empty MD. Client side only. It can
be safely read only after stream has ended that is either read or write have
returned io.EOF.

FUNC (*STREAM) TRAILERSONLY ¶

func (s *Stream) TrailersOnly() bool

TrailersOnly blocks until a header or trailers-only frame is received and then
returns true if the stream was trailers-only. If the stream ends before headers
are received, returns true, nil. Client-side only.

FUNC (*STREAM) UNPROCESSED ¶

func (s *Stream) Unprocessed() bool

Unprocessed indicates whether the server did not process this stream -- i.e. it
sent a refused stream or GOAWAY including this stream ID.


SOURCE FILES ¶

View all Source files
 * bdp_estimator.go
 * controlbuf.go
 * defaults.go
 * flowcontrol.go
 * handler_server.go
 * http2_client.go
 * http2_server.go
 * http_util.go
 * logging.go
 * proxy.go
 * transport.go


DIRECTORIES ¶

Show internal Collapse all

Path Synopsis
networktype
Package networktype declares the network type to be used in the default dialer.
Package networktype declares the network type to be used in the default dialer.

Click to show internal directories.
Click to hide internal directories.

Why Go Use Cases Case Studies
Get Started Playground Tour Stack Overflow Help
Packages Standard Library Sub-repositories About Go Packages
About Download Blog Issue Tracker Release Notes Brand Guidelines Code of Conduct
Connect Twitter GitHub Slack r/golang Meetup Golang Weekly
 * Copyright
 * Terms of Service
 * Privacy Policy
 * Report an Issue

 * Theme Toggle

 * Shortcuts Modal


JUMP TO



Close


KEYBOARD SHORTCUTS

? : This menu / : Search site f or F : Jump to y or Y : Canonical URL

Close
go.dev uses cookies from Google to deliver and enhance the quality of its
services and to analyze traffic. Learn more.
Okay