Nat to nat (#146)

* wireguard: export an Endpoint comparison method

* Record discovered endpoints in node

* Synchronize DiscoveredEndpoints in k8s backend

* Add discoveredEndpointsAreEqual

* Handle discovered Endpoints in topology to enable NAT 2 NAT

* Refactor to use Endpoint.Equal

Compare IP first by default and compare DNS name first when we know the Endpoint was resolved.

* Drop the shallow copies of nodes and peers

Now that updateNATEndpoints was updated to discoverNATEndpoints and that
the endpoints are overridden by topology instead of mutating the nodes and
peers object, we can safely drop this copy.
This commit is contained in:
Julien Viard de Galbert
2021-04-21 19:47:29 +02:00
committed by GitHub
parent 863628ffaa
commit 2ac000c68a
7 changed files with 475 additions and 270 deletions

View File

@@ -66,6 +66,7 @@ type Node struct {
PersistentKeepalive int
Subnet *net.IPNet
WireGuardIP *net.IPNet
DiscoveredEndpoints map[string]*wireguard.Endpoint
}
// Ready indicates whether or not the node is ready.