mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
21 lines
515 B
Go
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)
|
|
}
|