Add the public VPN server lists, with is_vpn and vpn_providers (closes #235)
check / check (push) Successful in 1m36s

The IP lookup now checks Mullvad, NordVPN, Private Internet Access, IVPN and X4BNet's community list, each downloaded once a day. Each result has `flags.is_vpn` and `vpn_providers`.

Judgement call: X4BNet publishes IPv4 and IPv6 as two files, so they are two lists, `x4bnet` and `x4bnet_v6`.
Judgement call: Private Internet Access's signature is not read or checked.
Rule suppressed: `tagliatelle` on the structs holding the publishers' field names.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-10 10:56:24 +00:00
1 parent 3204b7ee4b
commit 601bc812b9
8 files changed
+584 -28

No files matched your search

+31 -5
View File
@@ -781,6 +781,10 @@ type IPLookupResult struct {
Flags IPLookupFlags `json:"flags"`
// VPNProviders names the VPN lists the address is on. It is empty, never
// nil, when there are none.
VPNProviders []string `json:"vpn_providers"`
// IPLists has one entry for each IP list the address is on.
IPLists []iplist.Listing `json:"ip_lists"`
}
@@ -793,6 +797,9 @@ type IPLookupFlags struct {
// IsTor says that the address is on the Tor exit list.
IsTor bool `json:"is_tor"`
// IsVPN says that the address is on a list of VPN servers.
IsVPN bool `json:"is_vpn"`
// IsBogon says that the address is reserved, as package bogon tells.
IsBogon bool `json:"is_bogon"`
}
@@ -977,14 +984,30 @@ func (s *Server) ipLookupResult(ip string, ptrs []string, info IPInfo) IPLookupR
listings := s.ipListListings(ip)
return IPLookupResult{
IP: ip,
PTR: ptrs,
IPInfo: info,
Flags: ipLookupFlags(ip, listings),
IPLists: listings,
IP: ip,
PTR: ptrs,
IPInfo: info,
Flags: ipLookupFlags(ip, listings),
VPNProviders: vpnProviders(listings),
IPLists: listings,
}
}
// vpnProviders returns the names of the VPN lists among listings. It returns
// an empty list, never nil, so that an answer's vpn_providers is [] rather
// than null.
func vpnProviders(listings []iplist.Listing) []string {
names := []string{}
for _, listing := range listings {
if listing.VPN {
names = append(names, listing.Name)
}
}
return names
}
// ipListListings returns the IP lists that contain ip. It returns an empty
// list, never nil, so that an answer's ip_lists is [] rather than null.
func (s *Server) ipListListings(ip string) []iplist.Listing {
@@ -1002,6 +1025,9 @@ func ipLookupFlags(ip string, listings []iplist.Listing) IPLookupFlags {
IsTor: slices.ContainsFunc(listings, func(l iplist.Listing) bool {
return l.Name == iplist.TorExitsList
}),
IsVPN: slices.ContainsFunc(listings, func(l iplist.Listing) bool {
return l.VPN
}),
IsBogon: isBogon(ip),
}
}