The ip_set plugin provides a lightweight IP dataset: it loads IP addresses and CIDR ranges from files or inline entries, exposes the compiled networks for other plugins to use, and supports auto-reload on file changes.
This page documents configuration, data formats, usage, and integration patterns.
ips entries.IpNet networks in shared state (Arc<RwLock<Vec<IpNet>>>).ip_set_<name> containing the shared networks for downstream plugins.auto_reload to watch files and atomically replace the dataset on change.# are comments.
192.0.2.0/24, 2001:db8::/32) or a single IP (1.2.3.4, 2001:db8::1).ips: a string or sequence of strings using the same formats as files.Invalid lines are skipped and logged at debug level.
Top-level plugin arguments (YAML) supported by ip_set:
files (string or sequence): paths to one or more files containing IP/CIDR entries.ips (string or sequence): inline IP/CIDR entries.auto_reload (bool): enable file-watcher-based live reloads (default: false).tag / plugin name: used as the dataset name and for the metadata key; if absent the plugin effective name is used.Example configuration (file-backed):
plugins:
- tag: local-ips
type: ip_set
config:
files:
- examples/etc/china-ip-list.txt
auto_reload: true
Example configuration (inline):
plugins:
- tag: test-ips
type: ip_set
config:
ips:
- 1.1.1.1
- 192.168.0.0/16
- 2001:db8::/32
execute() runs, the plugin writes an Arc<RwLock<Vec<IpNet>>> into request metadata under the key ip_set_<name> (for example ip_set_local-ips).Matcher trait: matches_context(ctx) returns true if any IP in the response answers belongs to the dataset.auto_reload is enabled a file watcher invokes a reload callback on changes (with a debounce).networks atomically and logs counts and timing information.plugin.stats() (exposed via the plugin’s API) to get counts for programmatic inspection.auto_reload.ip_set with executor plugins (e.g., ipset) or custom plugins that read ip_set_<name> metadata to materialize or act on matched IPs.[Downloader plugin] -> updates files
|
[ip_set plugin] -> loads networks, sets metadata
|
[ipset plugin] -> reads metadata / response and materializes sets