dialer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoIpAddress           = errors.New("no ip address")
	ErrorInvalidedNetworkStack = errors.New("invalided network stack")
)
View Source
var (
	DefaultOptions     []Option
	DefaultInterface   = atomic.NewTypedValue[string]("")
	DefaultRoutingMark = atomic.NewInt32(0)
)

Functions

func DialContext

func DialContext(ctx context.Context, network, address string, options ...Option) (net.Conn, error)

func GetTcpConcurrent

func GetTcpConcurrent() bool

func ListenPacket

func ListenPacket(ctx context.Context, network, address string, options ...Option) (net.PacketConn, error)

func LookupLocalAddrFromIfaceName

func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination netip.Addr, port int) (net.Addr, error)

func ParseNetwork

func ParseNetwork(network string, addr netip.Addr) string

func SetTcpConcurrent

func SetTcpConcurrent(concurrent bool)

Types

type Dialer

type Dialer struct {
	Opt option
}

func NewDialer

func NewDialer(options ...Option) Dialer

func (Dialer) DialContext

func (d Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

func (Dialer) ListenPacket

func (d Dialer) ListenPacket(ctx context.Context, network, address string, rAddrPort netip.AddrPort) (net.PacketConn, error)

type NetDialer

type NetDialer interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

type Option

type Option func(opt *option)

func WithAddrReuse

func WithAddrReuse(reuse bool) Option

func WithFallbackBind

func WithFallbackBind(fallback bool) Option

func WithInterface

func WithInterface(name string) Option

func WithMPTCP

func WithMPTCP(mpTcp bool) Option

func WithNetDialer

func WithNetDialer(netDialer NetDialer) Option

func WithOnlySingleStack

func WithOnlySingleStack(isIPv4 bool) Option

func WithOption

func WithOption(o option) Option

func WithPreferIPv4

func WithPreferIPv4() Option

func WithPreferIPv6

func WithPreferIPv6() Option

func WithResolver

func WithResolver(r resolver.Resolver) Option

func WithRoutingMark

func WithRoutingMark(mark int) Option

func WithTFO

func WithTFO(tfo bool) Option

Jump to

Keyboard shortcuts

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