quic

package
v1.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnTypeSource       string = "source"
	ConnTypeFlow         string = "flow"
	ConnTypeSink         string = "sink"
	ConnTypeServerless   string = "serverless"
	ConnTypeZipperSender string = "zipper-sender"
)

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.

func NewClient added in v0.5.0

func NewClient(addr string) (Client, error)

NewClient inits the default implementation of 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

func NewQuicConn(name string, connType string) *QuicConn

NewQuicConn inits a new QUIC connection.

func (*QuicConn) Close added in v1.3.2

func (c *QuicConn) Close() error

Close the QUIC connections.

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

func (c *QuicConn) SendSignal(b []byte) error

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

type ServerHandler interface {
	Listen() error
	Read(id int64, sess Session, st Stream) error
}

ServerHandler defines interface to handle the QUIC stream callbacks.

type Session added in v1.2.520

type Session interface {
	quic.Session
}

type Stream

type Stream interface {
	quic.Stream
}

Stream is the QUIC stream

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL