Skip to content

Commit cee8a0b

Browse files
authored
Merge pull request #73 from rbarrielabrystech/feat/plus-anonymous-extended-fields
feat: add missing PlusAnonymous fields and fix PlusMobile
2 parents 2054372 + d068586 commit cee8a0b

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

example/lookup-plus/main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ func main() {
4040
info.Mobile.Name, info.Mobile.MCC, info.Mobile.MNC)
4141
}
4242
if info.Anonymous != nil {
43-
fmt.Printf("Anonymous - Proxy: %v, Relay: %v, Tor: %v, VPN: %v\n",
44-
info.Anonymous.IsProxy, info.Anonymous.IsRelay, info.Anonymous.IsTor, info.Anonymous.IsVPN)
43+
fmt.Printf("Anonymous - Proxy: %v, Relay: %v, Tor: %v, VPN: %v, ResProxy: %v\n",
44+
info.Anonymous.IsProxy, info.Anonymous.IsRelay, info.Anonymous.IsTor,
45+
info.Anonymous.IsVPN, info.Anonymous.IsResProxy)
46+
if info.Anonymous.Name != "" {
47+
fmt.Printf("Anonymous Service: %s (last seen: %s, %d%% of days)\n",
48+
info.Anonymous.Name, info.Anonymous.LastSeen, info.Anonymous.PercentDaysSeen)
49+
}
4550
}
4651
fmt.Printf("Anonymous: %v\n", info.IsAnonymous)
4752
fmt.Printf("Anycast: %v\n", info.IsAnycast)

ipinfo/plus.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,18 @@ type PlusMobile struct {
9898

9999
// PlusAnonymous represents the anonymous object in Plus API response.
100100
type PlusAnonymous struct {
101-
IsProxy bool `json:"is_proxy"`
102-
IsRelay bool `json:"is_relay"`
103-
IsTor bool `json:"is_tor"`
104-
IsVPN bool `json:"is_vpn"`
105-
Name string `json:"name,omitempty"`
101+
IsProxy bool `json:"is_proxy"`
102+
IsRelay bool `json:"is_relay"`
103+
IsTor bool `json:"is_tor"`
104+
IsVPN bool `json:"is_vpn"`
105+
IsResProxy bool `json:"is_res_proxy"`
106+
Name string `json:"name,omitempty"`
107+
LastSeen string `json:"last_seen,omitempty"`
108+
109+
// PercentDaysSeen is the percentage of days the IP was seen using an
110+
// anonymous service over the trailing 90 days. Higher values indicate
111+
// more persistent anonymiser usage.
112+
PercentDaysSeen int `json:"percent_days_seen"`
106113
}
107114

108115
// PlusAbuse represents the abuse object in Plus API response.

0 commit comments

Comments
 (0)