Documentation ¶
Overview ¶
Package transport MIT License
# Copyright (c) 2024 go-fox Author https://github.com/go-fox/fox
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func FromPeerContext(ctx context.Context) (peer *selector.Peer, ok bool)
- func NewClientContext(ctx context.Context, tr Transporter) context.Context
- func NewPeerClient(ctx context.Context, peer *selector.Peer) context.Context
- func NewServerContext(ctx context.Context, tr Transporter) context.Context
- type Endpointer
- type Header
- type Kind
- type Server
- type Transporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromPeerContext ¶
FromPeerContext returns the selector.Peer value stored in ctx, if any.
func NewClientContext ¶
func NewClientContext(ctx context.Context, tr Transporter) context.Context
NewClientContext returns a new Context that carries Transport value.
func NewPeerClient ¶
NewPeerClient returns a new context that carries selector.Peer value.
func NewServerContext ¶
func NewServerContext(ctx context.Context, tr Transporter) context.Context
NewServerContext returns a new Context that carries Transport value.
Types ¶
type Endpointer ¶
Endpointer is a registry endpoint
type Header ¶
type Header interface { Get(key string) string Set(key string, value string) Add(key string, value string) Keys() []string Values(key string) []string }
Header is the storage medium used by a Header.
type Transporter ¶
type Transporter interface { // Kind transporter Kind() Kind // Endpoint return server or client endpoint // Server Transport: grpc://127.0.0.1:9000 // Client Transport: discovery:///provider-demo Endpoint() string // Operation Service full method selector generated by protobuf // example: /Echo.Echo/SayHello Operation() string // RequestHeader return transport request header // http: http.Header // grpc: metadata.MD RequestHeader() Header // ReplyHeader return transport reply/response header // only valid for server transport // http: http.Header // grpc: metadata.MD ReplyHeader() Header }
Transporter is transport context value interface.
func FromClientContext ¶
func FromClientContext(ctx context.Context) (tr Transporter, ok bool)
FromClientContext returns the Transport value stored in ctx, if any.
func FromServerContext ¶
func FromServerContext(ctx context.Context) (tr Transporter, ok bool)
FromServerContext returns the Transport value stored in ctx, if any.
Directories ¶
Path | Synopsis |
---|---|
Package grpc MIT License
|
Package grpc MIT License |
resolver/direct
Package direct MIT License
|
Package direct MIT License |
resolver/discovery
Package discovery MIT License
|
Package discovery MIT License |
Package http MIT License
|
Package http MIT License |
binding
Package binding MIT License
|
Package binding MIT License |
Package websocket MIT License
|
Package websocket MIT License |