Merge branch 'MetaCubeX:Alpha' into Alpha

This commit is contained in:
xxnuo 2024-01-07 21:01:31 +08:00 committed by GitHub
commit 6c2b938e4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 2 deletions

View file

@ -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
}

View file

@ -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()

View file

@ -72,11 +72,10 @@ func main() {
currentDir, _ := os.Getwd()
configFile = filepath.Join(currentDir, configFile)
}
C.SetConfig(configFile)
} else {
configFile = filepath.Join(C.Path.HomeDir(), C.Path.Config())
C.SetConfig(configFile)
}
C.SetConfig(configFile)
if geodataMode {
C.GeodataMode = true

View file

@ -217,6 +217,13 @@ func (logic *Logic) parsePayload(payload string, parseRule ParseRuleFunc) error
return err
}
if rule.ShouldResolveIP() {
logic.needIP = true
}
if rule.ShouldFindProcess() {
logic.needProcess = true
}
rules = append(rules, rule)
}