quic

package
v1.36.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is a pkg/quic error.
	Error = errs.Class("quic")
)

Functions

func NewListener

func NewListener(conn *net.UDPConn, tlsConfig *tls.Config, quicConfig *quic.Config) (net.Listener, error)

NewListener returns a new listener instance for QUIC. The quic.Config may be nil, in that case the default values will be used. if the provided context is closed, all existing or following Accept calls will return an error.

func TrackClose

func TrackClose(conn rpc.ConnectorConn) rpc.ConnectorConn

TrackClose wraps the conn and sets a finalizer on the returned value to close the conn and monitor that it was leaked.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a wrapper around a quic connection and fulfills net.Conn interface.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the quic connection.

func (*Conn) ConnectionState

func (c *Conn) ConnectionState() tls.ConnectionState

ConnectionState converts quic session state to tls connection state and returns tls state.

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr returns the local address.

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

Read implements the Conn Read method.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr returns the address of the peer.

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call.

func (*Conn) Write

func (c *Conn) Write(b []byte) (_ int, err error)

Write implements the Conn Write method.

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

Connector implements a dialer that creates a quic connection.

func NewDefaultConnector

func NewDefaultConnector(quicConfig *quic.Config) Connector

NewDefaultConnector instantiates a new instance of Connector. If no quic configuration is provided, default value will be used.

func (Connector) DialContext

func (c Connector) DialContext(ctx context.Context, tlsConfig *tls.Config, address string) (_ rpc.ConnectorConn, err error)

DialContext creates a quic connection.

func (Connector) SetTransferRate

func (c Connector) SetTransferRate(rate memory.Size) Connector

SetTransferRate returns a QUIC connector with the given transfer rate.

func (Connector) TransferRate

func (c Connector) TransferRate() memory.Size

TransferRate returns the transfer rate set on the connector.

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener implements listener for QUIC.

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Accept waits for and returns the next available quic session to the listener.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns the local network addr that the server is listening on.

func (*Listener) Close

func (l *Listener) Close() (err error)

Close closes the QUIC listener.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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