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

View File

@@ -28,8 +28,11 @@ func (a *ASN) Match(metadata *C.Metadata) (bool, string) {
result := mmdb.ASNInstance().LookupASN(ip.AsSlice())
asnNumber := strconv.FormatUint(uint64(result.AutonomousSystemNumber), 10)
if !a.isSourceIP {
metadata.DstIPASN = asnNumber + " " + result.AutonomousSystemOrganization
ipASN := asnNumber + " " + result.AutonomousSystemOrganization
if a.isSourceIP {
metadata.SrcIPASN = ipASN
} else {
metadata.DstIPASN = ipASN
}
match := a.asn == asnNumber