Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalancerType ¶
type BalancerType string
BalancerType reperents the algorithm which is used to pick source address.
const ( // BalancerTypeNoop picks first address for which link is up. BalancerTypeNoop BalancerType = "" // BalancerTypeNoop implements simple round-robin between up links. // It is not fair in case some links are down. BalancerTypeRoundRobin BalancerType = "roundrobin" )
type Config ¶
type Config struct {
// Routable subnets.
Subnets []Subnet
// If true, the only configurd subnets available through this dialer.
// Otherwise, a failback to the net.DefaultDialer.
Restrict bool
// Dialer contains default options for the net.Dialer to use.
// LocalAddr is overridden.
Dialer net.Dialer
// Balancer specifies algorithm used to pick source address.
Balancer BalancerType
// FallbackDelay specifies the length of time to wait before
// spawning a RFC 6555 Fast Fallback connection. That is, this
// is the amount of time to wait for IPv6 to succeed before
// assuming that IPv6 is misconfigured and falling back to
// IPv4.
//
// If zero, a default delay of 300ms is used.
// A negative value disables Fast Fallback support.
FallbackDelay time.Duration
// DialContext is custom DialContext function.
// If not specified, default implemenattion is used (`d.DialContext(ctx, network, address)`).
DialContext func(d *net.Dialer, ctx context.Context, network, address string) (net.Conn, error)
// EventHandler defines event handler.
EventHandler EventHandler
}
Config contains Multidialer configuration.
type Dialer ¶
type Dialer interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
Dialer contains the single most important method from the net.Dialer.
type EventHandler ¶
Click to show internal directories.
Click to hide internal directories.