fix: remove extra and the actual original IDNA domain name is no longer stored, for reduce memory

This commit is contained in:
Skyxim
2022-08-11 21:50:16 +08:00
parent 93ea1248e3
commit 473d0f74bd
7 changed files with 37 additions and 131 deletions

View File

@@ -2,10 +2,6 @@ package common
import (
"errors"
"net/netip"
"strings"
C "github.com/Dreamacro/clash/constant"
)
var (
@@ -15,15 +11,6 @@ var (
)
type Base struct {
ruleExtra *C.RuleExtra
}
func (b *Base) RuleExtra() *C.RuleExtra {
return b.ruleExtra
}
func (b *Base) SetRuleExtra(re *C.RuleExtra) {
b.ruleExtra = re
}
func (b *Base) ShouldFindProcess() bool {
@@ -42,47 +29,3 @@ func HasNoResolve(params []string) bool {
}
return false
}
func FindNetwork(params []string) C.NetWork {
for _, p := range params {
if strings.EqualFold(p, "tcp") {
return C.TCP
} else if strings.EqualFold(p, "udp") {
return C.UDP
}
}
return C.ALLNet
}
func FindSourceIPs(params []string) []*netip.Prefix {
var ips []*netip.Prefix
for _, p := range params {
if p == noResolve || len(p) < 7 {
continue
}
ipnet, err := netip.ParsePrefix(p)
if err != nil {
continue
}
ips = append(ips, &ipnet)
}
if len(ips) > 0 {
return ips
}
return nil
}
func FindProcessName(params []string) []string {
var processNames []string
for _, p := range params {
if strings.HasPrefix(p, "P:") {
processNames = append(processNames, strings.TrimPrefix(p, "P:"))
}
}
if len(processNames) > 0 {
return processNames
}
return nil
}