Skip to content

Commit

Permalink
fix CIDR config
Browse files Browse the repository at this point in the history
  • Loading branch information
LEXUGE committed Sep 20, 2022
1 parent 92f5f29 commit 6d3d406
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions configs/success_cidr.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
verbosity: "off"
verbosity: "info"
address: 0.0.0.0:2053
script: |
pub async fn route(upstreams, inited, ctx, query) {
let resp = upstreams.send_default("domestic", query).await?;
for ans in resp.answer? {
match ans.rtype.to_str() {
"A" if !inited.cidr.0.contains(ans.to_a()?.ip, "CN") => { return upstreams.send_default("secure", query).await; }
"AAAA" if !inited.cidr.0.contains(ans.to_aaaa()?.ip, "CN") => { return upstreams.send_default("secure", query).await; }
"A" if !inited.cidr.0.contains(ans.to_a()?.ip) => { return upstreams.send_default("secure", query).await; }
"AAAA" if !inited.cidr.0.contains(ans.to_aaaa()?.ip) => { return upstreams.send_default("secure", query).await; }
_ => continue,
}
}
Ok(resp)
}
pub async fn init() {
Expand Down

0 comments on commit 6d3d406

Please sign in to comment.