Interfaces
Server
Transport server interface that all transport implementations must satisfy.Starts the transport server. Blocks until the server stops or context is canceled.
Gracefully stops the transport server within the context deadline.
Endpointer
Interface for services that can provide their endpoint URL.Returns the endpoint URL of the service (e.g.,
http://127.0.0.1:8000 or grpc://127.0.0.1:9000)Header
Storage interface for transport headers.Returns the first value associated with the key
Sets the header entry, replacing any existing values
Adds a value to the header entry
Returns all header keys
Returns all values associated with the key
Transporter
Transport context value interface providing access to transport information.Returns the transport kind (“grpc” or “http”)
Returns the server or client endpoint.
- Server:
grpc://127.0.0.1:9000orhttp://127.0.0.1:8000 - Client:
discovery:///provider-demo
Returns the service full method selector generated by protobuf.
Example:
/helloworld.Greeter/SayHelloReturns the transport request header (http.Header for HTTP, metadata.MD for gRPC)
Returns the transport reply/response header. Only valid for server transport.
(http.Header for HTTP, metadata.MD for gRPC)
Types
Kind
Defines the type of transport.gRPC transport kind
HTTP transport kind
Context Functions
NewServerContext
Returns a new Context that carries the server Transporter value.The parent context
The Transporter to attach
Context with server Transporter attached
FromServerContext
Returns the server Transporter value stored in context.Context to retrieve Transporter from
The retrieved Transporter instance
Whether the Transporter was found
NewClientContext
Returns a new Context that carries the client Transporter value.The parent context
The Transporter to attach
Context with client Transporter attached
FromClientContext
Returns the client Transporter value stored in context.Context to retrieve Transporter from
The retrieved Transporter instance
Whether the Transporter was found