dialer

package
v0.0.0-...-45a9176 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DisableIPv6                = false
	ErrorInvalidedNetworkStack = errors.New("invalided network stack")
	ErrorDisableIPv6           = errors.New("IPv6 is disabled, dialer cancel")
)
View Source
var (
	DefaultOptions     []Option
	DefaultInterface   = atomic.NewString("")
	DefaultRoutingMark = atomic.NewInt32(0)
)

Functions

func DialContext

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

func GetDial

func GetDial() bool

func ListenPacket

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

func ParseNetwork

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

func SetDial

func SetDial(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 Option

type Option func(opt *option)

func WithAddrReuse

func WithAddrReuse(reuse bool) Option

func WithInterface

func WithInterface(name string) 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

Jump to

Keyboard shortcuts

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