Documentation
¶
Overview ¶
Package blocklist is the second source of the country check ("is the node reachable from Russia"): the public lists of blocked addresses, downloaded by the panel and compared with every node's IPv4 address in memory. No node address leaves the panel, which is what sets it apart from Globalping.
A hit means "listed" (the address is written in the RKN registry, or is in a subnet that is cut wholesale), not that the packets are dropped; so the result is a context signal that the screens show and that never opens an alert (see countryreach.Combine).
It is an integration of its own and off by default. Off: nothing is downloaded and the results are not shown. Disconnect: also forgets the downloaded lists and the stored results. Only Russia has lists; with another country selected it does nothing.
The lists are refreshed every 6 hours (conditional requests) and kept in memory only; each process downloads them again after a restart when a check is due. The per-node result is stored (country_blocklist_check, 7 days). On the VPS Run drives it, on the Cloudflare edition the cron calls Tick.
Index ¶
Constants ¶
const ( // IPSumURL is the RKN registry summed up to /24 subnets (antifilter.download). IPSumMirrorURL is the same list on // antifilter.network, tried when the main address fails. IPSumURL = "https://antifilter.download/list/ipsum.lst" IPSumMirrorURL = "https://antifilter.network/download/ipsum.lst" // CommunityURL is the addresses the community found cut (about 900 prefixes). CommunityURL = "https://community.antifilter.download/list/community.lst" // CDNURL is the ranges of CDN and hosting providers, "provider,cidr,region" with a header line. Context only. CDNURL = "https://raw.githubusercontent.com/123jjck/cdn-ip-ranges/refs/heads/main/all/all.csv" )
The public lists (plan 2.1). All of them are fetched from the panel with a conditional request and parsed here; a node's address is only ever compared with them in memory and never put into a request.
const ( ListIPSum = "antifilter_ipsum" ListCommunity = "antifilter_community" )
The names of the lists as the screens and the stored results show them.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Store *store.Store
// StepUp is auth.Service.RequireStepUp: changing the settings asks for it.
StepUp func(context.Context) error
// HTTPClient downloads the lists (tests use a fake server's). Default: a client with a 20 s timeout.
HTTPClient *http.Client
// URLs of the lists; zero fields take the defaults.
URLs URLs
// Country is the shared country of the country check (countryreach.Service.Country). Default RU.
Country func(context.Context) string
// Address is a node's IPv4 address: its address, or for a name what the panel resolves it to (health.Service.NodeIPv4).
Address func(context.Context, store.NodeRow) (netip.Addr, bool)
Log *slog.Logger
Now func() time.Time
}
Config configures Service. Store, StepUp and Address are required.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the integration.
func (*Service) Active ¶
Active says whether the source is on and covers the country: the health module shows its results only then. An off source (the default, or any trouble reading the settings) costs one read.
func (*Service) Run ¶
Run is the background loop of the VPS edition. On the Cloudflare edition the cron calls Tick instead; the Worker has no process to keep a loop in.
func (*Service) Tick ¶
Tick runs a check when one is due and reports whether it ran. The VPS loop and the edge cron both call it; it is safe to call often. Nothing happens while the source is off or the country is not Russia: no download, no request of any kind, and whatever lists are held are dropped. A node that has no result yet (or whose result is 6 hours old) makes a check due, so a node added a minute ago is looked up at once without asking the list servers again.