mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: domain-set wildcard match
This commit is contained in:
parent
e1af1abcc2
commit
d8db25ee89
@ -105,7 +105,7 @@ func (ss *DomainSet) Has(key string) bool {
|
||||
}
|
||||
}
|
||||
for ; ; nextBmIdx++ {
|
||||
if ss.labels[nextBmIdx-nextNodeId] == domainStepByte {
|
||||
if nextBmIdx-nextNodeId < len(ss.labels) && ss.labels[nextBmIdx-nextNodeId] == domainStepByte {
|
||||
bmIdx = nextBmIdx
|
||||
nodeId = nextNodeId
|
||||
i = j
|
||||
|
@ -65,6 +65,7 @@ func TestDomainSetWildcard(t *testing.T) {
|
||||
"stun.*.*",
|
||||
"*.*.qq.com",
|
||||
"test.*.baidu.com",
|
||||
"*.apple.com",
|
||||
}
|
||||
|
||||
for _, domain := range domainSet {
|
||||
@ -78,6 +79,7 @@ func TestDomainSetWildcard(t *testing.T) {
|
||||
assert.True(t, set.Has("stun.ab.cd"))
|
||||
assert.False(t, set.Has("test.baidu.com"))
|
||||
assert.False(t, set.Has("www.google.com"))
|
||||
assert.False(t, set.Has("a.www.google.com"))
|
||||
assert.False(t, set.Has("test.qq.com"))
|
||||
assert.False(t, set.Has("test.test.test.qq.com"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user