Skip to content

Commit

Permalink
add new isp fields mobile_country_code and mobile_network_code
Browse files Browse the repository at this point in the history
  • Loading branch information
IncSW committed Jan 27, 2022
1 parent 2d2cad6 commit 20d12fe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion anonymous_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func readAnonymousIPMap(result *AnonymousIP, buffer []byte, mapSize uint, offset
return 0, err
}
default:
return 0, errors.New("unknown isp key: " + string(key))
return 0, errors.New("unknown anonymous ip key: " + string(key))
}
}
return offset, nil
Expand Down
2 changes: 1 addition & 1 deletion asn.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func readASNMap(result *ASN, buffer []byte, mapSize uint, offset uint) (uint, er
return 0, err
}
default:
return 0, errors.New("unknown isp key: " + string(key))
return 0, errors.New("unknown asn key: " + string(key))
}
}
return offset, nil
Expand Down
10 changes: 10 additions & 0 deletions isp.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ func readISPMap(result *ISP, buffer []byte, mapSize uint, offset uint) (uint, er
if err != nil {
return 0, err
}
case "mobile_country_code":
result.MobileCountryCode, offset, err = readString(buffer, offset)
if err != nil {
return 0, err
}
case "mobile_network_code":
result.MobileNetworkCode, offset, err = readString(buffer, offset)
if err != nil {
return 0, err
}
default:
return 0, errors.New("unknown isp key: " + string(key))
}
Expand Down
10 changes: 10 additions & 0 deletions traits.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ func readTraitsMap(traits *Traits, buffer []byte, mapSize uint, offset uint) (ui
if err != nil {
return 0, err
}
case "mobile_country_code":
traits.MobileCountryCode, offset, err = readString(buffer, offset)
if err != nil {
return 0, err
}
case "mobile_network_code":
traits.MobileNetworkCode, offset, err = readString(buffer, offset)
if err != nil {
return 0, err
}
default:
return 0, errors.New("unknown traits key: " + string(key))
}
Expand Down
4 changes: 4 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ type Traits struct {
AutonomousSystemOrganization string // Enterprise
AutonomousSystemNumber uint32 // Enterprise
IsLegitimateProxy bool // Enterprise
MobileCountryCode string // Enterprise
MobileNetworkCode string // Enterprise
IsAnonymousProxy bool
IsSatelliteProvider bool
}
Expand Down Expand Up @@ -101,6 +103,8 @@ type ISP struct {
AutonomousSystemOrganization string
ISP string
Organization string
MobileCountryCode string
MobileNetworkCode string
}

type ConnectionType struct {
Expand Down

0 comments on commit 20d12fe

Please sign in to comment.