dialer

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: BSD-3-Clause Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ThrottleRps       uint32        `json:"throttleRps"`
	ConnectionTimeout time.Duration `json:"connectionTimeout"`
}

type Dialer

type Dialer interface {
	// If [ctx] is canceled, gives up trying to connect to [ip]
	// and returns an error.
	Dial(ctx context.Context, ip ips.IPPort) (net.Conn, error)
}

Dialer attempts to create a connection with the provided IP/port pair

func NewDialer

func NewDialer(network string, dialerConfig Config, log logging.Logger) Dialer

NewDialer returns a new Dialer that calls net.Dial with the provided network. [network] is the network passed into Dial. Should probably be "TCP". [dialerConfig.connectionTimeout] gives the timeout when dialing an IP. [dialerConfig.throttleRps] gives the max number of outgoing connection attempts/second. If [dialerConfig.throttleRps] == 0, outgoing connections aren't rate-limited.

Jump to

Keyboard shortcuts

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