Add annotated keepalive value to peer functions
This commit is contained in:
parent
331c225c36
commit
1f8e06b911
@ -368,6 +368,7 @@ func (t *Topology) AsPeer() *wireguard.Peer {
|
|||||||
IP: s.endpoint,
|
IP: s.endpoint,
|
||||||
Port: uint32(t.port),
|
Port: uint32(t.port),
|
||||||
},
|
},
|
||||||
|
PersistentKeepalive: s.persistentKeepalive,
|
||||||
PublicKey: s.key,
|
PublicKey: s.key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,6 +385,7 @@ func (t *Topology) PeerConf(name string) *wireguard.Conf {
|
|||||||
IP: s.endpoint,
|
IP: s.endpoint,
|
||||||
Port: uint32(t.port),
|
Port: uint32(t.port),
|
||||||
},
|
},
|
||||||
|
PersistentKeepalive: s.persistentKeepalive,
|
||||||
PublicKey: s.key,
|
PublicKey: s.key,
|
||||||
}
|
}
|
||||||
c.Peers = append(c.Peers, peer)
|
c.Peers = append(c.Peers, peer)
|
||||||
|
@ -45,6 +45,7 @@ func setup(t *testing.T) (map[string]*Node, map[string]*Peer, []byte, uint32) {
|
|||||||
Location: "1",
|
Location: "1",
|
||||||
Subnet: &net.IPNet{IP: net.ParseIP("10.2.1.0"), Mask: net.CIDRMask(24, 32)},
|
Subnet: &net.IPNet{IP: net.ParseIP("10.2.1.0"), Mask: net.CIDRMask(24, 32)},
|
||||||
Key: []byte("key1"),
|
Key: []byte("key1"),
|
||||||
|
PersistentKeepalive: 25,
|
||||||
},
|
},
|
||||||
"b": {
|
"b": {
|
||||||
Name: "b",
|
Name: "b",
|
||||||
@ -124,6 +125,7 @@ func TestNewTopology(t *testing.T) {
|
|||||||
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
||||||
hostnames: []string{"a"},
|
hostnames: []string{"a"},
|
||||||
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
||||||
|
persistentKeepalive: nodes["a"].PersistentKeepalive,
|
||||||
wireGuardIP: w1,
|
wireGuardIP: w1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -160,6 +162,7 @@ func TestNewTopology(t *testing.T) {
|
|||||||
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
||||||
hostnames: []string{"a"},
|
hostnames: []string{"a"},
|
||||||
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
||||||
|
persistentKeepalive: nodes["a"].PersistentKeepalive,
|
||||||
wireGuardIP: w1,
|
wireGuardIP: w1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -196,6 +199,7 @@ func TestNewTopology(t *testing.T) {
|
|||||||
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
||||||
hostnames: []string{"a"},
|
hostnames: []string{"a"},
|
||||||
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
||||||
|
persistentKeepalive: nodes["a"].PersistentKeepalive,
|
||||||
wireGuardIP: w1,
|
wireGuardIP: w1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -232,6 +236,7 @@ func TestNewTopology(t *testing.T) {
|
|||||||
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
||||||
hostnames: []string{"a"},
|
hostnames: []string{"a"},
|
||||||
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
||||||
|
persistentKeepalive: nodes["a"].PersistentKeepalive,
|
||||||
wireGuardIP: w1,
|
wireGuardIP: w1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -278,6 +283,7 @@ func TestNewTopology(t *testing.T) {
|
|||||||
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
||||||
hostnames: []string{"a"},
|
hostnames: []string{"a"},
|
||||||
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
||||||
|
persistentKeepalive: nodes["a"].PersistentKeepalive,
|
||||||
wireGuardIP: w1,
|
wireGuardIP: w1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -324,6 +330,7 @@ func TestNewTopology(t *testing.T) {
|
|||||||
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
cidrs: []*net.IPNet{nodes["a"].Subnet},
|
||||||
hostnames: []string{"a"},
|
hostnames: []string{"a"},
|
||||||
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
privateIPs: []net.IP{nodes["a"].InternalIP.IP},
|
||||||
|
persistentKeepalive: nodes["a"].PersistentKeepalive,
|
||||||
wireGuardIP: w1,
|
wireGuardIP: w1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1027,6 +1034,7 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = key1
|
PublicKey = key1
|
||||||
Endpoint = 10.1.0.1:51820
|
Endpoint = 10.1.0.1:51820
|
||||||
|
PersistentKeepalive = 25
|
||||||
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
@ -1051,6 +1059,7 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = key1
|
PublicKey = key1
|
||||||
Endpoint = 10.1.0.1:51820
|
Endpoint = 10.1.0.1:51820
|
||||||
|
PersistentKeepalive = 25
|
||||||
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
@ -1104,6 +1113,7 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = key1
|
PublicKey = key1
|
||||||
Endpoint = 10.1.0.1:51820
|
Endpoint = 10.1.0.1:51820
|
||||||
|
PersistentKeepalive = 25
|
||||||
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
@ -1133,6 +1143,7 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = key1
|
PublicKey = key1
|
||||||
Endpoint = 10.1.0.1:51820
|
Endpoint = 10.1.0.1:51820
|
||||||
|
PersistentKeepalive = 25
|
||||||
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
AllowedIPs = 10.2.1.0/24, 192.168.0.1/32, 10.4.0.1/32
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
|
Loading…
Reference in New Issue
Block a user