blocklist

package
v0.1.90-dev.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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 New

func New(cfg Config) (*Service, error)

New builds the service.

func (*Service) Active

func (s *Service) Active(ctx context.Context) bool

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) Handler

func (s *Service) Handler(opts ...connect.HandlerOption) (string, http.Handler)

Handler is the admin BlocklistService.

func (*Service) Run

func (s *Service) Run(ctx context.Context)

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

func (s *Service) Tick(ctx context.Context) bool

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.

type URLs

type URLs struct{ IPSum, IPSumMirror, Community, CDN string }

URLs are the addresses of the lists; a zero field takes the default (tests point them at a fake server).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL