connector

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 9 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBindUnsupported = errors.New("bind unsupported")
)

Functions

This section is empty.

Types

type BindOption

type BindOption func(opts *BindOptions)

func BacklogBindOption

func BacklogBindOption(backlog int) BindOption

func MuxBindOption

func MuxBindOption(mux bool) BindOption

func UDPConnTTLBindOption

func UDPConnTTLBindOption(ttl time.Duration) BindOption

func UDPDataBufferSizeBindOption

func UDPDataBufferSizeBindOption(size int) BindOption

func UDPDataQueueSizeBindOption

func UDPDataQueueSizeBindOption(size int) BindOption

type BindOptions

type BindOptions struct {
	Mux               bool
	Backlog           int
	UDPDataQueueSize  int
	UDPDataBufferSize int
	UDPConnTTL        time.Duration
}

type Binder

type Binder interface {
	Bind(ctx context.Context, conn net.Conn, network, address string, opts ...BindOption) (net.Listener, error)
}

type ConnectOption

type ConnectOption func(opts *ConnectOptions)

func NetDialerConnectOption

func NetDialerConnectOption(netd *dialer.NetDialer) ConnectOption

type ConnectOptions

type ConnectOptions struct {
	NetDialer *dialer.NetDialer
}

type Connector

type Connector interface {
	Init(metadata.Metadata) error
	Connect(ctx context.Context, conn net.Conn, network, address string, opts ...ConnectOption) (net.Conn, error)
}

Connector is responsible for connecting to the destination address.

type Handshaker

type Handshaker interface {
	Handshake(ctx context.Context, conn net.Conn) (net.Conn, error)
}

type Option

type Option func(opts *Options)

func AuthOption

func AuthOption(auth *url.Userinfo) Option

func LoggerOption

func LoggerOption(logger logger.Logger) Option

func TLSConfigOption

func TLSConfigOption(tlsConfig *tls.Config) Option

type Options

type Options struct {
	Auth      *url.Userinfo
	TLSConfig *tls.Config
	Logger    logger.Logger
}

Jump to

Keyboard shortcuts

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