1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
| routing { ### 以下是预设规则
# 本地的网络管理器应该直连,以避免在绑定WAN接口的时候出现错误的网络连通性检查结果 pname(NetworkManager) -> direct
# 把它放在前面,可以防止多播应该发送到局域网的数据包被代理转发。 # "dip" 意思是目的IP. dip(224.0.0.0/3, 'ff00::/8') -> direct
# 该设置允许你直接访问私有地址而不是通过代理,如果你想访问代理主机的私有网络地址,可以修改下面配置 dip(geoip:private) -> direct
### 以下是自定义规则 # 内置出站:block, direct, must_rules # must_rules表示不将DNS流量重定向到dae并继续匹配 # must_direct和must_my_groupName 表示不会将DNS流量重定向到dae,不会继续匹配 # 对于单个规则,direct会劫持并处理DNS请求(用于流量分割),而must_direct不会 # 如果存在DNS请求循环时,must_direct很有用 # "must_direct" 可以写成 "direct(must)". # 同样,“must_groupname”也支持不劫持和处理 DNS 流量, # 相当于“groupname(must)”。groupname指的是出站分组 # 如果没有任何规则匹配,默认的出站分组 fallback: my_group ## 域名规则 # 后缀匹配 domain(suffix: v2raya.org) -> my_group # 全匹配,两种写法 # equals to domain(v2raya.org) -> my_group domain(full: dns.google.com) -> my_group # 关键字匹配 domain(keyword: facebook) -> my_group # 正则匹配 domain(regex: '\.goo.*\.com$') -> my_group # geosite匹配 domain(geosite:category-ads) -> block domain(geosite:cn) -> direct # 组合规则 domain(keyword: google, suffix: www.twitter.com, suffix: v2raya.org) -> my_group ## 目的IP规则 # 单个IP匹配 dip(8.8.8.8) -> direct # 单个IP段匹配 dip(101.97.0.0/16) -> direct # geoip匹配 dip(geoip:private) -> direct # 多目的IP规则 dip(geoip:cn, geoip:private) -> direct dip(9.9.9.9, 223.5.5.5) -> direct ## 源IP规则 sip(192.168.0.0/24) -> my_group sip(192.168.50.0/24) -> direct # 多源IP规则 sip(192.168.0.6, 192.168.0.10, 192.168.0.15) -> direct # ip规则 ip(geoip:cn) -> direct
## 目的端口规则 # 单个端口 dport(80) -> direct # 端口范围 dport(80) -> direct # 端口范围 dport(10080-30000) -> direct ## 源端口规则 # 单个端口 sport(38563) -> direct # 端口范围 sport(10080-30000) -> direct ## 四层协议规则: # tcp l4proto(tcp) -> my_group # udp l4proto(udp) -> direct ## IP版本规则: # IPv4 ipversion(4) -> block # IPv6 ipversion(6) -> ipv6_group ## 源MAC规则 mac('02:42:ac:11:00:02') -> direct ## 进程名规则 (当绑定WAN接口是只支持本地进程) pname(curl) -> direct ## DSCP规则 (匹配 DSCP; 对于绕过BT有用). # See https://github.com/daeuniverse/dae/discussions/295 dscp(0x4) -> direct ## "且"规则 dip(geoip:cn) && dport(80) -> direct dip(8.8.8.8) && l4proto(tcp) && dport(1-1023, 8443) -> my_group dip(1.1.1.1) && sip(10.0.0.1, 172.20.0.0/16) -> direct ## “非“规则 # 下面代表,域名不是geosite类型为google-scholar或者category-scholar-!cn或者category-scholar-cn !domain(geosite:google-scholar, geosite:category-scholar-!cn, geosite:category-scholar-cn ) -> my_group ## 更复杂的规则,我觉得少用 domain(geosite:geolocation-!cn) && !domain(geosite:google-scholar, geosite:category-scholar-!cn, geosite:category-scholar-cn ) -> my_group ## 自定义 DAT 文件 domain(ext:"yourdatfile.dat:yourtag")->direct dip(ext:"yourdatfile.dat:yourtag")->direct ## 设置 fwmark(Firewall Mark) # 当您想要将流量重定向到特定接口(例如wireguard)或用于其他高级用途时,标记非常有用 # 以下是将Disney的流量重定向到wg0接口的过程 # You need set ip rule and ip table like this: # 1. Set all traffic with mark 0x800/0x800 to use route table 1145: # >> ip rule add fwmark 0x800/0x800 table 1145 # >> ip -6 rule add fwmark 0x800/0x800 table 1145 # 2. Set default route of route table 1145: # >> ip route add default dev wg0 scope global table 1145 # >> ip -6 route add default dev wg0 scope global table 1145 # Notice that interface wg0, mark 0x800, table 1145 can be set by preferences, but cannot conflict. # 3. Set routing rules in dae config file. domain(geosite:disney) -> direct(mark: 0x800) ## Must rules # 对于以下规则,DNS请求将会被强制重定向到dae,除了mosdns的请求 # 不同于must_direct/must_my_group,来自mosdns的流量会继续匹配其他规则 pname(mosdns) -> must_rules ip(geoip:cn) -> direct domain(geosite:cn) -> direct fallback: my_group }
|