mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-25 20:23:43 +00:00
cmd/natc: separate perPeerState from connector
Make the perPeerState objects able to function independently without a shared reference to the connector. We don't currently change the values from connector that perPeerState uses at runtime. Explicitly copying them at perPeerState creation allows us to, for example, put the perPeerState into a consensus algorithm in the future. Updates #14667 Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
@@ -220,7 +220,7 @@ func TestPerPeerState(t *testing.T) {
|
||||
}
|
||||
c.setPrefixes([]netip.Prefix{netip.MustParsePrefix("100.64.1.0/24")})
|
||||
|
||||
ps := &perPeerState{c: c}
|
||||
ps := newPerPeerState(c)
|
||||
|
||||
addrs, err := ps.ipForDomain("example.com")
|
||||
if err != nil {
|
||||
@@ -360,7 +360,7 @@ func TestIPPoolExhaustion(t *testing.T) {
|
||||
}
|
||||
c.setPrefixes([]netip.Prefix{smallPrefix})
|
||||
|
||||
ps := &perPeerState{c: c}
|
||||
ps := newPerPeerState(c)
|
||||
|
||||
assignedIPs := make(map[netip.Addr]string)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user