mirror of https://github.com/dswd/vpncloud.git
L2 routing
This commit is contained in:
parent
30fab51be6
commit
c5d072fa13
|
@ -25,7 +25,6 @@ use types::{Error, Behavior, Type, Range, Table};
|
|||
use cloud::{TapCloud, TunCloud};
|
||||
|
||||
|
||||
//TODO: L2 routing
|
||||
//TODO: Implement IPv6
|
||||
//TODO: Encryption
|
||||
//TODO: Call close
|
||||
|
|
|
@ -52,7 +52,14 @@ impl FromStr for Address {
|
|||
}
|
||||
return Ok(Address(res));
|
||||
}
|
||||
//FIXME: implement for mac addresses
|
||||
let parts: Vec<&str> = text.split(':').collect();
|
||||
if parts.len() == 6 {
|
||||
let mut bytes = Vec::with_capacity(6);
|
||||
for i in 0..6 {
|
||||
bytes.push(try!(u8::from_str_radix(&parts[i], 16).map_err(|_| Error::ParseError("Failed to parse mac"))));
|
||||
}
|
||||
return Ok(Address(bytes));
|
||||
}
|
||||
return Err(Error::ParseError("Failed to parse address"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue