mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-23 01:20:52 +00:00
Implement first, unfinished version of DNS support and fix incomplete TCP stream bug
This commit does two things: First, it implements a first, unfinished version of the virtual DNS functionality. This feature is incomplete and has known bugs. Since it needs to be enabled manually, this is not a huge issue so far. Second, the commit fixes a bug where TCP streams where not properly relayed, causing TCP connections to stall.
This commit is contained in:
parent
56d0dd9d42
commit
c9297124e1
5 changed files with 375 additions and 54 deletions
11
src/main.rs
11
src/main.rs
|
@ -1,6 +1,7 @@
|
|||
use clap::Parser;
|
||||
use env_logger::Env;
|
||||
|
||||
use tun2proxy::tun2proxy::Options;
|
||||
use tun2proxy::{main_entry, Proxy};
|
||||
|
||||
/// Tunnel interface to proxy
|
||||
|
@ -14,6 +15,9 @@ struct Args {
|
|||
/// The proxy URL in the form proto://[username[:password]@]host:port
|
||||
#[arg(short, long = "proxy", value_parser = Proxy::from_url, value_name = "URL")]
|
||||
proxy: Proxy,
|
||||
|
||||
#[arg(short, long = "dns")]
|
||||
virtual_dns: bool,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -24,5 +28,10 @@ fn main() {
|
|||
let proxy_type = args.proxy.proxy_type;
|
||||
log::info!("Proxy {proxy_type} server: {addr}");
|
||||
|
||||
main_entry(&args.tun, args.proxy);
|
||||
let mut options = Options::new();
|
||||
if args.virtual_dns {
|
||||
options = options.with_virtual_dns();
|
||||
}
|
||||
|
||||
main_entry(&args.tun, args.proxy, options);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue