Documentation
¶
Index ¶
- func NewMockClient(ctx context.Context, fun interface{}, s interface{}) (c mockClient, err error)
- type CliMethod
- type CliParam
- type Client
- func (c Client) Close(ctx context.Context) (err error)
- func (c Client) Invoke(ctx context.Context, method string, req codec.Msg, resp codec.Msg) (err error)
- func (c *Client) Stream(ctx context.Context, method string) (stream *codec.Stream, err error)
- func (c *Client) StreamAsync(ctx context.Context, method string) (stream *codec.Stream, err error)
- func (c *Client) Upgrade(ctx context.Context, method string, req, res codec.Msg) (upgrade *codec.Upgrade, err error)
- func (rpc *Client) Use(middleware ...MiddlewareReqFunc)
- type LogidKey
- type MiddlewareReqFunc
- type MiddlewareRespFunc
- type Peer
- func (rpc *Peer) ClientPassKey(cliPassKeys ...string)
- func (rpc *Peer) ClientUse(middleware ...MiddlewareReqFunc)
- func (rpc Peer) Clone(ctx context.Context, rwc io.ReadWriteCloser, svc interface{}) (out Peer, err error)
- func (rpc Peer) Close(ctx context.Context) (err error)
- func (rpc *Peer) Conn(ctx context.Context, rwc io.ReadWriteCloser) (err error)
- func (rpc Peer) Done() <-chan struct{}
- func (rpc Peer) IsClosed() bool
- func (rpc *Peer) ServiceUse(middleware ...MiddlewareRespFunc)
- type Service
- func (s Service) AllInterfaces() (is []SvcMethod)
- func (s Service) Call(ctx context.Context, methodIdx uint32, req unsafe.Pointer) (resp unsafe.Pointer, err error)
- func (s Service) CloneMethods(svc interface{}) []codec.Method
- func (c Service) Close(ctx context.Context) (err error)
- func (s Service) MethodIdx(method string) (idx uint32, exist bool)
- func (s Service) Methods() []codec.Method
- func (rpc *Service) Use(middleware ...MiddlewareRespFunc)
- type SvcMethod
- type SvcParam
- type WrapSvcMethod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockClient ¶
NewClient fun: pb.RegisterHelloServer(s *grpc.Server, srv HelloServer)
Types ¶
type CliParam ¶
type Client ¶
func StartClient ¶
func StartClient(ctx context.Context, rwc io.ReadWriteCloser, fRegisters ...interface{}) (c Client, err error)
StartClient fRegister: pb.RegisterHelloServer(s *grpc.Server, srv HelloServer)
func (*Client) StreamAsync ¶
StreamAsync 不等对方返回
func (*Client) Upgrade ¶
func (c *Client) Upgrade(ctx context.Context, method string, req, res codec.Msg) (upgrade *codec.Upgrade, err error)
Stream 流式调用
func (*Client) Use ¶
func (rpc *Client) Use(middleware ...MiddlewareReqFunc)
type MiddlewareReqFunc ¶
type MiddlewareReqFunc = func(*CliParam)
type MiddlewareRespFunc ¶
type MiddlewareRespFunc = func(*SvcParam)
type Peer ¶
func NewPeer ¶
ctx 里 PassthroughKey{} 的 []string 类型; ctx透传value 的key列表, 传value总和长度不能超过65532 fRegisters: 自己需要实现的server接口、需要请求对方的client接口注册函数.
func (*Peer) ClientPassKey ¶
value 必须是 []string 类型的才会透传到 server 端
func (*Peer) ClientUse ¶
func (rpc *Peer) ClientUse(middleware ...MiddlewareReqFunc)
func (*Peer) ServiceUse ¶
func (rpc *Peer) ServiceUse(middleware ...MiddlewareRespFunc)
type Service ¶
func StartService ¶
func StartService(ctx context.Context, rwc io.ReadWriteCloser, svc interface{}, fRegisters ...interface{}) (s Service, err error)
StartService fRegister: pb.RegisterHelloService, svc: implementation
func (Service) AllInterfaces ¶
func (Service) CloneMethods ¶
func (*Service) Use ¶
func (rpc *Service) Use(middleware ...MiddlewareRespFunc)
type SvcMethod ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
test
|
|
|
nat/client
command
|
|
|
nat/service
command
|
|
|
quic/client
command
|
|
|
quic/service
command
|
|
|
socks/client
command
|
|
|
socks/proxy
command
|
|
|
socks/service
command
|
|
|
socks_kcp/client
command
|
|
|
socks_kcp/service
command
|
|
|
socks_nat/client
command
|
|
|
socks_nat/service
command
|
|
|
socks_quic/client
command
|
|
|
socks_quic/service
command
|
|
|
socks_quic2/client
command
|
|
|
socks_quic2/proxy
command
|
|
|
socks_quic2/service
command
|
|
|
socks_stream/client
command
|
|
|
socks_stream/proxy
command
|
|
|
socks_stream/service
command
|
|
|
socks_udp/client
command
|
|
|
socks_udp/service
command
|
|
|
tcp/client
command
|
|
|
tcp/service
command
|
|
|
tcp_upgrade/client
command
|
|
|
tcp_upgrade/service
command
|
|
|
test_broadcast/client
command
|
|
|
test_broadcast/service
command
|
Click to show internal directories.
Click to hide internal directories.