github.com/igoogolx/clash@v1.19.8/docs/zh_CN/premium/rule-providers.md (about)

     1  ---
     2  sidebarTitle: "功能: Rule Providers 规则集"
     3  sidebarOrder: 4
     4  ---
     5  
     6  # Rule Providers 规则集
     7  
     8  Rule Providers 规则集和 [Proxy Providers 代理集](/zh_CN/configuration/outbound#proxy-providers-代理集) 基本相同. 它允许用户从外部源加载规则, 从而使配置更加简洁. 该功能目前仅适用于 Clash Premium 内核.
     9  
    10  要定义 Rule Providers 规则集, 请将 `rule-providers` 规则集字段添加到主配置中:
    11  
    12  ```yaml
    13  rule-providers:
    14    apple:
    15      behavior: "domain" # domain, ipcidr or classical (仅限 Clash Premium 内核)
    16      type: http
    17      url: "url"
    18      # format: 'yaml' # or 'text'
    19      interval: 3600
    20      path: ./apple.yaml
    21    microsoft:
    22      behavior: "domain"
    23      type: file
    24      path: /microsoft.yaml
    25  
    26  rules:
    27    - RULE-SET,apple,REJECT
    28    - RULE-SET,microsoft,policy
    29  ```
    30  
    31  有三种行为类型可用:
    32  
    33  ## `domain`
    34  
    35  yaml:
    36  
    37  ```yaml
    38  payload:
    39    - '.blogger.com'
    40    - '*.*.microsoft.com'
    41    - 'books.itunes.apple.com'
    42  ```
    43  
    44  text:
    45  
    46  ```txt
    47  # comment
    48  .blogger.com
    49  *.*.microsoft.com
    50  books.itunes.apple.com
    51  ```
    52  
    53  ## `ipcidr`
    54  
    55  yaml
    56  
    57  ```yaml
    58  payload:
    59    - '192.168.1.0/24'
    60    - '10.0.0.0.1/32'
    61  ```
    62  
    63  text:
    64  
    65  ```txt
    66  # comment
    67  192.168.1.0/24
    68  10.0.0.0.1/32
    69  ```
    70  
    71  ## `classical`
    72  
    73  yaml:
    74  
    75  ```yaml
    76  payload:
    77    - DOMAIN-SUFFIX,google.com
    78    - DOMAIN-KEYWORD,google
    79    - DOMAIN,ad.com
    80    - SRC-IP-CIDR,192.168.1.201/32
    81    - IP-CIDR,127.0.0.0/8
    82    - GEOIP,CN
    83    - DST-PORT,80
    84    - SRC-PORT,7777
    85    # MATCH 在这里并不是必须的
    86  ```
    87  
    88  text:
    89  
    90  ```txt
    91  # comment
    92  DOMAIN-SUFFIX,google.com
    93  DOMAIN-KEYWORD,google
    94  DOMAIN,ad.com
    95  SRC-IP-CIDR,192.168.1.201/32
    96  IP-CIDR,127.0.0.0/8
    97  GEOIP,CN
    98  DST-PORT,80
    99  SRC-PORT,7777
   100  ```