mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 00:43:15 +08:00
fix: resolve IPv6 rule-set issue #959.
This commit is contained in:
parent
4af94df142
commit
6bc915526f
@ -185,6 +185,10 @@ func addIpv6Cidr(trie *IpCidrTrie, ip net.IP, groupSize int) {
|
||||
}
|
||||
|
||||
for i := 2; i < groupSize; i += 2 {
|
||||
if ip[i] == 0 && ip[i+1] == 0 {
|
||||
node.Mark = true
|
||||
}
|
||||
|
||||
if node.Mark {
|
||||
return
|
||||
}
|
||||
|
@ -74,6 +74,14 @@ func TestIpv6AddFail(t *testing.T) {
|
||||
assert.IsType(t, new(net.ParseError), err)
|
||||
}
|
||||
|
||||
func TestIpv6SearchSub(t *testing.T) {
|
||||
trie := NewIpCidrTrie()
|
||||
assert.NoError(t, trie.AddIpCidrForString("240e::/18"))
|
||||
|
||||
assert.Equal(t, true, trie.IsContainForString("240e:964:ea02:100:1800::71"))
|
||||
|
||||
}
|
||||
|
||||
func TestIpv6Search(t *testing.T) {
|
||||
trie := NewIpCidrTrie()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user