2019-11-08 21:45:10 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-04-23 20:34:44 +00:00
|
|
|
"crypto/tls"
|
2019-11-08 21:45:10 +00:00
|
|
|
"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)
|
|
|
|
}
|
2020-04-23 20:34:44 +00:00
|
|
|
|
|
|
|
// TLSCipherSuites are the cipher suites by the go-dqlite TLS helpers.
|
|
|
|
var TLSCipherSuites = []uint16{
|
|
|
|
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
|
|
|
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
|
|
|
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
|
|
|
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
|
|
|
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
|
|
|
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
|
|
|
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
|
|
|
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
|
|
|
}
|