pub struct Config {
Show 24 fields pub server: Vec<ServerConfig>, pub local: Vec<LocalConfig>, pub dns: DnsConfig, pub ipv6_first: bool, pub ipv6_only: bool, pub no_delay: bool, pub fast_open: bool, pub keep_alive: Option<Duration>, pub nofile: Option<u64>, pub outbound_fwmark: Option<u32>, pub outbound_bind_interface: Option<String>, pub outbound_bind_addr: Option<IpAddr>, pub inbound_send_buffer_size: Option<u32>, pub inbound_recv_buffer_size: Option<u32>, pub outbound_send_buffer_size: Option<u32>, pub outbound_recv_buffer_size: Option<u32>, pub manager: Option<ManagerConfig>, pub config_type: ConfigType, pub udp_timeout: Option<Duration>, pub udp_max_associations: Option<usize>, pub acl: Option<AccessControl>, pub security: SecurityConfig, pub balancer: BalancerConfig, pub config_path: Option<PathBuf>,
}
Expand description

Configuration

Fields

server: Vec<ServerConfig>

Remote ShadowSocks server configurations

local: Vec<LocalConfig>

Local server configuration

dns: DnsConfig

DNS configuration, uses system-wide DNS configuration by default

Value could be a IpAddr, uses UDP DNS protocol with port 53. For example: 8.8.8.8

Also Value could be some pre-defined DNS server names:

  • google
  • cloudflare, cloudflare_tls, cloudflare_https
  • quad9, quad9_tls
ipv6_first: bool

Uses IPv6 addresses first

Set to true if you want to query IPv6 addresses before IPv4

ipv6_only: bool

Set IPV6_V6ONLY for listener sockets

no_delay: bool

Set TCP_NODELAY socket option

fast_open: bool

Set TCP_FASTOPEN socket option

keep_alive: Option<Duration>

Set TCP Keep-Alive duration, will set both TCP_KEEPIDLE and TCP_KEEPINTVL

https://github.com/shadowsocks/shadowsocks-rust/issues/546

If this is not set, sockets will be set with a default timeout

nofile: Option<u64>

RLIMIT_NOFILE option for *nix systems

outbound_fwmark: Option<u32>

Set SO_MARK socket option for outbound sockets

outbound_bind_interface: Option<String>

Set SO_BINDTODEVICE (Linux), IP_BOUND_IF (BSD), IP_UNICAST_IF (Windows) socket option for outbound sockets

outbound_bind_addr: Option<IpAddr>

Outbound sockets will bind to this address

inbound_send_buffer_size: Option<u32>

Set SO_SNDBUF for inbound sockets

inbound_recv_buffer_size: Option<u32>

Set SO_RCVBUF for inbound sockets

outbound_send_buffer_size: Option<u32>

Set SO_SNDBUF for outbound sockets

outbound_recv_buffer_size: Option<u32>

Set SO_RCVBUF for outbound sockets

manager: Option<ManagerConfig>

Manager’s configuration

config_type: ConfigType

Config is for Client or Server

udp_timeout: Option<Duration>

Timeout for UDP Associations, default is 5 minutes

udp_max_associations: Option<usize>

Maximum number of UDP Associations, default is unconfigured

acl: Option<AccessControl>

ACL configuration

security: SecurityConfig

Replay attack policy

balancer: BalancerConfig

Balancer config of local server

config_path: Option<PathBuf>

Configuration file path, the actual path of the configuration. This is normally for auto-reloading if implementation supports.

Implementations

Creates an empty configuration

Set DNS configuration in string format

  1. [(unix|tcp|udp)://]host[:port][,host[:port]]...
  2. Pre-defined. Like google, cloudflare

Load Config from a str

Load Config from a File

Check if there are any plugin are enabled with servers

Check if all required fields are already set

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more