Add GeoIP and GeoSite support for expr (#38)

* feat: copy something from hysteria/extras/outbounds/acl

* feat: add geoip and geosite support for expr

* refactor: geo matcher

* fix: typo

* refactor: geo matcher

* feat: expose config options to specify local geoip/geosite db files

* refactor: engine.Config should not contains geo

* feat: make geosite and geoip lazy downloaded

* chore: minor code improvement

* docs: add geoip/geosite usage

---------

Co-authored-by: Toby <tobyxdd@gmail.com>
This commit is contained in:
Rinka
2024-01-31 09:30:35 +08:00
committed by GitHub
parent e23f8e06a2
commit f07a38bc47
16 changed files with 1502 additions and 7 deletions

View File

@@ -107,6 +107,14 @@ to [Expr Language Definition](https://expr-lang.org/docs/language-definition).
- name: block google socks
action: block
expr: string(socks?.req?.addr) endsWith "google.com" && socks?.req?.port == 80
- name: block bilibili geosite
action: block
expr: geosite(string(tls?.req?.sni), "bilibili")
- name: block CN geoip
action: block
expr: geoip(string(ip.dst), "cn")
```
#### Supported actions