diff --git a/README.md b/README.md index 2241ae5..de06ad6 100644 --- a/README.md +++ b/README.md @@ -94,9 +94,15 @@ aquatic-crawler --infohash /path/to/info-hash-ipv4.bin\ --enable-tcp Enable TCP connection + --bind + Bind resolver session on specified device name (`tun0`, `mycelium`, etc.) + --listen Bind listener on specified `host:port` (`[host]:port` for IPv6) + * this option is useful only for binding the data exchange service, + to restrict the outgoing connections for torrent resolver, use `bind` option instead + --listen-upnp Enable UPnP forwarding diff --git a/src/config.rs b/src/config.rs index 12c9f7a..b6ac645 100644 --- a/src/config.rs +++ b/src/config.rs @@ -53,7 +53,14 @@ pub struct Config { #[arg(long, default_value_t = false)] pub enable_tcp: bool, + /// Bind resolver session on specified device name (`tun0`, `mycelium`, etc.) + #[arg(long)] + pub bind: Option, + /// Bind listener on specified `host:port` (`[host]:port` for IPv6) + /// + /// * this option is useful only for binding the data exchange service, + /// to restrict the outgoing connections for torrent resolver, use `bind` option instead #[arg(long)] pub listen: Option, diff --git a/src/main.rs b/src/main.rs index 3f4cc4e..d39ef9f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,6 +51,7 @@ async fn main() -> Result<()> { None => PathBuf::new(), }, SessionOptions { + bind_device_name: config.bind, listen: match config.listen { Some(l) => Some(ListenerOptions { listen_addr: std::net::SocketAddr::from_str(&l)?,