chore: add sourceGeoIP and sourceIPASN to metadata

This commit is contained in:
wwqgtxx
2024-08-28 12:25:45 +08:00
parent 8483178524
commit 4fecf68b8b
17 changed files with 211 additions and 211 deletions

11
constant/matcher.go Normal file
View File

@@ -0,0 +1,11 @@
package constant
import "net/netip"
type DomainMatcher interface {
MatchDomain(domain string) bool
}
type IpMatcher interface {
MatchIp(ip netip.Addr) bool
}

View File

@@ -133,7 +133,9 @@ type Metadata struct {
Type Type `json:"type"`
SrcIP netip.Addr `json:"sourceIP"`
DstIP netip.Addr `json:"destinationIP"`
SrcGeoIP []string `json:"sourceGeoIP"` // can be nil if never queried, empty slice if got no result
DstGeoIP []string `json:"destinationGeoIP"` // can be nil if never queried, empty slice if got no result
SrcIPASN string `json:"sourceIPASN"`
DstIPASN string `json:"destinationIPASN"`
SrcPort uint16 `json:"sourcePort,string"` // `,string` is used to compatible with old version json output
DstPort uint16 `json:"destinationPort,string"` // `,string` is used to compatible with old version json output

View File

@@ -27,8 +27,6 @@ const (
ProcessNameRegex
ProcessPathRegex
RuleSet
DomainSet
IpCidrSet
Network
Uid
SubRules
@@ -92,10 +90,6 @@ func (rt RuleType) String() string {
return "Match"
case RuleSet:
return "RuleSet"
case DomainSet:
return "DomainSet"
case IpCidrSet:
return "IpCidrSet"
case Network:
return "Network"
case DSCP: