vpnconfig

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package vpnconfig contains the VPN configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address net.IP
	Netmask net.IPMask
}

Address is a IPv4/IPv6 address configuration in Config.

func (*Address) Copy

func (a *Address) Copy() Address

Copy returns a copy of address.

type Config

type Config struct {
	Gateway net.IP
	PID     int
	Timeout int
	Device  Device
	IPv4    Address
	IPv6    Address
	DNS     DNS
	Split   Split
	Flags   Flags
}

Config is a VPN configuration.

func New

func New() *Config

New returns a new Config.

func NewFromJSON

func NewFromJSON(b []byte) (*Config, error)

NewFromJSON returns a new config parsed from the json in b.

func (*Config) Copy

func (c *Config) Copy() *Config

Copy returns a new copy of config.

func (*Config) Empty

func (c *Config) Empty() bool

Empty returns whether the config is empty.

func (*Config) Equal

func (c *Config) Equal(other *Config) bool

Equal returns whether the config and other are equal.

func (*Config) JSON

func (c *Config) JSON() ([]byte, error)

JSON returns the configuration as JSON.

func (*Config) Valid

func (c *Config) Valid() bool

Valid returns whether the config is valid.

type DNS

type DNS struct {
	DefaultDomain string
	ServersIPv4   []net.IP
	ServersIPv6   []net.IP
}

DNS is a DNS configuration in Config.

func (*DNS) Copy

func (d *DNS) Copy() DNS

Copy returns a copy of DNS.

func (*DNS) Remotes

func (d *DNS) Remotes() map[string][]string

Remotes returns a map of DNS remotes from the DNS configuration that maps domain "." to the IPv4 and IPv6 DNS servers in the configuration including port number 53.

type Device

type Device struct {
	Name string
	MTU  int
}

Device is a VPN device configuration in Config.

func (*Device) Copy

func (d *Device) Copy() Device

Copy returns a copy of device.

type Flags

type Flags struct {
	DisableAlwaysOnVPN bool
}

Flags are other configuration settings in Config.

func (*Flags) Copy

func (f *Flags) Copy() Flags

Copy returns a copy of flags.

type Split

type Split struct {
	ExcludeIPv4 []*net.IPNet
	ExcludeIPv6 []*net.IPNet
	ExcludeDNS  []string

	ExcludeVirtualSubnetsOnlyIPv4 bool
}

Split is a split routing configuration in Config.

func (*Split) Copy

func (s *Split) Copy() Split

Copy returns a copy of split.

func (*Split) DNSExcludes

func (s *Split) DNSExcludes() []string

DNSExcludes returns a list of DNS-based split excludes from the split routing configuration. The list contains domain names including the trailing ".".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL