Updated doc tests

This commit is contained in:
Y. T. Chung
2018-05-30 21:41:25 +08:00
parent 0acdb15029
commit e5cf8907b5
2 changed files with 14 additions and 2 deletions
+6 -1
View File
@@ -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
View File
@@ -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 {