Skip to content

Commit

Permalink
fix sniffer and sub-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejohnson7 committed Nov 8, 2023
1 parent 8af07e7 commit 5fdce18
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 26 deletions.
25 changes: 23 additions & 2 deletions docs/config/rules/sub-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,32 @@

## SUB-RULE

匹配到规则时,将请求送往另一规则流程,括号内可以使用任意规则
匹配到规则时,将请求送往另一规则流程,括号内可以使用任意规则。
如果在 sub-rule 内没匹配到,则会退回常规规则流程

```yaml
rules:
- SUB-RULE,(NETWORK,UDP),rule1
```
[流程示例](../sub-rules.md)
### 流程示例
假设配置文件如下:
```yaml
sub-rules:
rule1:
- DOMAIN-SUFFIX,google.com,ss1
- DOMAIN-SUFFIX,baidu.com,DIRECT
sub-rule2:
- IP-CIDR,1.1.1.1/32,REJECT
- IP-CIDR,8.8.8.8/32,ss1
- DOMAIN,dns.alidns.com,REJECT
rules:
- SUB-RULE,(NETWORK,TCP),rule1
- SUB-RULE,(NETWORK,UDP),sub-rule2
- MATCH,DIRECT
```
- 一个 google 的 tcp 请求,匹配到rule1,并匹配到其中的第一条规则,走ss1出站
- 一个 youtube 的 quic 请求,匹配到 rule2 ,但是没匹配到 rule2 内的规则,则回退常规流程,匹配到 match
33 changes: 32 additions & 1 deletion docs/config/sniff/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,35 @@ sniffer:
- Mijia Cloud
```
### enbale
## 字段解释
### enable
是否启用sniffer
### force-dns-mapping
对 redir-host 类型识别的流量进行强制嗅探
### parse-pure-ip
对所有未获取到域名的流量进行强制嗅探
### override-destination
是否使用嗅探结果作为实际访问,默认为 true
### sniff
一个数组,里面可以包含多个协议对象。每种协议对象包含:
- `ports`字段,表示端口范围。示例:`ports: [80, 8080-8880]`
- `override-destination`字段(可选),用于覆盖全局`override-destination`设置

### force-domain

需要强制嗅探的域名(默认情况下只对IP进行嗅探)

### skip-domain

需要跳过嗅探的域名。主要解决部分站点sni字段非域名,导致嗅探结果异常的问题,如米家设备`Mijia Cloud`
22 changes: 0 additions & 22 deletions docs/config/sub-rules.md

This file was deleted.

1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ nav:
- 规则集合: config/rules/rule-provider.md
- 子规则: config/rules/sub-rule.md
- 最终匹配: config/rules/match.md
- 子规则: config/sub-rules.md
- 流量隧道: config/tunnels.md
- NTP: config/ntp/index.md
- 实验性: config/experimental.md
Expand Down

0 comments on commit 5fdce18

Please sign in to comment.