Skip to content

Commit

Permalink
Merge branch 'main' into fix_domain_matching_underline
Browse files Browse the repository at this point in the history
  • Loading branch information
mzz2017 authored Dec 31, 2023
2 parents d4ae009 + cab1e42 commit 9d5ea11
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions docs/en/configuration/separate-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Separate Configuration Files

Sometimes you want to break your configuration file into several files. It may be useful in the following cases:

1. You want to switch nodes via modify the config file using tools like `sed`.
2. You copy other's configuration file and you want to overwrite some parts of it.

## Example

Directory Structure:

```sh
# tree /etc/dae
/etc/dae
├── config.d
│ ├── dns.dae
│ ├── node.dae
│ └── route.dae
└── config.dae
```

Config files:

```jsonc
# config.dae

# load all dae files placed in ./config.d/
include {
config.d/*.dae
}
global {
tproxy_port: 12345
log_level: warn
tcp_check_url: 'http://cp.cloudflare.com'
udp_check_dns: 'dns.google.com:53'
check_interval: 600s
check_tolerance: 50ms
#lan_interface: eth0
wan_interface: eth0
allow_insecure: false
dial_mode: domain
disable_waiting_network: false
auto_config_kernel_parameter: true
sniffing_timeout: 100ms
}
```
```jsonc
# dns.dae
dns {
upstream {
alidns: 'udp://dns.alidns.com:53'
googledns: 'tcp+udp://dns.google.com:53'
}
routing {
request {
qname(geosite:category-ads) -> reject
qname(geosite:category-ads-all) -> reject
fallback: alidns
}
response {
upstream(googledns) -> accept
!qname(geosite:cn) && ip(geoip:private) -> googledns
fallback: accept
}
}
}
```
```jsonc
# node.dae
node {
node1: 'xxx'
node2: 'xxx'
}
subscription {
my_sub: 'https://www.example.com/subscription/link'
}
group {
my_group {
filter: subtag(my_sub) && !name(keyword: 'ExpireAt:')
policy: min_moving_avg
}
local_group {
filter: name(node1, node2)
policy: fixed(0)
}
}
```
```jsonc
# route.dae
routing {
pname(NetworkManager) -> direct
dip(224.0.0.0/3, 'ff00::/8') -> direct
dip(geoip:private) -> direct
dip(1.14.5.14) -> direct
domain(geosite:openai) -> local_group
dip(geoip:cn) -> direct
domain(geosite:cn) -> direct
domain(geosite:category-scholar-cn) -> direct
domain(geosite:geolocation-cn) -> direct
fallback: my_group
}
```
Then run `dae` via:
```sh
dae run -c /etc/dae/config.dae
```

0 comments on commit 9d5ea11

Please sign in to comment.