|
楼主 |
发表于 2020-9-14 13:31
|
显示全部楼层
本帖最后由 T.JOHN 于 2020-9-14 13:38 编辑
网关debian的v2中设置不同的inbounds和outbounds,并且在rules中匹配,这样客户端只需要填写相对应的端口即可实现分流。协议你自己定,http不能代理udp流量。下文10802是美国,10803是新加坡。这样就不需要你所谓的命令行改线路。
inbounds部分
- "inbounds": [
- {
- "tag": "transparent", -- 透明代理的标签
- "port": 10086,
- "protocol": "dokodemo-door", -- 任意门协议
- "settings": {
- "network": "tcp,udp",
- "followRedirect": true
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "streamSettings": {
- "sockopt": {
- "tproxy": "tproxy"
- }
- }
- },
- {
- "tag": "http", -- http代理的标签
- "port": 1080,
- "protocol": "http", -http协议
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
- },
- {
- "tag": "usi", -- socks5美国代理的标签
- "port": 10802,
- "protocol": "socks", -- socks协议
- "settings": {
- "network": "tcp,udp",
- "auth": "noauth"
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
- },
- {
- "tag": "sgi", -- socks5新加坡代理的标签
- "port": 10803,
- "protocol": "socks", -- socks协议
- "settings": {
- "network": "tcp,udp",
- "auth": "noauth"
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
- }
- ]
复制代码
outbounds部分,星号部分取决于你服务器
- "outbounds": [
- {
- "tag": "uso", -- 美国出口的标签
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": "***",
- "port": ***,
- "users": [
- {
- "id": "***",
- "alterId": *
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": "/***"
- },
- "sockopt": {
- "mark": 255
- }
- },
- "mux": {
- "enabled": true
- }
- },
- {
- "tag": "sgo", -- 新加坡出口的标签
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": "***",
- "port": ***,
- "users": [
- {
- "id": "***",
- "alterId": *
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": "/***"
- },
- "sockopt": {
- "mark": 255
- }
- },
- "mux": {
- "enabled": true
- }
- }
- ]
复制代码
dns部分
- "dns": {
- "servers": [
- {
- "address": "114.114.114.114",
- "port": 53,
- "domains": [
- "geosite:cn"
- ],
- "expectIPs": [
- "geoip:cn"
- ]
- },
- {
- "address": "1.1.1.1",
- "port": 53,
- "domains": [
- "geosite:speedtest",
- "geosite:geolocation-!cn"
- ]
- },
- "223.5.5.5",
- "8.8.8.8",
- "localhost"
- ]
- }
复制代码
routing部分,到"geosite:category-ads-all"为止都是优先匹配,比如国内直连,广告屏蔽,劫持dns使用内置。之后就是usi对应uso,sgi对应sgo,互不干扰。
- "routing": {
- "domainStrategy": "IPOnDemand",
- "rules": [
- {
- "type": "field",
- "inboundTag": [
- "transparent",
- "http",
- "usi",
- "sgi"
- ],
- "port": 53,
- "network": "udp",
- "outboundTag": "dns-out"
- },
- {
- "type": "field",
- "inboundTag": [
- "transparent",
- "http",
- "usi",
- "sgi"
- ],
- "port": 123,
- "network": "udp",
- "outboundTag": "direct"
- },
- {
- "type": "field",
- "outboundTag": "direct",
- "ip": [
- "114.114.114.114",
- "223.5.5.5"
- ]
- },
- {
- "type": "field",
- "outboundTag": "jpo",
- "ip": [
- "1.1.1.1",
- "8.8.8.8"
- ]
- },
- {
- "type": "field",
- "outboundTag": "direct",
- "domain": [
- "geosite:cn"
- ]
- },
- {
- "type": "field",
- "ip": [
- "geoip:private",
- "geoip:cn"
- ],
- "outboundTag": "direct"
- },
- {
- "type": "field",
- "protocol": [
- "bittorrent"
- ],
- "outboundTag": "direct"
- },
- {
- "type": "field",
- "outboundTag": "block",
- "domain": [
- "geosite:category-ads-all"
- ]
- },
- {
- "type": "field",
- "outboundTag": "uso",
- "inboundTag": "usi"
- },
- {
- "type": "field",
- "outboundTag": "sgo",
- "inboundTag": "sgi"
- }
- ]
- }
复制代码 |
|