Refactor DNS relay

- Allow working in standalone mode
- Use same UDP socket for sending response packet
- Send TCP queries with ProxyStream directly

ref #213
This commit is contained in:
zonyitoo
2020-03-16 23:36:18 +08:00
committed by Y. T. CHUNG
parent 705f0a510d
commit 05cdde3032
29 changed files with 261 additions and 136 deletions

View File

@@ -39,7 +39,7 @@ impl Socks5TestServer {
},
cli_config: {
let mut cfg = Config::new(ConfigType::Socks5Local);
cfg.local = Some(ServerAddr::from(local_addr));
cfg.local_addr = Some(ServerAddr::from(local_addr));
cfg.server = vec![ServerConfig::basic(svr_addr, pwd.to_owned(), method)];
cfg.mode = if enable_udp { Mode::TcpAndUdp } else { Mode::TcpOnly };
cfg

View File

@@ -46,7 +46,7 @@ fn get_svr_config() -> Config {
fn get_cli_config() -> Config {
let mut cfg = Config::new(ConfigType::Socks5Local);
cfg.local = Some(LOCAL_ADDR.parse().unwrap());
cfg.local_addr = Some(LOCAL_ADDR.parse().unwrap());
cfg.server = vec![ServerConfig::basic(
SERVER_ADDR.parse().unwrap(),
PASSWORD.to_owned(),