-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathASNResponse.java
More file actions
142 lines (121 loc) · 3.41 KB
/
ASNResponse.java
File metadata and controls
142 lines (121 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package io.ipinfo.api.model;
import com.google.gson.annotations.SerializedName;
import io.ipinfo.api.context.Context;
import java.util.List;
public class ASNResponse {
private final String asn;
private final String name;
private final String country;
private final String allocated;
private final String registry;
private final String domain;
@SerializedName("num_ips")
private final Integer numIps;
private final String type;
private final List<Prefix> prefixes;
private final List<Prefix> prefixes6;
private final List<String> peers;
private final List<String> upstreams;
private final List<String> downstreams;
private transient Context context;
public ASNResponse(
String asn,
String name,
String country,
String allocated,
String registry,
String domain,
Integer numIps,
String type,
List<Prefix> prefixes,
List<Prefix> prefixes6,
List<String> peers,
List<String> upstreams,
List<String> downstreams
) {
this.asn = asn;
this.name = name;
this.country = country;
this.allocated = allocated;
this.registry = registry;
this.domain = domain;
this.numIps = numIps;
this.type = type;
this.prefixes = prefixes;
this.prefixes6 = prefixes6;
this.peers = peers;
this.upstreams = upstreams;
this.downstreams = downstreams;
}
/**
* Set by the library for extra utility functions
*
* @param context for country information
*/
public void setContext(Context context) {
this.context = context;
}
public String getAsn() {
return asn;
}
public String getName() {
return name;
}
public String getCountry() {
return country;
}
public String getCountryCode() {
return country;
}
public String getCountryName() {
return context.getCountryName(getCountryCode());
}
public String getAllocated() {
return allocated;
}
public String getRegistry() {
return registry;
}
public String getDomain() {
return domain;
}
public Integer getNumIps() {
return numIps;
}
public String getType() {
return type;
}
public List<Prefix> getPrefixes() {
return prefixes;
}
public List<Prefix> getPrefixes6() {
return prefixes6;
}
public List<String> getPeers() {
return peers;
}
public List<String> getUpstreams() {
return upstreams;
}
public List<String> getDownstreams() {
return downstreams;
}
@Override
public String toString() {
return "ASNResponse{" +
"asn='" + asn + '\'' +
", name='" + name + '\'' +
", country='" + country + '\'' +
", allocated='" + allocated + '\'' +
", registry='" + registry + '\'' +
", domain='" + domain + '\'' +
", numIps='" + numIps + '\'' +
", type='" + type + '\'' +
", prefixes=" + prefixes +
", prefixes6=" + prefixes6 +
", peers=" + peers +
", upstreams=" + upstreams +
", downstreams=" + downstreams +
'}';
}
}