quicreuse

package
v0.36.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 23 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromQuicMultiaddr

func FromQuicMultiaddr(addr ma.Multiaddr) (*net.UDPAddr, quic.VersionNumber, error)

func ToQuicMultiaddr

func ToQuicMultiaddr(na net.Addr, version quic.VersionNumber) (ma.Multiaddr, error)

func WithAssociation added in v0.36.3

func WithAssociation(ctx context.Context, association any) context.Context

WithAssociation returns a new context with the given association. Used in DialQUIC to prefer a transport that has the given association.

Types

type ConnManager

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

func NewConnManager

func NewConnManager(statelessResetKey quic.StatelessResetKey, tokenKey quic.TokenGeneratorKey, opts ...Option) (*ConnManager, error)

func (*ConnManager) ClientConfig added in v0.33.1

func (c *ConnManager) ClientConfig() *quic.Config

func (*ConnManager) Close

func (c *ConnManager) Close() error

func (*ConnManager) DialQUIC

func (c *ConnManager) DialQUIC(ctx context.Context, raddr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool) (quic.Connection, error)

func (*ConnManager) ListenQUIC

func (c *ConnManager) ListenQUIC(addr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool) (Listener, error)

func (*ConnManager) ListenQUICAndAssociate added in v0.36.3

func (c *ConnManager) ListenQUICAndAssociate(association any, addr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool) (Listener, error)

ListenQUICAndAssociate returns a QUIC listener and associates the underlying transport with the given association.

func (*ConnManager) Protocols

func (c *ConnManager) Protocols() []int

func (*ConnManager) SharedNonQUICPacketConn added in v0.36.0

func (c *ConnManager) SharedNonQUICPacketConn(network string, laddr *net.UDPAddr) (net.PacketConn, error)

func (*ConnManager) TransportForDial added in v0.29.0

func (c *ConnManager) TransportForDial(network string, raddr *net.UDPAddr) (refCountedQuicTransport, error)

func (*ConnManager) TransportWithAssociationForDial added in v0.36.3

func (c *ConnManager) TransportWithAssociationForDial(association any, network string, raddr *net.UDPAddr) (refCountedQuicTransport, error)

TransportWithAssociationForDial returns a QUIC transport for dialing, preferring a transport with the given association.

type Listener

type Listener interface {
	Accept(context.Context) (quic.Connection, error)
	Addr() net.Addr
	Multiaddrs() []ma.Multiaddr
	io.Closer
}

type Option

type Option func(*ConnManager) error

func DisableReuseport

func DisableReuseport() Option

func EnableMetrics

func EnableMetrics(reg prometheus.Registerer) Option

EnableMetrics enables Prometheus metrics collection. If reg is nil, prometheus.DefaultRegisterer will be used as the registerer.

Jump to

Keyboard shortcuts

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