Skip to content

Commit 966de65

Browse files
committed
Support region specific commands
1 parent c4f7823 commit 966de65

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,15 @@ Glob is supported, such as `R *.google.com`.
148148

149149
Daze also uses a CIDR(Classless Inter-Domain Routing) file to route addresses. The CIDR file is located at "rule.cidr", and has a lower priority than "rule.ls".
150150

151-
By default, daze has configured rule.cidr for China's mainland. You can update it manually via `daze gen cn`, this will pull the latest data from [http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest](http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest).
151+
By default, daze has configured rule.cidr for China's mainland. You can update it manually via `daze gen [regions]`, this will pull the latest data from [http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest](http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest). For example:
152+
153+
```sh
154+
$ daze gen cn # China
155+
$ daze gen hk # Hong Kong Special Administrative Region of China
156+
$ daze gen mo # Macao Special Administrative Region of China
157+
```
158+
159+
The list of all supported regions is shown on the [https://www.apnic.net/about-apnic/corporate-documents/documents/corporate/apnic-service-region/](https://www.apnic.net/about-apnic/corporate-documents/documents/corporate/apnic-service-region/):
152160

153161
## License
154162

cmd/daze/main.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,7 @@ func main() {
232232
flag.PrintDefaults()
233233
}
234234
flag.Parse()
235-
cidr := func() []*net.IPNet {
236-
switch strings.ToUpper(flag.Arg(0)) {
237-
case "CN":
238-
return daze.LoadApnic()["CN"]
239-
}
240-
return []*net.IPNet{}
241-
}()
235+
cidr := daze.LoadApnic()[strings.ToUpper(flag.Arg(0))]
242236
if len(cidr) == 0 {
243237
flag.Usage()
244238
return

res/rule.cidr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6353,6 +6353,8 @@ L 162.4.54.0/23
63536353
L 162.4.136.0/23
63546354
L 162.4.168.0/23
63556355
L 162.4.198.0/23
6356+
L 162.4.202.0/23
6357+
L 162.4.230.0/23
63566358
L 162.14.0.0/16
63576359
L 162.105.0.0/16
63586360
L 163.0.0.0/16
@@ -6405,7 +6407,6 @@ L 163.204.0.0/16
64056407
L 163.223.28.0/23
64066408
L 163.223.32.0/23
64076409
L 163.223.124.0/23
6408-
L 163.223.156.0/23
64096410
L 163.223.173.0/24
64106411
L 163.223.178.0/23
64116412
L 163.223.216.0/23
@@ -8859,7 +8860,6 @@ L 2001:df4:e141::/48
88598860
L 2001:df4:e142::/47
88608861
L 2001:df5:1440::/48
88618862
L 2001:df5:2fc0::/48
8862-
L 2001:df5:44c0::/48
88638863
L 2001:df5:4740::/48
88648864
L 2001:df5:4cc0::/48
88658865
L 2001:df5:5f80::/48
@@ -9553,6 +9553,7 @@ L 2402:5f40::/32
95539553
L 2402:6060::/32
95549554
L 2402:6280::/32
95559555
L 2402:62c0::/32
9556+
L 2402:6320::/32
95569557
L 2402:64c0::/32
95579558
L 2402:66c0::/32
95589559
L 2402:6740::/32

0 commit comments

Comments
 (0)