squic

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CtxTimedOutError is a custom QUIC error code that is used when canceling
	// writes due to context expiration.
	CtxTimedOutError quic.ApplicationErrorCode = iota + 1
	// OpenStreamError is the error code when failing to opening a stream.
	OpenStreamError
	// AcceptStreamError is the error code when failing to accept a stream.
	AcceptStreamError
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnDialer

type ConnDialer struct {
	// Conn is the transport to initiate QUIC Sessions on. It can be shared
	// between clients and servers, because QUIC connection IDs are used to
	// demux the packets.
	//
	// Note: When creating the transport, ensure that the SCMP errors are not
	// propagated. You can for example use
	// [github.com/scionproto/scion/pkg/snet.SCMPPropagationStopper]. Otherwise,
	// the QUIC transport will close the listening side on SCMP errors and enter
	// a broken state.
	Transport *quic.Transport
	// TLSConfig is the client's TLS configuration for starting QUIC connections.
	TLSConfig *tls.Config
	// QUICConfig is the client's QUIC configuration.
	QUICConfig *quic.Config
}

ConnDialer dials a net.Conn over a QUIC stream.

func (ConnDialer) Dial

func (d ConnDialer) Dial(ctx context.Context, dst net.Addr) (net.Conn, error)

Dial dials a QUIC stream and returns it as a net.Conn.

Note: This method dials with exponential backoff in case the dialing attempt fails due to a SERVER_BUSY error. Timers, number of attempts are EXPERIMENTAL and subject to change.

type ConnListener

type ConnListener struct {
	*quic.Listener
	// contains filtered or unexported fields
}

ConnListener wraps a quic.Listener as a net.Listener.

func NewConnListener

func NewConnListener(l *quic.Listener) *ConnListener

NewConnListener constructs a new listener with the appropriate buffers set.

func (*ConnListener) Accept

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

Accept accepts the first stream on a session and wraps it as a net.Conn.

func (*ConnListener) AcceptCtx

func (l *ConnListener) AcceptCtx(ctx context.Context) (net.Conn, error)

AcceptCtx accepts the first stream on a session and wraps it as a net.Conn. Accepts a context in case the caller doesn't want this to block indefinitely.

func (*ConnListener) Close

func (l *ConnListener) Close() error

Close closes the listener.

Jump to

Keyboard shortcuts

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