Changes to be committed:
modified: src/server.rs
This commit is contained in:
parent
0e63a71629
commit
5edb2d6b57
@ -79,9 +79,14 @@ pub async fn server_mode(server_config: ServerConfiguration) {
|
|||||||
// (&buf[1..len]).to_vec()
|
// (&buf[1..len]).to_vec()
|
||||||
let handshake = UDPVpnHandshake::deserialize(&buf);
|
let handshake = UDPVpnHandshake::deserialize(&buf);
|
||||||
info!("Got handshake! ip: {:?}; key: {:?}", handshake.request_ip, base64::encode(handshake.public_key));
|
info!("Got handshake! ip: {:?}; key: {:?}", handshake.request_ip, base64::encode(handshake.public_key));
|
||||||
let internal_ip = IpAddr::V4(Ipv4Addr::new(10,8,0,2));
|
let skey = base64::encode(handshake.public_key);
|
||||||
info!("Got handshake");
|
if plp.iter().any(|c| c.ip == handshake.request_ip && c.public_key == skey) {
|
||||||
|
let internal_ip = IpAddr::V4(handshake.request_ip);
|
||||||
|
info!("Accepted client");
|
||||||
mp.insert(internal_ip, UDPeer { addr });
|
mp.insert(internal_ip, UDPeer { addr });
|
||||||
|
} else {
|
||||||
|
info!("Bad handshake");
|
||||||
|
}
|
||||||
}, // handshake
|
}, // handshake
|
||||||
1 => {
|
1 => {
|
||||||
if mp.values().any(| p | p.addr == addr) {
|
if mp.values().any(| p | p.addr == addr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user