群里有小伙伴询问路由分流的配置文件写法,我来将个人常用的分流配置简单汇总下。我这里只包含outbounds和routing部分,配置文件中的参数不要照抄,请根据自己的实际情况自行替换。
- #分流1
- “outbounds”: [
- {
- “protocol”: “freedom”,
- “settings”: {}
- },
- {
- “tag”: “VPS1”,
- “protocol”: “shadowsocks”,
- “settings”: {
- “servers”: [
- {
- “address”: “8.8.8.8”,
- “method”: “aes-128-gcm”,
- “ota”: false,
- “password”: “passwd”,
- “port”: 7899
- }
- ]
- }
- }
- ],
- “routing”: {
- “rules”: [
- {
- “type”: “field”,
- “outboundTag”: “VPS1”,
- “domain”: [“geosite:netflix”,“geosite:google”,“geosite:youtube”,“geosite:disney”,“geosite:bahamut”]
- }
- ]
- }
- #分流2
- “outbounds”: [
- {
- “protocol”: “freedom”,
- “settings”: {}
- },
- {
- “tag”: “VPS1”,
- “protocol”: “socks”,
- “settings”: {
- “servers”: [
- {
- “address”: “8.8.8.8”,
- “ota”: false,
- “port”: 7899,
- “users”: [
- {
- “user”: “admin”,
- “pass”: “passwd”
- }
- ]
- }
- ]
- }
- }
- ],
- “routing”: {
- “rules”: [
- {
- “type”: “field”,
- “outboundTag”: “VPS1”,
- “domain”: [“geosite:netflix”,“geosite:google”,“geosite:youtube”,“geosite:disney”,“geosite:bahamut”]
- }
- ]
- }
- #任意门
- {
- “port”: 30784,
- “protocol”: “dokodemo-door”,
- “settings”: {
- “address”: “8.8.8.8”,
- “port”: 7899,
- “network”: “tcp,udp”
- }
- }
- #转发
- “outbounds”: [
- {
- “tag”: “VPS1”,
- “protocol”: “shadowsocks”,
- “settings”: {
- “servers”: [
- {
- “address”: “8.8.8.8”,
- “method”: “aes-128-gcm”,
- “ota”: false,
- “password”: “passwd”,
- “port”: 7899
- }
- ]
- }
- }
- ],
- “routing”: {
- “rules”: [ ]
- }
- #转发2
- “outbounds”: [
- {
- “tag”: “VPS1”,
- “protocol”: “socks”,
- “settings”: {
- “servers”: [
- {
- “address”: “8.8.8.8”,
- “ota”: false,
- “port”: 7899,
- “users”: [
- {
- “user”: “admin”,
- “pass”: “passwd”
- }
- ]
- }
- ]
- }
- }
- ],
- “routing”: {
- “rules”: [
- ]
- }
- #IPV4
- “outbounds”: [
- {
- “tag”:“IP4_out”,
- “protocol”: “freedom”,
- “settings”: {
- “domainStrategy”: “UseIPv4”
- }
- }
- ]
- #IPV6
- “outbounds”: [
- {
- “protocol”: “freedom”,
- “settings”: {}
- },
- {
- “tag”:“IP6_out”,
- “protocol”: “freedom”,
- “settings”: {
- “domainStrategy”: “UseIPv6”
- }
- }
- ],
- “routing”: {
- “rules”: [
- {
- “type”: “field”,
- “outboundTag”: “IP6_out”,
- “domain”: [“geosite:netflix”,“geosite:google”,“geosite:youtube”,“geosite:disney”,“geosite:bahamut”]
- }
- ]
- }
- #DNS分流1
- “outbounds”: [
- {
- “protocol”: “freedom”,
- “settings”: {“domainStrategy”: “UseIP”}
- }
- ],
- “routing”: {
- “rules”: [ ]
- },
- “dns”: {
- “servers”: [
- “8.8.8.8”,
- {
- “address”: “11.11.11.11”,
- “port”: 53,
- “domains”: [“geosite:netflix”,“geosite:google”,“geosite:youtube”,“geosite:disney”,“geosite:bahamut”]
- }
- ]
- }
- #屏蔽cn
- “outbounds”: [
- {
- “protocol”: “freedom”,
- “settings”: {},
- “tag”: “direct”
- },
- {
- “protocol”: “blackhole”,
- “settings”: {},
- “tag”: “blocked”
- }
- ],
- “routing”: {
- “domainStrategy”: “IPIfNonMatch”,
- “rules”: [
- {
- “type”: “field”,
- “inboundTag”: [
- “api”
- ],
- “outboundTag”: “api”
- },
- {
- “type”: “field”,
- “outboundTag”: “blocked”,
- “domain”: [
- “geosite:cn”
- ]
- },
- {
- “type”: “field”,
- “outboundTag”: “blocked”,
- “ip”: [
- “geoip:cn”
- ]
- },
- {
- “type”: “field”,
- “outboundTag”: “blocked”,
- “ip”: [
- “geoip:private”
- ]
- },
- {
- “type”: “field”,
- “outboundTag”: “blocked”,
- “protocol”: [
- “bittorrent”
- ]
- }
- ]
- }
- #对外开放 v2ray 的 DNS 服务
- {
- “inbounds”: [
- {
- “tag”: “dns-in”,
- “port”: 53,
- “protocol”: “dokodemo-door”,
- “settings”: {
- “address”: “8.8.8.8”,
- “port”: 53,
- “network”: “tcp,udp”,
- “userLevel”: 1
- }
- }
- ],
- “outbounds”: [
- {
- “protocol”: “dns”,
- “tag”: “dns-out”
- }
- ],
- “routing”: {
- “rules”: [
- {
- “type”: “field”,
- “inboundTag”: [
- “dns-in”
- ],
- “outboundTag”: “dns-out”
- }
- ]
- }
- }