connector

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 9 Imported by: 20

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 ConnectOption

type ConnectOption func(opts *ConnectOptions)

func NetDialerConnectOption

func NetDialerConnectOption(netd *dialer.NetDialer) ConnectOption

type ConnectOptions

type ConnectOptions struct {
	NetDialer *dialer.NetDialer
}

type IBinder

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

type IConnector

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

IConnector is responsible for connecting to the destination address.

type IHandshaker

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

type NewConnector

type NewConnector func(opts ...Option) IConnector

type Option

type Option func(opts *Options)

func AuthOption

func AuthOption(auth *url.Userinfo) Option

func LoggerOption

func LoggerOption(logger logger.ILogger) Option

func TLSConfigOption

func TLSConfigOption(tlsConfig *tls.Config) Option

type Options

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

Jump to

Keyboard shortcuts

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