Documentation ¶
Index ¶
Constants ¶
const ( // CompressionStub adds the (empty) compression stub to the packets. CompressionStub = Compression("stub") // CompressionEmpty is the empty compression. CompressionEmpty = Compression("empty") // CompressionLZONo is lzo-no (another type of no-compression, older). CompressionLZONo = Compression("lzo-no") )
const ProtoTCP = Proto("tcp")
ProtoTCP is used for vpn in TCP mode.
const ProtoUDP = Proto("udp")
ProtoUDP is used for vpn in UDP mode.
Variables ¶
var ErrBadConfig = errors.New("openvpn: bad config")
ErrBadConfig is the generic error returned for invalid config files
var SupportedAuth = []string{
"SHA1",
"SHA256",
"SHA512",
}
SupportedAuth defines the supported authentication methods.
var SupportedCiphers = []string{
"AES-128-CBC",
"AES-192-CBC",
"AES-256-CBC",
"AES-128-GCM",
"AES-192-GCM",
"AES-256-GCM",
}
SupportedCiphers defines the supported ciphers.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains options to initialize the OpenVPN tunnel.
func (*Config) OpenVPNOptions ¶
func (c *Config) OpenVPNOptions() *OpenVPNOptions
OpenVPNOptions returns the configured openvpn options.
func (*Config) Tracer ¶
func (c *Config) Tracer() model.HandshakeTracer
Tracer returns the handshake tracer.
type OpenVPNOptions ¶
type OpenVPNOptions struct { // These options have the same name of OpenVPN options referenced in the official documentation: Remote string Port string Proto Proto Username string Password string CAPath string CertPath string KeyPath string CA []byte Cert []byte Key []byte Cipher string Auth string TLSMaxVer string Compress Compression ProxyOBFS4 string }
OpenVPNOptions make all the relevant openvpn configuration options accessible to the different modules that need it.
func ReadConfigFile ¶
func ReadConfigFile(filePath string) (*OpenVPNOptions, error)
ReadConfigFile expects a string with a path to a valid config file, and returns a pointer to a Options struct after parsing the file, and an error if the operation could not be completed.
func (*OpenVPNOptions) HasAuthInfo ¶
func (o *OpenVPNOptions) HasAuthInfo() bool
HasAuthInfo returns true if: - we have paths for cert, key and ca; or - we have inline byte arrays for cert, key and ca; or - we have username + password info. TODO(ainghazal): add sanity checks for valid/existing credentials.
func (*OpenVPNOptions) ServerOptionsString ¶
func (o *OpenVPNOptions) ServerOptionsString() string
ServerOptionsString produces a comma-separated representation of the options, in the same order and format that the OpenVPN server expects from us.
func (*OpenVPNOptions) ShouldLoadCertsFromPath ¶
func (o *OpenVPNOptions) ShouldLoadCertsFromPath() bool
ShouldLoadCertsFromPath returns true when the options object is configured to load certificates from paths; false when we have inline certificates.
type Option ¶
type Option func(config *Config)
Option is an option you can pass to initialize minivpn.
func WithConfigFile ¶
WithConfigFile configures OpenVPNOptions parsed from the given file.
func WithHandshakeTracer ¶
func WithHandshakeTracer(tracer model.HandshakeTracer) Option
WithHandshakeTracer configures the passed [HandshakeTracer].
func WithLogger ¶
WithLogger configures the passed [Logger].
func WithOpenVPNOptions ¶
func WithOpenVPNOptions(openvpnOptions *OpenVPNOptions) Option
WithOpenVPNOptions configures the passed OpenVPN options.