Skip to content

Commit 46afafd

Browse files
committed
chore: update flake
1 parent de9aab7 commit 46afafd

File tree

3 files changed

+49
-35
lines changed

3 files changed

+49
-35
lines changed

docs/user-guide/examples.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ Route traffic differently based on the domain or IP address.
3434
# Block ads
3535
[[policy.overrides]]
3636
name = "block ads"
37-
match = { domain = "ads.example.com" }
37+
match = { domain = ["ads.example.com"] }
3838
block = true
3939

4040
# Bypass DPI for specific blocked site
4141
[[policy.overrides]]
4242
name = "unblock site"
43-
match = { domain = "blocked-site.com" }
43+
match = { domain = ["blocked-site.com"] }
4444
https = { fake-count = 7, disorder = true }
4545

4646
# Use local network directly (no processing)
4747
[[policy.overrides]]
4848
name = "local bypass"
49-
match = { cidr = "192.168.0.0/16", port = "all" }
49+
match = { addr = [{ cidr = "192.168.0.0/16", port = "all" }] }
5050
https = { skip = true }
5151
```
5252

docs/user-guide/policy.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,19 @@ The `[policy]` section contains an array of `overrides` tables. Each override ru
7272

7373
### Match Criteria (`match`)
7474

75-
You must specify either a `domain` or a `cidr` (with `port`).
75+
You can specify a `domain` list or an `addr` list (containing `cidr` and `port`).
7676

7777
| Field | Type | Description |
7878
| :------- | :----- | :-------------------------------------------------------------------------- |
79-
| `domain` | String | Domain pattern. Supports wildcards (`*`, `**`). |
80-
| `cidr` | String | IP range in CIDR notation (e.g., `192.168.0.0/24`). Requires `port` to be set. |
81-
| `port` | String | Port or port range (e.g., `80`, `80-443`, `all`). Required if `cidr` is used. |
79+
| `domain` | Array | List of domain patterns. Supports wildcards (`*`, `**`). |
80+
| `addr` | Array | List of address rules. Each rule requires `cidr` and `port`. |
81+
82+
#### Address Rule (`addr`)
83+
84+
| Field | Type | Description |
85+
| :----- | :----- | :-------------------------------------------------------------------------- |
86+
| `cidr` | String | IP range in CIDR notation (e.g., `192.168.0.0/24`). |
87+
| `port` | String | Port or port range (e.g., `80`, `80-443`, `all`). |
8288

8389
### DNS Override (`dns`)
8490

@@ -113,20 +119,20 @@ Customize how HTTPS connections are established. The available fields mirror the
113119
[[policy.overrides]]
114120
name = "allow youtube"
115121
priority = 50
116-
match = { domain = "*.youtube.com" }
122+
match = { domain = ["*.youtube.com"] }
117123
https = { disorder = true, fake-count = 7 }
118124

119125
# Example B: Bypass DPI for local network traffic (Standard Connection)
120126
[[policy.overrides]]
121127
name = "skip local"
122128
priority = 51
123-
match = { cidr = "192.168.0.0/24", port = "all" }
129+
match = { addr = [{ cidr = "192.168.0.0/24", port = "all" }] }
124130
https = { skip = true }
125131

126132
# Example C: Block a specific domain
127133
[[policy.overrides]]
128134
name = "block ads"
129135
priority = 100
130-
match = { domain = "ads.example.com" }
136+
match = { domain = ["ads.example.com"] }
131137
block = true
132138
```

flake.nix

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,38 @@
66
flake-utils.url = "github:numtide/flake-utils";
77
};
88

9-
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (
10-
system: let
11-
pkgs = nixpkgs.legacyPackages.${system};
12-
in {
13-
packages.default = pkgs.buildGoModule {
14-
pname = "spoofdpi";
15-
version = "dev";
16-
src = self;
17-
vendorHash = "sha256-WqIAE5j3pqyGg5fdA75h9r40QB/lLQO7lgJyI3P7Jgk=";
18-
subPackages = [ "cmd/spoofdpi" ];
19-
buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libpcap ];
20-
env.CGO_ENABLED = if pkgs.stdenv.isLinux then "0" else "1";
21-
ldflags = [
22-
"-s"
23-
"-w"
24-
"-X main.build=flake"
25-
"-X main.commit=${self.shortRev or "dirty"}"
26-
];
27-
meta = {
28-
description = "Simple and fast anti-censorship tool written in Go";
29-
homepage = "https://github.com/xvzc/SpoofDPI";
30-
license = pkgs.lib.licenses.asl20;
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
17+
let
18+
pkgs = nixpkgs.legacyPackages.${system};
19+
in
20+
{
21+
packages.default = pkgs.buildGoModule {
22+
pname = "spoofdpi";
23+
version = "dev";
24+
src = self;
25+
vendorHash = "sha256-FcepbOIB3CvHmTPiGWXukPg41uueQQYdZeVKmzjRuwA=";
26+
subPackages = [ "cmd/spoofdpi" ];
27+
buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libpcap ];
28+
env.CGO_ENABLED = if pkgs.stdenv.isLinux then "0" else "1";
29+
ldflags = [
30+
"-s"
31+
"-w"
32+
"-X main.build=flake"
33+
"-X main.commit=${self.shortRev or "dirty"}"
34+
];
35+
meta = {
36+
description = "Simple and fast anti-censorship tool written in Go";
37+
homepage = "https://github.com/xvzc/SpoofDPI";
38+
license = pkgs.lib.licenses.asl20;
39+
};
3140
};
32-
};
33-
}
34-
);
41+
}
42+
);
3543
}

0 commit comments

Comments
 (0)