pub fn parse_args(
    args: Args,
) -> Result<
    (
        Option<SocketAddr>,
        Option<SocketAddr>,
        Option<SocketAddr>,
        Option<Address>,
        Option<SocketAddr>,
        Role,
    ),
    String,
> {
    let role = args.role();

    // local udp socket
    let local_udp;
    if let Some(lua) = args.local_addr_udp {
        if let Ok(sock_addr) = SocketAddr::from_str(&lua) {
            local_udp = Some(sock_addr);
        } else {
            return Err("error parsing local udp address".into());
        }
    } else {
        local_udp = None;
    }

    // router address
    let router_addr;
    if let Some(ra) = args.router_addr_tcp {
        router_addr = Some(SocketAddr::from_str(&ra).unwrap());
    } else {
        router_addr = None;
    }

    // remote address
    let remote_addr;
    if let Some(ra) = args.remote_addr {
        remote_addr = Some(SocketAddr::from_str(&ra).unwrap());
    } else {
        remote_addr = None;
    }

    // worker address
    let mut worker_addr = Some(Address::WorkerAddress(vec![0, 0, 0, 0]));
    if let Some(worker_addr_str) = args.worker_addr {
        worker_addr = Some(Address::worker_address_from_string(&worker_addr_str).unwrap());
    }

    // listen address
    let listen_addr;
    if let Some(listen) = args.listen_addr {
        listen_addr = Some(SocketAddr::from_str(&listen).unwrap());
    } else {
        listen_addr = None;
    }

    Ok((
        local_udp,
        router_addr,
        remote_addr,
        worker_addr,
        listen_addr,
        role,
    ))
}
// return value:
// - local socket (udp only)
// - router socket
// - remote (sink) socket
// - remote worker address
// - tcp listen address
// - initiator ip protocol
return value:
local socket (udp only)
router socket
remote (sink) socket
remote worker address
tcp listen address
initiator ip protocol
return value : local socket ( udp only ) router socket remote ( sink ) socket remote worker address tcp listen address initiator ip protocol
pub fn parse_args(
    args: Args,
) -> Result<
    (
        Option<SocketAddr>,
        Option<SocketAddr>,
        Option<SocketAddr>,
        Option<Address>,
        Option<SocketAddr>,
        Role,
    ),
    String,
> {
    let role = args.role();
    // local udp socket
    let local_udp;
    if let Some(lua) = args.local_addr_udp {
        if let Ok(sock_addr) = SocketAddr::from_str(&lua) {
            local_udp = Some(sock_addr);
        } else {
            return Err("error parsing local udp address".into());
        }
    } else {
        local_udp = None;
    }
    // router address
    let router_addr;
    if let Some(ra) = args.router_addr_tcp {
        router_addr = Some(SocketAddr::from_str(&ra).unwrap());
    } else {
        router_addr = None;
    }
    // remote address
    let remote_addr;
    if let Some(ra) = args.remote_addr {
        remote_addr = Some(SocketAddr::from_str(&ra).unwrap());
    } else {
        remote_addr = None;
    }
    // worker address
    let mut worker_addr = Some(Address::WorkerAddress(vec![0, 0, 0, 0]));
    if let Some(worker_addr_str) = args.worker_addr {
        worker_addr = Some(Address::worker_address_from_string(&worker_addr_str).unwrap());
    }
    // listen address
    let listen_addr;
    if let Some(listen) = args.listen_addr {
        listen_addr = Some(SocketAddr::from_str(&listen).unwrap());
    } else {
        listen_addr = None;
    }
    Ok((
        local_udp,
        router_addr,
        remote_addr,
        worker_addr,
        listen_addr,
        role,
    ))
}
pub fn parse_args ( args : Args , ) -> Result < ( Option < SocketAddr > , Option < SocketAddr > , Option < SocketAddr > , Option < Address > , Option < SocketAddr > , Role , ) , String , > { let role = args . role ( ) ; // local udp socket let local_udp ; if let Some ( lua ) = args . local_addr_udp { if let Ok ( sock_addr ) = SocketAddr :: from_str ( & lua ) { local_udp = Some ( sock_addr ) ; } else { return Err ( " " . into ( ) ) ; } } else { local_udp = None ; } // router address let router_addr ; if let Some ( ra ) = args . router_addr_tcp { router_addr = Some ( SocketAddr :: from_str ( & ra ) . unwrap ( ) ) ; } else { router_addr = None ; } // remote address let remote_addr ; if let Some ( ra ) = args . remote_addr { remote_addr = Some ( SocketAddr :: from_str ( & ra ) . unwrap ( ) ) ; } else { remote_addr = None ; } // worker address let mut worker_addr = Some ( Address :: WorkerAddress ( vec ! [ 0 0 0 0 ] ) ) ; if let Some ( worker_addr_str ) = args . worker_addr { worker_addr = Some ( Address :: worker_address_from_string ( & worker_addr_str ) . unwrap ( ) ) ; } // listen address let listen_addr ; if let Some ( listen ) = args . listen_addr { listen_addr = Some ( SocketAddr :: from_str ( & listen ) . unwrap ( ) ) ; } else { listen_addr = None ; } Ok ( ( local_udp , router_addr , remote_addr , worker_addr , listen_addr , role , ) ) }
return value:
 local socket (udp only)
 router socket
 remote (sink) socket
 remote worker address
 tcp listen address
 initiator ip protocol
return value : local socket ( udp only ) router socket remote ( sink ) socket remote worker address tcp listen address initiator ip protocol
args
Args
args
Args