Versions in this module Expand all Collapse all v0 v0.1.0 Apr 13, 2024 Changes in this version + func DeviceIDFromCert(cert []byte) entity.DeviceID + type Client struct + func NewClient(options *ClientOptions) (cli *Client) + func (cli *Client) Close() error + func (cli *Client) Serve(ctx context.Context) + type ClientOptions struct + Handler ConnectionHandler + type ConnectionHandler interface + Close func() error + ServeConn func(ctx context.Context, conn quic.Connection) + type ConnectionProvider interface + Acquire func(ctx context.Context, peer *entity.Server) (quic.Connection, error) + type ConnectionTracker interface + Close func() error + Enter func(conn_id uint64, device_id entity.DeviceID, conn quic.Connection) + Leave func(conn_id uint64, device_id entity.DeviceID, conn quic.Connection) + func NewDefaultConnectionTracker() ConnectionTracker + type DefaultConnectionHandler struct + Handler StreamHandler + Tracker ConnectionTracker + func (svr *DefaultConnectionHandler) Close() error + func (svr *DefaultConnectionHandler) ServeConn(ctx context.Context, conn quic.Connection) + type DefaultConnectionProvider struct + func (provider *DefaultConnectionProvider) Acquire(ctx context.Context, peer *entity.Server) (conn quic.Connection, err error) + type DefaultConnectionTracker struct + func (st *DefaultConnectionTracker) Close() error + func (st *DefaultConnectionTracker) Enter(conn_id uint64, device_id entity.DeviceID, conn quic.Connection) + func (st *DefaultConnectionTracker) Leave(conn_id uint64, device_id entity.DeviceID, conn quic.Connection) + type DefaultSessionManager struct + func (mgr *DefaultSessionManager) Acquire(ctx context.Context, peer *entity.Server) (ss *SessionStream, err error) + func (mgr *DefaultSessionManager) Close() error + func (mgr *DefaultSessionManager) EnsureConn(ctx context.Context, peer *entity.Server) (conn quic.Connection, err error) + func (mgr *DefaultSessionManager) Serve(ctx context.Context) + type DialOptions struct + Address string + ApplicationProtocol string + Backoff time.Duration + Certificate string + PrivateKey string + Retry int + type Resolver interface + Close func() error + Resolve func(ctx context.Context, peer *entity.Server) error + Serve func(ctx context.Context) + type ServeMux struct + func NewServeMux() (mux *ServeMux) + func (mux ServeMux) Handle(path string, handler StreamHandler) + func (mux ServeMux) HandleFunc(path string, fn func(ctx context.Context, ss *SessionStream)) + func (mux ServeMux) ServeStream(ctx context.Context, src *SessionStream) + type Server struct + func NewServer(options *ServerOptions) (svr *Server, err error) + func (svr *Server) Close() error + func (svr *Server) Serve(ctx context.Context) + type ServerOptions struct + ApplicationProtocol string + Authorize func(device_id entity.DeviceID) bool + Certificate string + Handler ConnectionHandler + PrivateKey string + type SessionManager interface + Acquire func(ctx context.Context, peer *entity.Server) (stream *SessionStream, err error) + Close func() error + EnsureConn func(ctx context.Context, peer *entity.Server) (conn quic.Connection, err error) + Serve func(ctx context.Context) + func NewSessionManager(options *SessionManagerOptions) (mgr SessionManager) + type SessionManagerOptions struct + Handler ConnectionHandler + Resolver Resolver + type SessionStream struct + Conn quic.Connection + Peer entity.Server + func NewSessionStream(peer *entity.Server, conn quic.Connection) (ss *SessionStream, err error) + func (ss *SessionStream) CloseWrite() error + func (ss *SessionStream) Read(data []byte) (int, error) + func (ss *SessionStream) Reader() *bufio.Reader + func (ss *SessionStream) RemoteAddr() net.Addr + func (ss *SessionStream) RemotePeer() *entity.Server + func (ss *SessionStream) Write(data []byte) (int, error) + type StreamHandler interface + ServeStream func(ctx context.Context, stream *SessionStream) + type StreamHandlerFunc struct + func (shf StreamHandlerFunc) ServeStream(ctx context.Context, ss *SessionStream) + type Transport struct + var DefaultTransport *Transport + func InitTransport(options TransportOptions) (tr *Transport, err error) + func (tr *Transport) Close() (err error) + func (tr *Transport) Dial(ctx context.Context, options *DialOptions) (conn quic.Connection, device_id entity.DeviceID, err error) + func (tr *Transport) LocalAddress() net.Addr + func (tr *Transport) WriteTo(b []byte, a net.Addr) (int, error) + type TransportOptions struct + LocalAddress string