mirror of https://github.com/dswd/vpncloud.git
Passing listen address as &str
This commit is contained in:
parent
f860d487e9
commit
c07d772b90
|
@ -105,10 +105,10 @@ pub struct GenericCloud<P: Protocol> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: Protocol> GenericCloud<P> {
|
impl<P: Protocol> GenericCloud<P> {
|
||||||
pub fn new(device: Device, listen: String, network_id: Option<NetworkId>, table: Box<Table>,
|
pub fn new(device: Device, listen: &str, network_id: Option<NetworkId>, table: Box<Table>,
|
||||||
peer_timeout: Duration, learning: bool, broadcast: bool, addresses: Vec<Range>,
|
peer_timeout: Duration, learning: bool, broadcast: bool, addresses: Vec<Range>,
|
||||||
crypto: Crypto) -> Self {
|
crypto: Crypto) -> Self {
|
||||||
let socket = match UdpSocket::bind(&listen as &str) {
|
let socket = match UdpSocket::bind(listen) {
|
||||||
Ok(socket) => socket,
|
Ok(socket) => socket,
|
||||||
_ => fail!("Failed to open socket {}", listen)
|
_ => fail!("Failed to open socket {}", listen)
|
||||||
};
|
};
|
||||||
|
|
|
@ -122,7 +122,7 @@ fn run<T: Protocol> (args: Args) {
|
||||||
Some(key) => Crypto::from_shared_key(args.flag_crypto, &key),
|
Some(key) => Crypto::from_shared_key(args.flag_crypto, &key),
|
||||||
None => Crypto::None
|
None => Crypto::None
|
||||||
};
|
};
|
||||||
let mut cloud = GenericCloud::<T>::new(device, args.flag_listen, network_id, table, peer_timeout, learning, broadcasting, ranges, crypto);
|
let mut cloud = GenericCloud::<T>::new(device, &args.flag_listen, network_id, table, peer_timeout, learning, broadcasting, ranges, crypto);
|
||||||
if let Some(script) = args.flag_ifup {
|
if let Some(script) = args.flag_ifup {
|
||||||
run_script(script, cloud.ifname());
|
run_script(script, cloud.ifname());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue