singledialer.go 380 Bytes
Newer Older
Steven Allen's avatar
Steven Allen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package tcpreuse

import (
	"context"
	"net"
)

type singleDialer net.TCPAddr

func (d *singleDialer) Dial(network, address string) (net.Conn, error) {
	return d.DialContext(context.Background(), network, address)
}

func (d *singleDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
	return reuseDial(ctx, (*net.TCPAddr)(d), network, address)
}