feat: 添加resolve方法解析dns,关闭script规则需要解析IP

This commit is contained in:
Skyxim
2022-06-05 21:06:26 +08:00
parent 9602d42d7d
commit d578ca788c
7 changed files with 101 additions and 15 deletions

27
constant/script.go Normal file
View File

@@ -0,0 +1,27 @@
package constant
type JSRuleMetadata struct {
Type string `json:"type"`
Network string `json:"network"`
Host string `json:"host"`
SrcIP string `json:"srcIP"`
DstIP string `json:"dstIP"`
SrcPort string `json:"srcPort"`
DstPort string `json:"dstPort"`
Uid *int32 `json:"uid"`
Process string `json:"process"`
ProcessPath string `json:"processPath"`
}
type DnsType int
const (
IPv4 = 1 << iota
IPv6
All
)
type JSFunction interface {
//Resolve host to ip by Clash DNS
Resolve(host string, resolveType DnsType) []string
}