[][src]Struct shadowsocks::config::Config

pub struct Config {
    pub server: Vec<ServerConfig>,
    pub local: Option<ClientConfig>,
    pub forward: Option<Address>,
    pub forbidden_ip: HashSet<IpAddr>,
    pub dns: Option<String>,
    pub mode: Mode,
    pub no_delay: bool,
    pub manager_address: Option<ServerAddr>,
    pub config_type: ConfigType,
    pub udp_timeout: Option<Duration>,
    pub nofile: Option<u64>,
}

Configuration

Fields

server: Vec<ServerConfig>

Remote ShadowSocks server configurations

local: Option<ClientConfig>

Local server's bind address, or ShadowSocks server's outbound address

forward: Option<Address>

Destination address for tunnel

forbidden_ip: HashSet<IpAddr>

Ignored IPs

Suggested list: ["127.0.0.1", "::1"]

dns: Option<String>

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
mode: Mode

Server mode, tcp_only, tcp_and_udp, and udp_only

no_delay: bool

Set TCP_NODELAY socket option

manager_address: Option<ServerAddr>

Address of ss-manager. Send servers' statistic data to the manager server

config_type: ConfigType

Config is for Client or Server

udp_timeout: Option<Duration>

Timeout for UDP Associations, default is 5 minutes

nofile: Option<u64>

RLIMIT_NOFILE option for *nix systems

Methods

impl Config[src]

pub fn new(config_type: ConfigType) -> Config[src]

Creates an empty configuration

pub fn load_from_str(s: &str, config_type: ConfigType) -> Result<Config, Error>[src]

Load Config from a str

pub fn load_from_file(
    filename: &str,
    config_type: ConfigType
) -> Result<Config, Error>
[src]

Load Config from a File

pub fn has_server_plugins(&self) -> bool[src]

Check if there are any plugin are enabled with servers

pub fn check_forbidden_ip(&self, ip: &IpAddr) -> bool[src]

Check if IP is forbidden

Trait Implementations

impl Clone for Config[src]

impl Debug for Config[src]

impl Display for Config[src]

Auto Trait Implementations

impl RefUnwindSafe for Config

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,