Skip to content

Commit

Permalink
documentation: Add rule set
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 29, 2023
1 parent 017ef2e commit 45d466c
Show file tree
Hide file tree
Showing 20 changed files with 980 additions and 358 deletions.
32 changes: 30 additions & 2 deletions docs/configuration/dns/rule.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
---
icon: material/alert-decagram
---

!!! quote "Changes in sing-box 1.8.0"

:material-plus: [rule_set](#rule_set)
:material-delete-clock: [geoip](#geoip)
:material-delete-clock: [geosite](#geosite)

### Structure

```json
Expand Down Expand Up @@ -85,6 +95,10 @@
"wifi_bssid": [
"00:00:00:00:00:00"
],
"rule_set": [
"geoip-cn",
"geosite-cn"
],
"invert": false,
"outbound": [
"direct"
Expand Down Expand Up @@ -166,15 +180,23 @@ Match domain using regular expression.

#### geosite

!!! failure "Deprecated in sing-box 1.8.0"

Geosite is deprecated and may be removed in the future, check [Migration](/migration/#migrate-geosite-to-rule-set).

Match geosite.

#### source_geoip

!!! failure "Deprecated in sing-box 1.8.0"

GeoIP is deprecated and may be removed in the future, check [Migration](/migration/#migrate-geoip-to-rule-set).

Match source geoip.

#### source_ip_cidr

Match source ip cidr.
Match source IP CIDR.

#### source_port

Expand Down Expand Up @@ -250,6 +272,12 @@ Match WiFi SSID.

Match WiFi BSSID.

#### rule_set

!!! question "Since sing-box 1.8.0"

Match [Rule Set](/configuration/route/#rule_set).

#### invert

Invert match result.
Expand Down Expand Up @@ -286,4 +314,4 @@ Rewrite TTL in DNS responses.

#### rules

Included default rules.
Included rules.
32 changes: 30 additions & 2 deletions docs/configuration/dns/rule.zh.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
---
icon: material/alert-decagram
---

!!! quote "sing-box 1.8.0 中的更改"

:material-plus: [rule_set](#rule_set)
:material-delete-clock: [geoip](#geoip)
:material-delete-clock: [geosite](#geosite)

### 结构

```json
Expand Down Expand Up @@ -84,6 +94,10 @@
"wifi_bssid": [
"00:00:00:00:00:00"
],
"rule_set": [
"geoip-cn",
"geosite-cn"
],
"invert": false,
"outbound": [
"direct"
Expand Down Expand Up @@ -163,10 +177,18 @@ DNS 查询类型。值可以为整数或者类型名称字符串。

#### geosite

匹配 GeoSite。
!!! failure "已在 sing-box 1.8.0 废弃"

Geosite 已废弃且可能在不久的将来移除,参阅 [迁移指南](/migration/#migrate-geosite-to-rule-set)。

匹配 Geosite。

#### source_geoip

!!! failure "已在 sing-box 1.8.0 废弃"

GeoIp 已废弃且可能在不久的将来移除,参阅 [迁移指南](/migration/#migrate-geoip-to-rule-set)。

匹配源 GeoIP。

#### source_ip_cidr
Expand Down Expand Up @@ -245,6 +267,12 @@ DNS 查询类型。值可以为整数或者类型名称字符串。

匹配 WiFi BSSID。

#### rule_set

!!! question "自 sing-box 1.8.0 起"

匹配[规则集](/zh/configuration/route/#rule_set)

#### invert

反选匹配结果。
Expand Down Expand Up @@ -281,4 +309,4 @@ DNS 查询类型。值可以为整数或者类型名称字符串。

#### rules

包括的默认规则
包括的规则
34 changes: 34 additions & 0 deletions docs/configuration/experimental/cache-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
icon: material/new-box
---

!!! question "Since sing-box 1.8.0"

### Structure

```json
{
"enabled": true,
"path": "",
"cache_id": "",
"store_fakeip": false
}
```

### Fields

#### enabled

Enable cache file.

#### path

Path to the cache file.

`cache.db` will be used if empty.

#### cache_id

Identifier in cache file.

If not empty, configuration specified data will use a separate store keyed by it.
121 changes: 121 additions & 0 deletions docs/configuration/experimental/clash-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
icon: material/alert-decagram
---

!!! quote "Changes in sing-box 1.8.0"

:material-delete-alert: [store_mode](#store_mode)
:material-delete-alert: [store_selected](#store_selected)
:material-delete-alert: [store_fakeip](#store_fakeip)
:material-delete-alert: [cache_file](#cache_file)
:material-delete-alert: [cache_id](#cache_id)


!!! quote ""

Clash API is not included by default, see [Installation](./#installation).

### Structure

```json
{
"external_controller": "127.0.0.1:9090",
"external_ui": "",
"external_ui_download_url": "",
"external_ui_download_detour": "",
"secret": "",
"default_mode": "",

// Deprecated

"store_mode": false,
"store_selected": false,
"store_fakeip": false,
"cache_file": "",
"cache_id": ""
}
```

### Fields

#### external_controller

RESTful web API listening address. Clash API will be disabled if empty.

#### external_ui

A relative path to the configuration directory or an absolute path to a
directory in which you put some static web resource. sing-box will then
serve it at `http://{{external-controller}}/ui`.



#### external_ui_download_url

ZIP download URL for the external UI, will be used if the specified `external_ui` directory is empty.

`https://github.com/MetaCubeX/Yacd-meta/archive/gh-pages.zip` will be used if empty.

#### external_ui_download_detour

The tag of the outbound to download the external UI.

Default outbound will be used if empty.

#### secret

Secret for the RESTful API (optional)
Authenticate by spedifying HTTP header `Authorization: Bearer ${secret}`
ALWAYS set a secret if RESTful API is listening on 0.0.0.0

#### default_mode

Default mode in clash, `Rule` will be used if empty.

This setting has no direct effect, but can be used in routing and DNS rules via the `clash_mode` rule item.

#### store_mode

!!! failure "Deprecated in sing-box 1.8.0"

`store_mode` is deprecated in Clash API and enabled by default if `cache_file.enabled`.

Store Clash mode in cache file.

#### store_selected

!!! failure "Deprecated in sing-box 1.8.0"

`store_selected` is deprecated in Clash API and enabled by default if `cache_file.enabled`.

!!! note ""

The tag must be set for target outbounds.

Store selected outbound for the `Selector` outbound in cache file.

#### store_fakeip

!!! failure "Deprecated in sing-box 1.8.0"

`store_selected` is deprecated in Clash API and migrated to `cache_file.store_fakeip`.

Store fakeip in cache file.

#### cache_file

!!! failure "Deprecated in sing-box 1.8.0"

`cache_file` is deprecated in Clash API and migrated to `cache_file.enabled` and `cache_file.path`.

Cache file path, `cache.db` will be used if empty.

#### cache_id

!!! failure "Deprecated in sing-box 1.8.0"

`cache_id` is deprecated in Clash API and migrated to `cache_file.cache_id`.

Identifier in cache file.

If not empty, configuration specified data will use a separate store keyed by it.
Loading

0 comments on commit 45d466c

Please sign in to comment.