Struct shadowsocks_service::config::Config
source · [−]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
sourceimpl Config
impl Config
sourcepub fn new(config_type: ConfigType) -> Config
pub fn new(config_type: ConfigType) -> Config
Creates an empty configuration
sourcepub fn set_dns_formatted(&mut self, dns: &str) -> Result<(), Error>
pub fn set_dns_formatted(&mut self, dns: &str) -> Result<(), Error>
Set DNS configuration in string format
[(unix|tcp|udp)://]host[:port][,host[:port]]...
- Pre-defined. Like
google
,cloudflare
sourcepub fn load_from_str(s: &str, config_type: ConfigType) -> Result<Config, Error>
pub fn load_from_str(s: &str, config_type: ConfigType) -> Result<Config, Error>
Load Config from a str
sourcepub fn load_from_file<P: AsRef<Path>>(
filename: P,
config_type: ConfigType
) -> Result<Config, Error>
pub fn load_from_file<P: AsRef<Path>>(
filename: P,
config_type: ConfigType
) -> Result<Config, Error>
Load Config from a File
sourcepub fn has_server_plugins(&self) -> bool
pub fn has_server_plugins(&self) -> bool
Check if there are any plugin are enabled with servers
sourcepub fn check_integrity(&self) -> Result<(), Error>
pub fn check_integrity(&self) -> Result<(), Error>
Check if all required fields are already set
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more