Routing Rules¶
Priority¶
Rules will be matched in order from top to bottom, with the rules at the top having higher priority than those below.
If the request is for UDP and the proxy node does not support UDP (for example, if the ss
node does not have udp: true
specified), it will continue to match downwards.
DOMAIN¶
Matches the full domain name.
DOMAIN-SUFFIX¶
Matches the domain suffix.
For example, google.com
matches www.google.com
, mail.google.com
, and google.com
, but does not match content-google.com
.
DOMAIN-KEYWORD¶
Matches using domain keywords.
DOMAIN-REGEX¶
Matches using regular expressions for domain names.
GEOSITE¶
Matches domains within a Geosite; some content is referenced from v2fly/domain-list-community.
IP-CIDR & IP-CIDR6¶
Matches IP address ranges; IP-CIDR
and IP-CIDR6
have the same effect, with IP-CIDR6
being an alias.
IP-SUFFIX¶
Matches IP suffix ranges.
IP-ASN¶
Matches the ASN of the IP.
GEOIP¶
Matches the country code of the IP.
SRC-GEOIP¶
Matches the country code of the source IP.
SRC-IP-ASN¶
Matches the ASN of the source IP.
SRC-IP-CIDR¶
Matches the source IP address range.
SRC-IP-SUFFIX¶
Matches the source IP suffix range.
DST-PORT¶
Matches the target port range of the request.
SRC-PORT¶
Matches the source port range of the request.
IN-PORT¶
Matches the inbound port, allowing for port ranges.
IN-TYPE¶
Matches the inbound type.
IN-USER¶
Matches the inbound username, supporting multiple usernames separated by /
.
IN-NAME¶
Matches the inbound name.
PROCESS-PATH¶
Matches using the full process path.
PROCESS-PATH-REGEX¶
Matches using regular expressions for the process path.
PROCESS-NAME¶
Matches using the process name; on the Android
platform, it can match package names.
PROCESS-NAME-REGEX¶
Matches using regular expressions for the process name; on the Android
platform, it can match package names.
UID¶
Matches the Linux USER ID.
NETWORK¶
Matches tcp
or udp
.
DSCP¶
Matches the DSCP
tag (only for tproxy UDP inbound).
RULE-SET¶
References a set of rules; configuration for rule-providers is required.
AND & OR & NOT¶
LOGIC_TYPE,((payload1),(payload2)),Proxy
payload1 and payload2 are rule types and other payloads, such as DOMAIN,google.com
.
Logical rules require careful use of parentheses.
SUB-RULE¶
Matches to sub-rules; careful use of parentheses is required.
MATCH¶
Matches all requests without conditions.
Additional Parameters¶
no-resolve¶
Only supports rules regarding the target IP
.
When domain matching begins for target IP
rules, mihomo will trigger DNS resolution to check if the domain's target IP
matches the rules. The no-resolve
option can be selected to skip DNS resolution.
If DNS resolution was triggered in an earlier match, it will still match rules regarding target IP
that have the no-resolve
option added.
src¶
Only supports rules regarding the target IP
.
Converts target IP
matching to source IP
matching.