mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-06 16:14:11 +00:00
Updated doc tests
This commit is contained in:
+6
-1
@@ -15,17 +15,22 @@ use relay::udprelay::local::run as run_udp;
|
||||
/// Relay server running under local environment.
|
||||
///
|
||||
/// ```no_run
|
||||
/// extern crate tokio;
|
||||
/// extern crate shadowsocks;
|
||||
///
|
||||
/// use shadowsocks::config::{Config, ServerConfig};
|
||||
/// use shadowsocks::crypto::CipherType;
|
||||
/// use shadowsocks::relay::local::run;
|
||||
///
|
||||
/// use tokio::prelude::*;
|
||||
///
|
||||
/// let mut config = Config::new();
|
||||
/// config.local = Some("127.0.0.1:1080".parse().unwrap());
|
||||
/// config.server = vec![ServerConfig::basic("127.0.0.1:8388".parse().unwrap(),
|
||||
/// "server-password".to_string(),
|
||||
/// CipherType::Aes256Cfb)];
|
||||
/// let fut = run(config);
|
||||
/// tokio::run(fut.map_err(|err| panic!("Server run failed with error {}", err));
|
||||
/// tokio::run(fut.map_err(|err| panic!("Server run failed with error {}", err)));
|
||||
/// ```
|
||||
pub fn run(mut config: Config) -> impl Future<Item = (), Error = io::Error> + Send {
|
||||
let mut vf = Vec::new();
|
||||
|
||||
+8
-1
@@ -15,15 +15,22 @@ use relay::udprelay::server::run as run_udp;
|
||||
/// Relay server running on server side.
|
||||
///
|
||||
/// ```no_run
|
||||
/// extern crate tokio;
|
||||
/// extern crate shadowsocks;
|
||||
///
|
||||
/// use shadowsocks::config::{Config, ServerConfig};
|
||||
/// use shadowsocks::crypto::CipherType;
|
||||
/// use shadowsocks::relay::server::run;
|
||||
///
|
||||
/// use tokio::prelude::*;
|
||||
///
|
||||
/// let mut config = Config::new();
|
||||
/// config.server = vec![ServerConfig::basic("127.0.0.1:8388".parse().unwrap(),
|
||||
/// "server-password".to_string(),
|
||||
/// CipherType::Aes256Cfb)];
|
||||
/// run(config);
|
||||
///
|
||||
/// let fut = run(config);
|
||||
/// tokio::run(fut.map_err(|err| panic!("Server run failed with error {}", err)));
|
||||
/// ```
|
||||
///
|
||||
pub fn run(mut config: Config) -> impl Future<Item = (), Error = io::Error> + Send {
|
||||
|
||||
Reference in New Issue
Block a user