Cleanup - WIP

This commit is contained in:
jdl
2026-06-11 18:11:21 +02:00
parent ab2837817d
commit 0902341322
12 changed files with 223 additions and 160 deletions

View File

@@ -9,9 +9,9 @@ import (
"vppn/m"
)
func testPoller(t *testing.T) (*HubPoller, chan HubPeer, chan wgtypes.Key) {
func testPoller(t *testing.T) (*HubPoller, chan m.Peer, chan wgtypes.Key) {
t.Helper()
addCh := make(chan HubPeer, 8)
addCh := make(chan m.Peer, 8)
removeCh := make(chan wgtypes.Key, 8)
hp := &HubPoller{
selfVPNIP: netip.MustParseAddr("10.0.0.1"),
@@ -25,10 +25,9 @@ func testPoller(t *testing.T) (*HubPoller, chan HubPeer, chan wgtypes.Key) {
func stateWith(key wgtypes.Key, peerIP byte, version int64) m.NetworkState {
return m.NetworkState{Peers: []m.Peer{{
PeerIP: peerIP,
Version: version,
WGPubKey: key[:],
SignPubKey: make([]byte, 32),
PeerIP: peerIP,
Version: version,
WGPubKey: key,
}}}
}
@@ -42,7 +41,7 @@ func TestApply_EmitsAddsAndReportsChange(t *testing.T) {
if len(addCh) != 1 {
t.Fatalf("expected 1 add, got %d", len(addCh))
}
if got := <-addCh; got.PubKey != key {
if got := <-addCh; got.WGPubKey != key {
t.Errorf("add pubkey mismatch")
}
}