dialer

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout is the default dial timeout.
	DefaultTimeout = 10 * time.Second
)

Variables

View Source
var (
	DefaultNetDialer = &Dialer{}
)

DefaultNetDialer is the default Dialer used when a nil Dialer is provided.

Functions

This section is empty.

Types

type Dialer

type Dialer struct {
	Interface string
	Netns     string
	Mark      int
	DialFunc  func(ctx context.Context, network, addr string) (net.Conn, error)
	Log       logger.Logger
}

Dialer is a network dialer with support for interface binding, network namespace switching, and socket marking. The zero value is ready to use via DefaultNetDialer.

func (*Dialer) Dial

func (d *Dialer) Dial(ctx context.Context, network, addr string) (conn net.Conn, err error)

Dial connects to addr on the named network. If d is nil, DefaultNetDialer is used. When Netns is set, the dial switches into that network namespace before creating the connection. When Interface is set, it iterates the specified interfaces, trying each address in turn.

Jump to

Keyboard shortcuts

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