Open multiple tunnels for manual peers with more than one A record
this is a key part of our planned clustering strategy where we peer
in more than one exit at a time.
@@ -641,7 +641,10 @@ impl TunnelManager {
let url = format!("http://[{}]:{}/hello", their_hostname, port);
trace!("Saying hello to: {:?} at ip {:?}", url, dnsresult);
if !dnsresult.is_empty() && SETTING.get_network().is_gateway {
- let their_ip = dnsresult[0].ip();
+ // dns records may have many ip's if we get multiple it's a load
+ // balanced exit and we need to create tunnels to all of them
+ for dns_socket in dnsresult {
+ let their_ip = dns_socket.ip();
let socket = SocketAddr::new(their_ip, port);
let man_peer = Peer {
ifidx: 0,
@@ -651,6 +654,7 @@ impl TunnelManager {
if res.is_err() {
warn!("Contact neighbor failed with {:?}", res);
}
+ }
} else {
trace!(
"We're not a gateway or we got a zero length dns response: {:?}",
