docs: README

This commit is contained in:
mzz2017
2023-01-30 18:13:43 +08:00
parent 74676aca69
commit f3c651daf7
4 changed files with 86 additions and 28 deletions

View File

@ -31,4 +31,6 @@ See [example.dae](https://github.com/v2rayA/dae/blob/main/example.dae).
1. DisableL4Checksum by link.
1. Handle the case that nodes do not support UDP.
1. L4Checksum problem.
1. Config support list like: `wan_interface: [wlp5s0, eth0]`.
1. Fix problem that node address cannot be domain.
1. ...

View File

@ -241,7 +241,7 @@ func (o *DatReaderOptimizer) Optimize(rules []*config_parser.RoutingRule) ([]*co
params, err = o.loadGeoSite("geosite", param.Val)
case "geoip":
params, err = o.loadGeoIp("geoip", param.Val)
case "dat":
case "ext":
fields := strings.SplitN(param.Val, ":", 2)
switch f.Name {
case consts.Function_Domain:

View File

@ -8,11 +8,16 @@ global {
# Now only support UDP and IP:Port.
# Please make sure DNS traffic will go through and be forwarded by dae.
# The request to dns upstream follows routing defined below.
dns_upstream: '1.1.1.1:53'
# The ingress (LAN) interface to bind.
# The LAN interface to bind.
# Use it if you only want to proxy LAN instead of localhost.
# Now only support one interface.
lan_interface: docker0
# lan_interface: docker0
# The WAN interface to bind.
# Use it if you only want to proxy localhost.
wan_interface: wlp5s0
}
@ -24,13 +29,14 @@ subscription {
node {
# Add your node links here.
# Support socks5, http, https, ss, ssr, vmess, vless, trojan, trojan-go
'socks5://localhost:1080'
'ss://LINK'
}
group {
my_group {
# Pass node links as input of lua script filter.
filter: name(keyword: HK)
filter: name(keyword: HK, keyword: SH)
# Randomly select a node from the group for every connection.
# policy: random
@ -38,33 +44,11 @@ group {
# Select the first node from the group for every connection.
policy: fixed(0)
}
disney {
# Pass node names as input of keyword/regex filter.
filter: name(regex:'HK|SG|TW', keyword:'JP') && !name(keyword:'GCP')
# Select the node with min average of the last 10 latencies from the group for every connection.
policy: min_avg10
}
netflix {
# Pass node names as input of keyword filter.
filter: name(keyword:AWS)
# Select the node with min last latency from the group for every connection.
policy: min
}
}
routing {
#ip(geoip:private)->direct
!port(80) -> my_group
sport(123) -> direct
sip(192.168.0.0/24) && !sip(192.168.0.252/30) -> direct
domain(geosite:category-ads) -> block
l4proto(udp) && mac('02:42:ac:11:00:03') -> my_group
domain(geosite:disney) -> disney
domain(geosite:netflix) -> netflix
# See routing.md for full examples.
ip(geoip:cn) -> direct
domain(geosite:cn) -> direct
final: my_group

72
routing.md Normal file
View File

@ -0,0 +1,72 @@
# routing
## Examples:
```shell
# Built-in outbounds: block, direct
# If no rule matches, traffic will go through the outbound defined by final.
final: my_group
# Domain rule
domain(suffix: v2raya.org) -> my_group
# equals to domain(v2raya.org) -> my_group
domain(full: dns.google) -> my_group
domain(keyword: facebook) -> my_group
domain(regexp: '\.goo.*\.com$') -> my_group
domain(geosite:category-ads) -> block
domain(geosite:cn)->direct
# Dest IP rule
ip(8.8.8.8) -> direct
ip(101.97.0.0/16) -> direct
ip(geoip:private) -> direct
# Source IP rule
sip(192.168.0.0/24) -> my_group
sip(192.168.50.0/24) -> direct
# Dest port rule
port(80) -> direct
port(10080-30000) -> direct
# Source port rule
sport(38563) -> direct
sport(10080-30000) -> direct
# Source MAC rule
mac('02:42:ac:11:00:02') -> direct
# Level 4 protocol rule:
l4proto(tcp) -> my_group
l4proto(udp) -> direct
# IP version rule:
ipversion(4) -> block
ipversion(6) -> ipv6_group
# Multiple domains rule
domain(keyword: google, suffix: www.twitter.com, suffix: v2raya.org) -> my_group
# Multiple IP rule
ip(geoip:cn, geoip:private) -> direct
ip(9.9.9.9, 223.5.5.5) -> direct
sip(192.168.0.6, 192.168.0.10, 192.168.0.15) -> direct
# 'And' rule
ip(geoip:cn) && port(80) -> direct
ip(8.8.8.8) && l4proto(tcp) && port(1-1023, 8443) -> my_group
ip(1.1.1.1) && sip(10.0.0.1, 172.20.0.0/16) -> direct
# 'Not' rule
!domain(geosite:google-scholar,
geosite:category-scholar-!cn,
geosite:category-scholar-cn
) -> my_group
# Little more complex rule
domain(geosite:geolocation-!cn) &&
!domain(geosite:google-scholar,
geosite:category-scholar-!cn,
geosite:category-scholar-cn
) -> my_group
```