Documentation ¶
Index ¶
Constants ¶
Variables ¶
View Source
var ( // SignalHeartbeat represents the signal of Heartbeat. SignalHeartbeat = []byte{0} // SignalAccepted represents the signal of Accpeted. SignalAccepted = []byte{1} // SignalFlowSink represents the signal for flow/sink. SignalFlowSink = []byte{0, 0} )
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.5.0
type Client interface { // CreateStream creates a bidirectional stream. CreateStream(ctx context.Context) (Stream, error) Close() error }
Client is the QUIC client.
type QuicConn ¶ added in v1.3.2
type QuicConn struct { Signal io.ReadWriter Stream io.ReadWriter Type string Name string Heartbeat chan byte IsClosed bool Ready bool OnClosed func() error // OnClosed is the callback when the connection is closed. OnHeartbeatReceived func() // OnHeartbeatReceived is the callback when the heartbeat is received. OnHeartbeatExpired func() // OnHeartbeatExpired is the callback when the heartbeat is expired. }
QuicConn represents the QUIC connection.
func NewQuicConn ¶ added in v1.3.2
NewQuicConn inits a new QUIC connection.
func (*QuicConn) Healthcheck ¶ added in v1.3.2
func (c *QuicConn) Healthcheck()
Healthcheck checks if receiving the heartbeat from peer.
func (*QuicConn) SendSignal ¶ added in v1.3.2
SendSignal sends the signal to client.
type Server ¶
type Server interface { // SetHandler sets QUIC callbacks. SetHandler(handler ServerHandler) // ListenAndServe starts listening on UDP network address addr and // serves incoming packets. ListenAndServe(ctx context.Context, addr string) error }
Server is the QUIC server.
func NewServer ¶
func NewServer(handler ServerHandler) Server
NewServer inits the default implementation of QUIC server.
type ServerHandler ¶
ServerHandler defines interface to handle the QUIC stream callbacks.
Click to show internal directories.
Click to hide internal directories.