[][src]Struct shadowsocks::context::Context

pub struct Context { /* fields omitted */ }

Shared basic configuration for the whole server

Implementations

impl Context[src]

pub async fn new_shared(config: Config) -> SharedContext[src]

Create a shared Context, wrapped in Arc

pub fn new_with_state_shared(
    config: Config,
    server_state: SharedServerState
) -> SharedContext
[src]

Create a shared Context, wrapped in Arc with a ServerState

This is useful when you are running multiple servers in one process

pub fn config(&self) -> &Config[src]

Config for TCP server

pub fn server_state(&self) -> &SharedServerState[src]

ServerState

pub fn config_mut(&mut self) -> &mut Config[src]

Mutable Config for TCP server

NOTE: Only for launching plugins

pub fn server_config(&self, idx: usize) -> &ServerConfig[src]

Get ServerConfig by index

pub fn server_config_mut(&mut self, idx: usize) -> &mut ServerConfig[src]

Get mutable ServerConfig by index

pub fn dns_resolver(&self) -> Option<&TokioAsyncResolver>[src]

Get the global shared resolver

pub async fn dns_resolve<'_, '_>(
    &'_ self,
    host: &'_ str,
    port: u16
) -> Result<Vec<SocketAddr>>
[src]

Perform a DNS resolution

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

Check if the server is still in running state

pub fn set_server_stopped(&self)[src]

Stops the server, kills all detached running tasks

pub fn check_nonce_and_set(&self, nonce: &[u8]) -> bool[src]

Check if nonce exist or not

If not, set into the current bloom filter

pub async fn check_client_blocked<'_, '_>(
    &'_ self,
    addr: &'_ SocketAddr
) -> bool
[src]

Check client ACL (for server)

pub async fn check_outbound_blocked<'_, '_>(&'_ self, addr: &'_ Address) -> bool[src]

Check outbound address ACL (for server)

pub fn acl(&self) -> Option<&AccessControl>[src]

Get ACL control instance

pub async fn check_target_bypassed<'_, '_>(
    &'_ self,
    target: &'_ Address
) -> bool
[src]

Check target address ACL (for client)

Auto Trait Implementations

impl !RefUnwindSafe for Context

impl Send for Context

impl Sync for Context

impl Unpin for Context

impl !UnwindSafe for Context

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, 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>,