go-netutil: github.com/ReSTARTR/go-netutil Index | Files | Directories

package netutil

import "github.com/ReSTARTR/go-netutil"

Index

Package Files

rrdialer.go sort.go

Variables

var DefaultRRDialer = &RRDialer{
    dialer: &net.Dialer{
        Timeout:   30 * time.Second,
        KeepAlive: 30 * time.Second,
    },
}

DefaultRRDialer has a dialer that includes the same as DefaultTransport use

func RandomSort Uses

func RandomSort(ips []net.IP)

RandomSort sorts ips at random.

type RRDialer Uses

type RRDialer struct {
    Sort func([]net.IP)
    // contains filtered or unexported fields
}

RRDialer contains options for connection to an address with a specific IP.

TODO: connection pool

func (*RRDialer) Dial Uses

func (d *RRDialer) Dial(network, address string) (net.Conn, error)

Dial connects to the address with an specific IP on the named network.

func (*RRDialer) DialContext Uses

func (d *RRDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

DialContext connects to the address with an specific IP on the named network using the provided context.

Directories

PathSynopsis
_example

Package netutil imports 7 packages (graph) and is imported by 1 packages. Updated 2016-10-24. Refresh now. Tools for package owners.