mirror of https://github.com/dswd/vpncloud.git
Adapt example config to version 2
This commit is contained in:
parent
7bbf3ccdc4
commit
800e284408
|
@ -7,46 +7,64 @@
|
||||||
# `service vpncloud@NAME start/stop` on systemd systems.
|
# `service vpncloud@NAME start/stop` on systemd systems.
|
||||||
|
|
||||||
|
|
||||||
# The port number on which to listen for data.
|
# The port number or ip:port on which to listen for data.
|
||||||
# Note: Every VPN needs a different port number.
|
# Note: Every VPN needs a different port number.
|
||||||
#port: 3210
|
listen: 3210
|
||||||
|
|
||||||
# Address of a peer to connect to. The address should be in the form
|
# Address of a peer to connect to. The address should be in the form
|
||||||
# `addr:port`. If the node is not started, the connection will be retried
|
# `addr:port`. If the node is not started, the connection will be retried
|
||||||
# periodically. This parameter can be repeated to connect to multiple peers.
|
# periodically. This parameter can be repeated to connect to multiple peers.
|
||||||
# Note: Several entries can be separated by spaces.
|
# Note: Several entries can be separated by spaces.
|
||||||
#peers:
|
peers:
|
||||||
# - node2.example.com:3210
|
# - node2.example.com:3210
|
||||||
# - node3.example.com:3210
|
# - node3.example.com:3210
|
||||||
|
|
||||||
# Peer timeout in seconds. The peers will exchange information periodically
|
# Peer timeout in seconds. The peers will exchange information periodically
|
||||||
# and drop peers that are silent for this period of time.
|
# and drop peers that are silent for this period of time.
|
||||||
#peer_timeout: 600
|
peer-timeout: 300
|
||||||
|
|
||||||
# Switch table entry timeout in seconds. This parameter is only used in switch
|
# Switch table entry timeout in seconds. This parameter is only used in switch
|
||||||
# mode. Addresses that have not been seen for the given period of time will
|
# mode. Addresses that have not been seen for the given period of time will
|
||||||
# be forgot.
|
# be forgot.
|
||||||
#switch_timeout: 300
|
switch-timeout: 300
|
||||||
|
|
||||||
# An optional token that identifies the network and helps to distinguish it
|
|
||||||
# from other networks.
|
|
||||||
#magic: "76706e01"
|
|
||||||
|
|
||||||
# An optional shared key to encrypt the VPN data. If this option is not set,
|
# Crypto settings
|
||||||
# the traffic will be sent unencrypted.
|
#crypto:
|
||||||
#shared_key: ""
|
|
||||||
|
|
||||||
# The encryption method to use ("aes256", or "chacha20"). Most current CPUs
|
# An optional password to encrypt the VPN data.
|
||||||
# have special support for AES256 so this should be faster. For older
|
#password: ""
|
||||||
# computers lacking this support, only CHACHA20 is supported.
|
|
||||||
#crypto: chacha20
|
# Private key
|
||||||
|
#private-key: ""
|
||||||
|
|
||||||
|
# Public key
|
||||||
|
#public-key: ""
|
||||||
|
|
||||||
|
# Trusted keys
|
||||||
|
#trusted-keys:
|
||||||
|
|
||||||
|
# Supported algorithms. Subset of "aes128", "aes256", "chacha20", and
|
||||||
|
# "plain" where "plain" means unencrypted.
|
||||||
|
#algorithms:
|
||||||
|
|
||||||
|
|
||||||
|
# Device settings
|
||||||
|
device:
|
||||||
|
|
||||||
# Name of the virtual device. Any `%d` will be filled with a free number.
|
# Name of the virtual device. Any `%d` will be filled with a free number.
|
||||||
#device_name: "vpncloud%d"
|
name: "vpncloud%d"
|
||||||
|
|
||||||
# Set the type of network. There are two options: **tap** devices process
|
# Set the type of network. There are two options: **tap** devices process
|
||||||
# Ethernet frames **tun** devices process IP packets. [default: `tap`]
|
# Ethernet frames **tun** devices process IP packets. [default: `tun`]
|
||||||
#device_type: tap
|
type: tun
|
||||||
|
|
||||||
|
# The path of the /dev/net/tun device. Only change if you need to.
|
||||||
|
#path: /dev/net/tun
|
||||||
|
|
||||||
|
# Whether to fix detected rp-filter problems
|
||||||
|
fix-rp-filter: false
|
||||||
|
|
||||||
|
|
||||||
# The mode of the VPN. The VPN can like a router, a switch or a hub. A **hub**
|
# The mode of the VPN. The VPN can like a router, a switch or a hub. A **hub**
|
||||||
# will send all data always to all peers. A **switch** will learn addresses
|
# will send all data always to all peers. A **switch** will learn addresses
|
||||||
|
@ -54,16 +72,24 @@
|
||||||
# unknown. A **router** will send data according to known subnets of the
|
# unknown. A **router** will send data according to known subnets of the
|
||||||
# peers and ignore them otherwise. The **normal** mode is switch for tap
|
# peers and ignore them otherwise. The **normal** mode is switch for tap
|
||||||
# devices and router for tun devices. [default: `normal`]
|
# devices and router for tun devices. [default: `normal`]
|
||||||
#mode: normal
|
mode: normal
|
||||||
|
|
||||||
|
|
||||||
# The local subnets to use. This parameter should be in the form
|
# The local subnets to use. This parameter should be in the form
|
||||||
# `address/prefixlen` where address is an IPv4 address, an IPv6 address, or a
|
# `address/prefixlen` where address is an IPv4 address, an IPv6 address, or a
|
||||||
# MAC address. The prefix length is the number of significant front bits that
|
# MAC address. The prefix length is the number of significant front bits that
|
||||||
# distinguish the subnet from other subnets. Example: `10.1.1.0/24`.
|
# distinguish the subnet from other subnets. Example: `10.1.1.0/24`.
|
||||||
# Note: Several entries can be separated by spaces.
|
# Note: Several entries can be separated by spaces.
|
||||||
#subnets:
|
#claims
|
||||||
# - 10.1.1.0/24
|
# - 10.1.1.0/24
|
||||||
|
|
||||||
|
# Whether to automatically claim the configured IP on tun devices
|
||||||
|
auto-claim: true
|
||||||
|
|
||||||
|
|
||||||
|
# An IP address to set on the device
|
||||||
|
#ip: ""
|
||||||
|
|
||||||
# A command to setup the network interface. The command will be run (as
|
# A command to setup the network interface. The command will be run (as
|
||||||
# parameter to `sh -c`) when the device has been created to configure it.
|
# parameter to `sh -c`) when the device has been created to configure it.
|
||||||
# The name of the allocated device will be available via the environment
|
# The name of the allocated device will be available via the environment
|
||||||
|
@ -86,3 +112,29 @@
|
||||||
# when running in background.
|
# when running in background.
|
||||||
#user: ""
|
#user: ""
|
||||||
#group: ""
|
#group: ""
|
||||||
|
|
||||||
|
|
||||||
|
# Beacon settings
|
||||||
|
beacon:
|
||||||
|
|
||||||
|
# File or command (prefix: "|") to use for storing beacons
|
||||||
|
#store: ""
|
||||||
|
|
||||||
|
# File or command (prefix: "|") to use for loading beacons
|
||||||
|
#load: ""
|
||||||
|
|
||||||
|
# How often to load and store beacons (in seconds)
|
||||||
|
interval: 3600
|
||||||
|
|
||||||
|
# Password to encrypt beacon data with
|
||||||
|
#password: ""
|
||||||
|
|
||||||
|
|
||||||
|
# Statsd settings
|
||||||
|
#statsd:
|
||||||
|
|
||||||
|
# Statsd server name:port
|
||||||
|
#server: ""
|
||||||
|
|
||||||
|
# Prefix to use for stats keys
|
||||||
|
#prefix: ""
|
|
@ -582,6 +582,43 @@ statsd:
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn default_config_as_default() {
|
||||||
|
let mut default_config = Config {
|
||||||
|
device_type: Type::Dummy,
|
||||||
|
device_name: "".to_string(),
|
||||||
|
device_path: None,
|
||||||
|
fix_rp_filter: false,
|
||||||
|
ip: None,
|
||||||
|
ifup: None,
|
||||||
|
ifdown: None,
|
||||||
|
crypto: CryptoConfig::default(),
|
||||||
|
listen: "[::]:3210".parse::<SocketAddr>().unwrap(),
|
||||||
|
peers: vec![],
|
||||||
|
peer_timeout: 0,
|
||||||
|
keepalive: None,
|
||||||
|
beacon_store: None,
|
||||||
|
beacon_load: None,
|
||||||
|
beacon_interval: 0,
|
||||||
|
beacon_password: None,
|
||||||
|
mode: Mode::Hub,
|
||||||
|
switch_timeout: 0,
|
||||||
|
claims: vec![],
|
||||||
|
auto_claim: true,
|
||||||
|
port_forwarding: true,
|
||||||
|
daemonize: false,
|
||||||
|
pid_file: None,
|
||||||
|
stats_file: None,
|
||||||
|
statsd_server: None,
|
||||||
|
statsd_prefix: None,
|
||||||
|
user: None,
|
||||||
|
group: None
|
||||||
|
};
|
||||||
|
let default_config_file = serde_yaml::from_str::<ConfigFile>(include_str!("../assets/example.net.disabled")).unwrap();
|
||||||
|
default_config.merge_file(default_config_file);
|
||||||
|
assert_eq!(default_config, Config::default());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn config_merge() {
|
fn config_merge() {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
|
|
Loading…
Reference in New Issue