]> Sergey Matveev's repositories - btrtrc.git/blobdiff - client-stats.go
Drop support for go 1.20
[btrtrc.git] / client-stats.go
index 1a8009708fb3a3c893d60a4c542e009eab9957ed..bfa6994e9890af2e346ac2d354e4b4be9ec0d975 100644 (file)
@@ -2,14 +2,21 @@ package torrent
 
 import (
        "net/netip"
+
+       g "github.com/anacrolix/generics"
 )
 
+func setAdd[K comparable](m *map[K]struct{}, elem K) {
+       g.MakeMapIfNilAndSet(m, elem, struct{}{})
+}
+
 type clientHolepunchAddrSets struct {
        undialableWithoutHolepunch                            map[netip.AddrPort]struct{}
        undialableWithoutHolepunchDialedAfterHolepunchConnect map[netip.AddrPort]struct{}
        dialableOnlyAfterHolepunch                            map[netip.AddrPort]struct{}
        dialedSuccessfullyAfterHolepunchConnect               map[netip.AddrPort]struct{}
        probablyOnlyConnectedDueToHolepunch                   map[netip.AddrPort]struct{}
+       accepted                                              map[netip.AddrPort]struct{}
 }
 
 type ClientStats struct {