Custom Rule Guide
Learn how to write custom traffic routing rules in Safewoo VPN.
Rule Format
Each rule is written on a single line with comma-separated fields:
TYPEThe rule type (e.g. DOMAIN-SUFFIX, IP-CIDR)valueThe match target (e.g. google.com, 192.168.0.0/16)ACTIONWhat to do when the rule matchesno-resolve(Optional) Skip DNS resolution — only for IP-based rulesLines starting with # are treated as comments and ignored.
Actions
DIRECTConnect directly without going through the proxyPROXYRoute traffic through the VPN/proxyREJECTBlock the connection entirelyRule Types
Domain Rules
DOMAINExact domain match
DOMAIN,example.com,PROXYDOMAIN-SUFFIXMatches google.com and all subdomains (*.google.com)
DOMAIN-SUFFIX,google.com,PROXYDOMAIN-KEYWORDMatches if domain contains the keyword
DOMAIN-KEYWORD,youtube,PROXYDOMAIN-WILDCARDWildcard pattern matching (* and ?)
DOMAIN-WILDCARD,*.google.*,PROXYDOMAIN-REGEXRegular expression match on the domain
DOMAIN-REGEX,^ad\.,REJECTGEOSITEMatch against the GeoSite database category
GEOSITE,category-ads,REJECTIP Rules
IP rules support the optional no-resolve parameter to skip DNS resolution.
IP-CIDRMatch IPv4 address range
IP-CIDR,192.168.0.0/16,DIRECT,no-resolveIP-CIDR6Match IPv6 address range
IP-CIDR6,fd00::/8,DIRECT,no-resolveGEOIPMatch country code from the GeoIP database
GEOIP,CN,DIRECTIP-ASNMatch Autonomous System Number
IP-ASN,13335,PROXYIP-SUFFIXMatch IP suffix range
IP-SUFFIX,8.8.8.8/24,DIRECTSRC-IP-CIDRMatch source IP range
SRC-IP-CIDR,192.168.1.0/24,DIRECTSRC-GEOIPMatch source IP by country code
SRC-GEOIP,CN,DIRECTPort & Protocol Rules
DST-PORTMatch destination port (single or range like 8000-9000)
DST-PORT,443,PROXYSRC-PORTMatch source port
SRC-PORT,7777,DIRECTNETWORKMatch protocol (tcp or udp)
NETWORK,udp,DIRECTProcess Rules
Process rules may not be available on all platforms.
PROCESS-NAMEMatch by process name
PROCESS-NAME,telegram,PROXYPROCESS-PATHMatch by full process path
PROCESS-PATH,/usr/bin/curl,PROXYExamples
Here are some common use cases:
Route a website through the proxy
Route all traffic to openai.com and its subdomains through the proxy.
DOMAIN-SUFFIX,openai.com,PROXY
Block ads from a domain
Block all connections to ads.example.com.
DOMAIN-SUFFIX,ads.example.com,REJECT
Direct connection to a local service
Connect directly to addresses in the 10.x.x.x range without DNS resolution.
IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
Route a specific app through proxy
Route all Telegram traffic through the proxy (desktop only).
PROCESS-NAME,telegram,PROXY
Block connections to a keyword
Block all domains containing "tracker".
DOMAIN-KEYWORD,tracker,REJECT
Multiple rules together
Combine multiple rules with comments for clarity.
# Route streaming through proxy DOMAIN-SUFFIX,netflix.com,PROXY DOMAIN-SUFFIX,youtube.com,PROXY # Block ads DOMAIN-KEYWORD,adserver,REJECT DOMAIN-SUFFIX,doubleclick.net,REJECT # Local network direct IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
Important Notes
- •Rules are evaluated in order from top to bottom. The first matching rule wins.
- •A catch-all rule (MATCH,PROXY) is automatically added at the end — you do not need to add it.
- •Custom rules are stored locally on your device only and will not sync across devices.
- •After saving, the proxy engine will restart briefly to apply the changes.
- •Lines starting with # are comments and will be ignored.