Breaking change: new packet formats.

This commit is contained in:
jdl
2025-01-13 16:43:27 +01:00
parent 2bdd76e689
commit 970490b17b
3 changed files with 19 additions and 12 deletions
+4
View File
@@ -26,6 +26,10 @@ func (store *pubAddrStore) Store(add netip.AddrPort) {
return
}
if !add.IsValid() {
return
}
if _, exists := store.lastSeen[add]; !exists {
store.addrList = append(store.addrList, add)
}
+1 -1
View File
@@ -68,7 +68,7 @@ var (
}()
// Messages for the supervisor.
messages = make(chan any, 512)
messages = make(chan any, 1024)
// Global routing table.
routingTable [256]*atomic.Pointer[peerRoute] = func() (out [256]*atomic.Pointer[peerRoute]) {
+8 -5
View File
@@ -102,6 +102,8 @@ type peerStateData struct {
// For logging. Set per-state.
client bool
// We rate limit per remote endpoint because if we don't we tend to lose
// packets.
limiter *ratelimiter.Limiter
}
@@ -270,9 +272,10 @@ func (s *stateServer) OnSyn(msg controlMsg[synPacket]) {
// Not direct => send probes.
for _, addr := range p.PossibleAddrs {
if addr.IsValid() {
s.sendControlPacketTo(probePacket{TraceID: newTraceID()}, addr)
if !addr.IsValid() {
break
}
s.sendControlPacketTo(probePacket{TraceID: newTraceID()}, addr)
}
}
@@ -410,11 +413,11 @@ func (s *stateClient) OnPingTimer() peerState {
}
clear(s.probes)
for _, ip := range publicAddrs.Get() {
if !ip.IsValid() {
for _, addr := range s.ack.PossibleAddrs {
if !addr.IsValid() {
break
}
s.sendProbeTo(ip)
s.sendProbeTo(addr)
}
select {