Skip to content

Commit c6f560d

Browse files
committed
use "*" instead of "all", improve comments
1 parent 4156a74 commit c6f560d

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,7 @@ PATH =
13971397
;DELIVER_TIMEOUT = 5
13981398
;;
13991399
;; Webhook can only call allowed hosts for security reasons. Comma separated list, eg: external, 192.168.1.0/24, *.mydomain.com
1400-
;; Built-in: loopback (for localhost), private (for LAN/intranet), external (for public hosts on internet), all (for all hosts)
1400+
;; Built-in: loopback (for localhost), private (for LAN/intranet), external (for public hosts on internet), * (for all hosts)
14011401
;; CIDR list: 1.2.3.0/8, 2001:db8::/32
14021402
;; Wildcard hosts: *.mydomain.com, 192.168.100.*
14031403
; ALLOWED_HOST_LIST = external

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
586586
- `loopback`: 127.0.0.0/8 for IPv4 and ::1/128 for IPv6, localhost is included.
587587
- `private`: RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and RFC 4193 (FC00::/7). Also called LAN/Intranet.
588588
- `external`: A valid non-private unicast IP, you can access all hosts on public internet.
589-
- `all`: All hosts are allowed.
589+
- `*`: All hosts are allowed.
590590
- CIDR list: `1.2.3.0/8` for IPv4 and `2001:db8::/32` for IPv6
591591
- Wildcard hosts: `*.mydomain.com`, `192.168.100.*`
592592
- `SKIP_TLS_VERIFY`: **false**: Allow insecure certification.

modules/hostmatcher/hostmatcher.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import (
1212
"code.gitea.io/gitea/modules/util"
1313
)
1414

15-
// HostMatchList is used to check if a host or ip is in a list
15+
// HostMatchList is used to check if a host or IP is in a list.
16+
// If you only need to do wildcard matching, consider to use modules/matchlist
1617
type HostMatchList struct {
1718
hosts []string
1819
ipNets []*net.IPNet
1920
}
2021

2122
// MatchBuiltinAll all hosts are matched
22-
const MatchBuiltinAll = "all"
23+
const MatchBuiltinAll = "*"
2324

2425
// MatchBuiltinExternal A valid non-private unicast IP, all hosts on public internet are matched
2526
const MatchBuiltinExternal = "external"

modules/hostmatcher/hostmatcher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func TestHostOrIPMatchesList(t *testing.T) {
9999
assert.Equalf(t, c.expected, hl.MatchesHostOrIP(c.host, c.ip), "case %s(%v)", c.host, c.ip)
100100
}
101101

102-
hl = ParseHostMatchList("all")
102+
hl = ParseHostMatchList("*")
103103
cases = []tc{
104104
{"", net.IPv4zero, true},
105105
{"", net.ParseIP("127.0.0.1"), true},

0 commit comments

Comments
 (0)