k3s/vendor/github.com/canonical/go-dqlite/internal/protocol/dial.go
2019-11-10 04:05:59 +00:00

21 lines
515 B
Go

package protocol
import (
"context"
"net"
)
// TCPDial is a dial function using plain TCP to establish the network
// connection.
func TCPDial(ctx context.Context, address string) (net.Conn, error) {
dialer := net.Dialer{}
return dialer.DialContext(ctx, "tcp", address)
}
// UnixDial is a dial function using Unix sockets to establish the network
// connection.
func UnixDial(ctx context.Context, address string) (net.Conn, error) {
dialer := net.Dialer{}
return dialer.DialContext(ctx, "unix", address)
}