Documentation ¶
Index ¶
- Constants
- Variables
- func IoExchange(a, b io.ReadWriteCloser, done chan struct{}) (err error)
- type AgentClientState
- type Client
- func (client *Client) Close() (err error)
- func (client *Client) CloseWithError(err error) error
- func (client *Client) Dial(network, address string) (conn net.Conn, err error)
- func (client *Client) Err() (err error)
- func (client *Client) Multiplexing() int32
- func (client *Client) Ping() (err error)
- func (client *Client) State() AgentClientState
- func (client *Client) Wait(ctx context.Context) (err error)
- func (client *Client) WaitForStateChange(ctx context.Context, sourceState AgentClientState) (state AgentClientState, err error)
- type ClientConn
- func (cc *ClientConn) Close() (err error)
- func (cc *ClientConn) Fork() *ClientConn
- func (cc *ClientConn) Ref() int32
- func (cc *ClientConn) State() (grpc.ConnectivityState, error)
- func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState grpc.ConnectivityState) (grpc.ConnectivityState, error)
- type Server
- func (srv *Server) Connect(ctx context.Context, req *agent.ConnectRequest) (reply *agent.ConnectReply, err error)
- func (srv *Server) Exchange(stream agent.Agent_ExchangeServer) (err error)
- func (srv *Server) Heartbeat(ctx context.Context, ping *agent.Ping) (pong *agent.Pong, err error)
- func (srv *Server) Hello(ctx context.Context, req *agent.HelloRequest) (reply *agent.HelloReply, err error)
- func (srv *Server) ListenAndServe(network, address string, opts ...grpc.ServerOption) (err error)
- type Session
- type StreamPipe
- func (pipe *StreamPipe) Attach(cc *ClientConn)
- func (pipe *StreamPipe) Close() (err error)
- func (pipe *StreamPipe) CloseWithError(err error) error
- func (pipe *StreamPipe) Err() (err error)
- func (pipe *StreamPipe) LocalAddr() net.Addr
- func (pipe *StreamPipe) Read(buf []byte) (n int, err error)
- func (pipe *StreamPipe) RemoteAddr() net.Addr
- func (pipe *StreamPipe) SetDeadline(t time.Time) error
- func (pipe *StreamPipe) SetReadDeadline(t time.Time) error
- func (pipe *StreamPipe) SetWriteDeadline(t time.Time) error
- func (pipe *StreamPipe) Write(buf []byte) (n int, err error)
Constants ¶
View Source
const ( PipeChannelBuffSize int = 10 PipeAcksMaxSize int = 100 )
Variables ¶
View Source
var ( ErrVersionNotSupported = grpc.Errorf(codes.Aborted, "version not supported") ErrSessionLoss error = grpc.Errorf(codes.InvalidArgument, "session loss") ErrChannelLoss error = grpc.Errorf(codes.InvalidArgument, "channel loss") ErrSessionInvaild error = grpc.Errorf(codes.PermissionDenied, "session invaild") ErrChannelInvaild error = grpc.Errorf(codes.PermissionDenied, "channel invaild") ErrAckTimeout error = grpc.Errorf(codes.Canceled, "ack timeout") )
Functions ¶
func IoExchange ¶
func IoExchange(a, b io.ReadWriteCloser, done chan struct{}) (err error)
Types ¶
type AgentClientState ¶
type AgentClientState int
const ( Idle AgentClientState = iota Offline //connecting // Online //need login Logoff Logon Die )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CloseWithError ¶
func (*Client) Multiplexing ¶
func (*Client) State ¶
func (client *Client) State() AgentClientState
func (*Client) WaitForStateChange ¶
func (client *Client) WaitForStateChange(ctx context.Context, sourceState AgentClientState) (state AgentClientState, err error)
blocks until the state change, or context is done
type ClientConn ¶
type ClientConn struct { agent.AgentClient // contains filtered or unexported fields }
func Dial ¶
func Dial(target string, opts ...grpc.DialOption) (cc *ClientConn, err error)
func (*ClientConn) Close ¶
func (cc *ClientConn) Close() (err error)
func (*ClientConn) Fork ¶
func (cc *ClientConn) Fork() *ClientConn
func (*ClientConn) Ref ¶
func (cc *ClientConn) Ref() int32
func (*ClientConn) State ¶
func (cc *ClientConn) State() (grpc.ConnectivityState, error)
func (*ClientConn) WaitForStateChange ¶
func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState grpc.ConnectivityState) (grpc.ConnectivityState, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Connect ¶
func (srv *Server) Connect(ctx context.Context, req *agent.ConnectRequest) (reply *agent.ConnectReply, err error)
func (*Server) Exchange ¶
func (srv *Server) Exchange(stream agent.Agent_ExchangeServer) (err error)
bidirection stream procedure client must ack
func (*Server) Hello ¶
func (srv *Server) Hello(ctx context.Context, req *agent.HelloRequest) (reply *agent.HelloReply, err error)
func (*Server) ListenAndServe ¶
func (srv *Server) ListenAndServe(network, address string, opts ...grpc.ServerOption) (err error)
type StreamPipe ¶
type StreamPipe struct {
// contains filtered or unexported fields
}
wrap grpc stream as net.Conn
func NewStreamPipe ¶
func NewStreamPipe(stream agentStream) *StreamPipe
func (*StreamPipe) Attach ¶
func (pipe *StreamPipe) Attach(cc *ClientConn)
func (*StreamPipe) Close ¶
func (pipe *StreamPipe) Close() (err error)
func (*StreamPipe) CloseWithError ¶
func (pipe *StreamPipe) CloseWithError(err error) error
func (*StreamPipe) Err ¶
func (pipe *StreamPipe) Err() (err error)
func (*StreamPipe) LocalAddr ¶
func (pipe *StreamPipe) LocalAddr() net.Addr
func (*StreamPipe) RemoteAddr ¶
func (pipe *StreamPipe) RemoteAddr() net.Addr
func (*StreamPipe) SetDeadline ¶
func (pipe *StreamPipe) SetDeadline(t time.Time) error
func (*StreamPipe) SetReadDeadline ¶
func (pipe *StreamPipe) SetReadDeadline(t time.Time) error
func (*StreamPipe) SetWriteDeadline ¶
func (pipe *StreamPipe) SetWriteDeadline(t time.Time) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.