WIP: Cleanup

This commit is contained in:
jdl
2025-08-26 16:57:46 +02:00
parent 31c48fbafd
commit 302d27692b
22 changed files with 29 additions and 2199 deletions

View File

@@ -31,10 +31,6 @@ var multicastAddr = net.UDPAddrFromAddrPort(netip.AddrPortFrom(
netip.AddrFrom4([4]byte{224, 0, 0, 157}),
4560))
type marshaller interface {
Marshal([]byte) []byte
}
// ----------------------------------------------------------------------------
type Globals struct {
@@ -62,6 +58,7 @@ type Globals struct {
IFace io.ReadWriteCloser
// For trace ID.
NewTraceID func() uint64
}
func NewGlobals(
@@ -90,6 +87,12 @@ func NewGlobals(
g.IFace = iface
// TODO: Initialize w/ startup count.
traceID := uint64(time.Now().Unix()<<30) + 1
g.NewTraceID = func() uint64 {
return atomic.AddUint64(&traceID, 1)
}
for i := range g.RemotePeers {
g.RemotePeers[i] = &atomic.Pointer[Remote]{}
}