networkfilter module provides functionality for banning users, ignoring users, and filtering by IP address or country.
NetworkFilter Class
Manages user and IP-based filtering.Attributes
dict
Pending IP ban requests
dict
Pending IP ignore requests
Methods
ban_user()
str
Username to ban
unban_user()
str
Username to unban
is_user_banned()
str
Username to check
bool
True if user is banned
ban_user_ip()
str
Username (IP will be looked up if not provided)
str
IP address to ban directly
str
The banned IP address
is_user_ip_banned()
str
Username to check
str
IP address to check
bool
True if IP is banned
ignore_user()
str
Username to ignore
unignore_user()
str
Username to unignore
is_user_ignored()
str
Username to check
bool
True if user is ignored
IP Address Utilities
get_country_code()
str
IP address to lookup
str
Two-letter country code (e.g., “US”, “GB”, “DE”)
is_ip_address()
str
String to validate
bool
default:true
Whether to accept “0.0.0.0”
bool
default:true
Whether to accept wildcards like “192.168..”
bool
True if valid IP address
Country Codes
TheCOUNTRIES dictionary maps ISO country codes to country names.
IP Wildcards
IP banning and ignoring supports wildcard patterns:192.168.1.*- Matches all IPs in 192.168.1.0/24 subnet10.*.*.*- Matches all IPs in 10.0.0.0/8 subnet172.16.*.5- Matches specific IPs across subnets
Configuration Integration
Filtered users are persisted in the configuration:Changes to ban and ignore lists are automatically persisted to the configuration file.