|
| 1 | +package spur |
| 2 | + |
| 3 | +type Response struct { |
| 4 | + IP string `json:"ip"` |
| 5 | + Anonymous bool `json:"anonymous"` |
| 6 | + AS AS `json:"as"` |
| 7 | + Assignment Assignment `json:"assignment"` |
| 8 | + DeviceBehaviors DeviceBehaviors `json:"deviceBehaviors"` |
| 9 | + Devices Devices `json:"devices"` |
| 10 | + GeoLite GeoLite `json:"geoLite"` |
| 11 | + GeoPrecision GeoPrecision `json:"geoPrecision"` |
| 12 | + Infrastructure string `json:"infrastructure"` |
| 13 | + ProxiedTraffic ProxiedTraffic `json:"proxiedTraffic"` |
| 14 | + SimilarIPs SimilarIPs `json:"similarIPs"` |
| 15 | + VPNOperators VPNOperators `json:"VPNOperators"` |
| 16 | + WiFi WiFi `json:"wifi"` |
| 17 | +} |
| 18 | + |
| 19 | +func (r Response) IsProxy() bool { |
| 20 | + return r.ProxiedTraffic.Exists |
| 21 | +} |
| 22 | + |
| 23 | +func (r Response) IsVPN() bool { |
| 24 | + return r.VPNOperators.Exists |
| 25 | +} |
| 26 | + |
| 27 | +func (r Response) IsHosting() bool { |
| 28 | + return r.Infrastructure == "DATACENTER" |
| 29 | +} |
| 30 | + |
| 31 | +func (r Response) IsTor() bool { |
| 32 | + for _, v := range r.DeviceBehaviors.Behaviors { |
| 33 | + if v.Name == "TOR_PROXY_USER" { |
| 34 | + return true |
| 35 | + } |
| 36 | + } |
| 37 | + return false |
| 38 | +} |
| 39 | + |
| 40 | +func (r Response) IsMobile() bool { |
| 41 | + return r.Infrastructure == "MOBILE" |
| 42 | +} |
| 43 | + |
| 44 | +func (r Response) IsFileSharing() bool { |
| 45 | + for _, v := range r.DeviceBehaviors.Behaviors { |
| 46 | + if v.Name == "FILE_SHARING" { |
| 47 | + return true |
| 48 | + } |
| 49 | + } |
| 50 | + return false |
| 51 | +} |
| 52 | + |
| 53 | +type AS struct { |
| 54 | + Number int64 `json:"number"` |
| 55 | + Organization string `json:"organization"` |
| 56 | +} |
| 57 | + |
| 58 | +type Assignment struct { |
| 59 | + Exists bool `json:"exists"` |
| 60 | + LastTurnover string `json:"lastTurnover"` |
| 61 | +} |
| 62 | + |
| 63 | +type DeviceBehaviors struct { |
| 64 | + Exists bool `json:"exists"` |
| 65 | + Behaviors []Behavior `json:"behaviors"` |
| 66 | +} |
| 67 | + |
| 68 | +type Behavior struct { |
| 69 | + Name string `json:"name"` |
| 70 | +} |
| 71 | + |
| 72 | +type Devices struct { |
| 73 | + Estimate int64 `json:"estimate"` |
| 74 | +} |
| 75 | + |
| 76 | +type GeoLite struct { |
| 77 | + City string `json:"city"` |
| 78 | + Country string `json:"country"` |
| 79 | + State string `json:"state"` |
| 80 | +} |
| 81 | + |
| 82 | +type GeoPrecision struct { |
| 83 | + Exists bool `json:"exists"` |
| 84 | + City string `json:"city"` |
| 85 | + Country string `json:"country"` |
| 86 | + State string `json:"state"` |
| 87 | + Hash string `json:"hash"` |
| 88 | + Spread string `json:"spread"` |
| 89 | + Point Point `json:"point"` |
| 90 | +} |
| 91 | + |
| 92 | +type Point struct { |
| 93 | + Latitude float64 `json:"latitude"` |
| 94 | + Longitude float64 `json:"longitude"` |
| 95 | + Radius int64 `json:"radius"` |
| 96 | +} |
| 97 | + |
| 98 | +type ProxiedTraffic struct { |
| 99 | + Exists bool `json:"exists"` |
| 100 | + Proxies []Proxy `json:"proxies"` |
| 101 | +} |
| 102 | + |
| 103 | +type Proxy struct { |
| 104 | + Name string `json:"name"` |
| 105 | + Type string `json:"type"` |
| 106 | +} |
| 107 | + |
| 108 | +type SimilarIPs struct { |
| 109 | + Exists bool `json:"exists"` |
| 110 | + IPs []string `json:"ips"` |
| 111 | +} |
| 112 | + |
| 113 | +type VPNOperators struct { |
| 114 | + Exists bool `json:"exists"` |
| 115 | + Operators []Operator `json:"operators"` |
| 116 | +} |
| 117 | + |
| 118 | +type Operator struct { |
| 119 | + Name string `json:"name"` |
| 120 | +} |
| 121 | + |
| 122 | +type WiFi struct { |
| 123 | + Exists bool `json:"exists"` |
| 124 | +} |
0 commit comments