meta: cargo clippy & fmt
parent
b395f7f736
commit
d4822afc98
|
@ -615,7 +615,11 @@ fn get_session(
|
|||
.ok_or(ServerError::Unauthorized)?;
|
||||
let pubkey = pubkey.to_str().map_err(|_| ServerError::Unauthorized)?;
|
||||
let pubkey = Key::from_base64(pubkey).map_err(|_| ServerError::Unauthorized)?;
|
||||
if pubkey.as_bytes().ct_eq(&context.public_key.as_bytes()).into() {
|
||||
if pubkey
|
||||
.as_bytes()
|
||||
.ct_eq(context.public_key.as_bytes())
|
||||
.into()
|
||||
{
|
||||
let peer = DatabasePeer::get_from_ip(&context.db.lock(), addr).map_err(|e| match e {
|
||||
rusqlite::Error::QueryReturnedNoRows => ServerError::Unauthorized,
|
||||
e => ServerError::Database(e),
|
||||
|
|
|
@ -328,7 +328,10 @@ pub fn apply(builder: &DeviceUpdate, iface: &InterfaceName) -> io::Result<()> {
|
|||
}
|
||||
|
||||
for peer in &builder.peers {
|
||||
request.push_str(&format!("public_key={}\n", hex::encode(peer.public_key.as_bytes())));
|
||||
request.push_str(&format!(
|
||||
"public_key={}\n",
|
||||
hex::encode(peer.public_key.as_bytes())
|
||||
));
|
||||
|
||||
if peer.replace_allowed_ips {
|
||||
request.push_str("replace_allowed_ips=true\n");
|
||||
|
@ -506,4 +509,4 @@ mod test {
|
|||
assert!(key.as_bytes() != &[0u8; 32]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue