Documentation
¶
Overview ¶
Package openvpn is komando's own OpenVPN client: the control channel (TLS over OpenVPN's reliable transport, with tls-auth or tls-crypt), the key exchange (key-method 2, TLS-EKM or the OpenVPN PRF), the data channel (AES-GCM, ChaCha20-Poly1305, or AES-CBC with HMAC) and the pushed options. It hands IP packets to a userspace network stack, so the computer's own network is never changed and no admin rights are needed.
It is written from the OpenVPN protocol documentation; no OpenVPN code is used. Options it does not implement are refused by name at Parse, so a profile never half works.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Packets is where decrypted IP packets arrive.
Packets chan []byte
// contains filtered or unexported fields
}
Client is one connected OpenVPN session.
func Connect ¶
func Connect(ctx context.Context, cfg *Config, login Login, dial func(ctx context.Context, network, addr string) (net.Conn, error)) (*Client, error)
Connect dials the first remote that answers and completes the handshake.
func (*Client) WritePacket ¶
WritePacket encrypts and sends one IP packet.
type Config ¶
type Config struct {
Remotes []Remote
CA, Cert, Key []byte // PEM
TLSAuth []byte // the 256-byte static key
KeyDirection int // -1 none, 0 or 1 (tls-auth)
TLSCrypt []byte // the 256-byte static key
Ciphers []string
Auth string // digest for tls-auth and CBC: SHA1, SHA256, SHA512
AuthUserPass bool
RemoteCertTLS bool // the server's certificate must be for a TLS server
NSCertServer bool // ns-cert-type server: the Netscape cert type must say SSL server
RemoteCertEKU string
RemoteCertKU []uint16 // OpenSSL bit order; not nil: the key usage must hold all bits of one (none listed: any)
VerifyName string
VerifyNameType string // subject (full DN), name (CN), name-prefix
TLSMin string
Compress string // "", "lzo-no" (comp-lzo no), "stub-v2" (compress stub-v2)
Setenv map[string]string
TunMTU int
// Warnings are things in the profile a person should know about (no
// secrets); the caller shows them.
Warnings []string
}
Config is what komando uses from a .ovpn profile.
type Login ¶
type Login struct{ User, Password string }
Login is the user name and password for auth-user-pass (Pritunl puts a PIN or one-time code into the password the way its client does).