less useless actions
This commit is contained in:
parent
326fd2dada
commit
3acf041d00
1 changed files with 9 additions and 3 deletions
12
src/main.rs
12
src/main.rs
|
@ -588,8 +588,14 @@ impl State {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !endpoints.is_empty() {
|
if !endpoints.is_empty() {
|
||||||
let endpoint = endpoints[i % endpoints.len()];
|
let endpoint = endpoints[i % endpoints.len()].0;
|
||||||
info!("Configure {} with endpoint {}", peer_cfg.pubkey, endpoint.0);
|
|
||||||
|
if self.peers.get(&peer_cfg.pubkey).map(|x| x.endpoint == Some(endpoint)).unwrap_or(false) {
|
||||||
|
// Skip if we are already using that endpoint
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
info!("Configure {} with endpoint {}", peer_cfg.pubkey, endpoint);
|
||||||
Command::new("wg")
|
Command::new("wg")
|
||||||
.args([
|
.args([
|
||||||
"set",
|
"set",
|
||||||
|
@ -597,7 +603,7 @@ impl State {
|
||||||
"peer",
|
"peer",
|
||||||
&peer_cfg.pubkey,
|
&peer_cfg.pubkey,
|
||||||
"endpoint",
|
"endpoint",
|
||||||
&endpoint.0.to_string(),
|
&endpoint.to_string(),
|
||||||
"persistent-keepalive",
|
"persistent-keepalive",
|
||||||
"10",
|
"10",
|
||||||
"allowed-ips",
|
"allowed-ips",
|
||||||
|
|
Loading…
Reference in a new issue