mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-07-30 23:30:11 -07:00
fix: Always send messages to a peer using the socket they contacted us with
To implement this it was necessary to introduce an `Endpoint` abstraction over SocketAddr's that includes the information which socket was used.
This commit is contained in:
committed by
Karolin Varner
parent
f3c343c472
commit
f8bea94330
+1
-9
@@ -1,6 +1,5 @@
|
||||
use anyhow::{bail, ensure};
|
||||
use clap::Parser;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::app_server::AppServer;
|
||||
@@ -229,20 +228,13 @@ impl Cli {
|
||||
)?);
|
||||
|
||||
for cfg_peer in config.peers {
|
||||
let endpoint = cfg_peer
|
||||
.endpoint
|
||||
.as_ref()
|
||||
.map(ToSocketAddrs::to_socket_addrs)
|
||||
.transpose()?
|
||||
.and_then(|mut i| i.next());
|
||||
|
||||
srv.add_peer(
|
||||
// psk, pk, outfile, outwg, tx_addr
|
||||
cfg_peer.pre_shared_key.map(SymKey::load_b64).transpose()?,
|
||||
SPk::load(&cfg_peer.public_key)?,
|
||||
cfg_peer.key_out,
|
||||
None, // TODO remove this argument
|
||||
endpoint,
|
||||
cfg_peer.endpoint.clone(),
|
||||
)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user