Skip to content

Commit e134bf2

Browse files
committed
use lowercase
1 parent d1d5ff0 commit e134bf2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

modules/hostmatcher/hostmatcher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const MatchBuiltinLoopback = "loopback"
3535
func ParseHostMatchList(hostList string) *HostMatchList {
3636
hl := &HostMatchList{}
3737
for _, s := range strings.Split(hostList, ",") {
38-
s = strings.TrimSpace(s)
38+
s = strings.ToLower(strings.TrimSpace(s))
3939
if s == "" {
4040
continue
4141
}
@@ -52,6 +52,7 @@ func ParseHostMatchList(hostList string) *HostMatchList {
5252
// MatchesHostOrIP checks if the host or IP matches an allow/deny(block) list
5353
func (hl *HostMatchList) MatchesHostOrIP(host string, ip net.IP) bool {
5454
var matched bool
55+
host = strings.ToLower(host)
5556
ipStr := ip.String()
5657
loop:
5758
for _, hostInList := range hl.hosts {

modules/hostmatcher/hostmatcher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestHostOrIPMatchesList(t *testing.T) {
2020

2121
// for IPv6: "::1" is loopback, "fd00::/8" is private
2222

23-
hl := ParseHostMatchList("private, external, *.mydomain.com, 169.254.1.0/24")
23+
hl := ParseHostMatchList("private, External, *.myDomain.com, 169.254.1.0/24")
2424
cases := []tc{
2525
{"", net.IPv4zero, false},
2626
{"", net.IPv6zero, false},

0 commit comments

Comments
 (0)