Documentation ¶
Overview ¶
Package http implements the HTTP inbound and outbound transports for YARPC.
Note that the Close method for the HTTP Inbound does NOT immediately close the ongoing connections. The connection will remain open until all clients have disconnected.
Index ¶
Constants ¶
const ( // ApplicationHeaderPrefix is the prefix added to application headers over // the wire. ApplicationHeaderPrefix = "Rpc-Header-" // BaggageHeaderPrefix is the prefix added to context headers over the wire. BaggageHeaderPrefix = "Context-" // CallerHeader is the HTTP header used to indiate the service doing the calling CallerHeader = "Rpc-Caller" // EncodingHeader is the HTTP header used to specify the name of the // encoding. EncodingHeader = "Rpc-Encoding" // TTLMSHeader is the HTTP header used to indicate the ttl in ms TTLMSHeader = BaggageHeaderPrefix + "TTL-MS" // ProcedureHeader is the HTTP header used to indicate the procedure ProcedureHeader = "Rpc-Procedure" // ServiceHeader is the HTTP header used to indicate the service ServiceHeader = "Rpc-Service" // ShardKeyHeader is the HTTP header used by a clustered service to // identify the node responsible for handling the request. ShardKeyHeader = "Rpc-Shard-Key" // RoutingKeyHeader is the HTTP header used by a relay to identify // the traffic group responsible for handling the request, overriding the // service name when available. RoutingKeyHeader = "Rpc-Routing-Key" // RoutingDelegateHeader is the HTTP header used by a relay to identify a // service that can proxy for the destined service and perform // application-specific routing. RoutingDelegateHeader = "Rpc-Routing-Delegate" )
Variables ¶
This section is empty.
Functions ¶
func NewOutbound ¶
func NewOutbound(url string, opts ...OutboundOption) transport.Outbound
NewOutbound builds a new HTTP outbound that sends requests to the given URL.
Types ¶
type Inbound ¶
type Inbound interface { transport.Inbound // Address on which the server is listening. Returns nil if Start has not // been called yet. Addr() net.Addr }
Inbound represents an HTTP Inbound. It is the same as the transport Inbound except it exposes the address on which the system is listening for connections.
func NewInbound ¶
func NewInbound(addr string, opts ...InboundOption) Inbound
NewInbound builds a new HTTP inbound that listens on the given address.
type InboundOption ¶
type InboundOption func(*inbound)
InboundOption is an option for an HTTP inbound.
type OutboundOption ¶
type OutboundOption func(*outboundConfig)
OutboundOption customizes the behavior of an HTTP outbound.
func KeepAlive ¶
func KeepAlive(t time.Duration) OutboundOption
KeepAlive specifies the keep-alive period for the network connection. If zero, keep-alives are disabled.
Defaults to 30 seconds.