mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 09:05:33 +00:00
parse SocketAddr from the argument option
This commit is contained in:
parent
ea8d5c316f
commit
6f4d2894b3
2 changed files with 4 additions and 4 deletions
|
|
@ -41,7 +41,7 @@ pub struct Config {
|
|||
/// * 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<String>,
|
||||
pub listen: Option<SocketAddr>,
|
||||
|
||||
/// Enable UPnP forwarding
|
||||
#[arg(long, default_value_t = false)]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use librqbit::{
|
|||
PeerConnectionOptions, SessionOptions,
|
||||
};
|
||||
use preload::Preload;
|
||||
use std::{collections::HashSet, num::NonZero, str::FromStr, time::Duration};
|
||||
use std::{collections::HashSet, num::NonZero, time::Duration};
|
||||
use url::Url;
|
||||
|
||||
#[tokio::main]
|
||||
|
|
@ -35,9 +35,9 @@ async fn main() -> Result<()> {
|
|||
SessionOptions {
|
||||
bind_device_name: config.bind,
|
||||
listen: match config.listen {
|
||||
Some(l) => Some(ListenerOptions {
|
||||
listen_addr: std::net::SocketAddr::from_str(&l)?,
|
||||
Some(listen_addr) => Some(ListenerOptions {
|
||||
enable_upnp_port_forwarding: config.listen_upnp,
|
||||
listen_addr,
|
||||
..ListenerOptions::default()
|
||||
}),
|
||||
None => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue