This repository has been archived by the owner on Oct 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
/
device.go
252 lines (222 loc) · 6.13 KB
/
device.go
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
package adcom1
import "encoding/json"
// Device object provides information pertaining to the device through which the user is interacting.
// Device information includes its hardware, platform, location, and carrier data.
// The device can refer to a mobile handset, a desktop computer, set top box, or other digital device.
type Device struct {
// Attribute:
// type
// Type:
// integer
// Definition:
// The general type of device.
// Refer to List: Device Types.
Type DeviceType `json:"type,omitempty"`
// Attribute:
// ua
// Type:
// string
// Definition:
// Browser user agent string.
UA string `json:"ua,omitempty"`
// Attribute:
// sua
// Type:
// string
// Definition:
// Structured user agent information defined by a Object: UserAgent.
// If both `ua` and `sua` are present in the bid request, `sua` should be considered the more accurate representation of the device attributes.
// This is because the `ua` may contain a frozen or reduced UserAgent string.
SUA *UserAgent `json:"sua,omitempty"`
// Attribute:
// ifa
// Type:
// string
// Definition:
// ID sanctioned for advertiser use in the clear (i.e., not hashed).
IFA string `json:"ifa,omitempty"`
// Attribute:
// dnt
// Type:
// integer
// Definition:
// Standard “Do Not Track” flag as set in the header by the browser, where 0 = tracking is unrestricted, 1 = do not track.
DNT int8 `json:"dnt,omitempty"`
// Attribute:
// lmt
// Type:
// integer
// Definition:
// “Limit Ad Tracking” signal commercially endorsed (e.g., iOS, Android), where 0 = tracking is unrestricted, 1 = tracking must be limited per commercial guidelines.
Lmt int8 `json:"lmt,omitempty"`
// Attribute:
// make
// Type:
// string
// Definition:
// Device make (e.g., "Apple").
Make string `json:"make,omitempty"`
// Attribute:
// model
// Type:
// string
// Definition:
// Device model (e.g., “iPhone10,1” when the specific device model is known, “iPhone” otherwise).
// The value obtained from the device O/S should be used when available.
Model string `json:"model,omitempty"`
// Attribute:
// os
// Type:
// integer
// Definition:
// Device operating system.
// Refer to List: Operating Systems.
OS OperatingSystem `json:"os,omitempty"`
// Attribute:
// osv
// Type:
// string
// Definition:
// Device operating system version (e.g., “3.1.2”).
OSV string `json:"osv,omitempty"`
// Attribute:
// hwv
// Type:
// string
// Definition:
// Hardware version of the device (e.g., “5S” for iPhone 5S).
HWV string `json:"hwv,omitempty"`
// Attribute:
// h
// Type:
// integer
// Definition:
// Physical height of the screen in pixels.
H int64 `json:"h,omitempty"`
// Attribute:
// w
// Type:
// integer
// Definition:
// Physical width of the screen in pixels.
W int64 `json:"w,omitempty"`
// Attribute:
// ppi
// Type:
// integer
// Definition:
// Screen size as pixels per linear inch.
PPI int64 `json:"ppi,omitempty"`
// Attribute:
// pxratio
// Type:
// float
// Definition:
// The ratio of physical pixels to device independent pixels.
PxRatio float64 `json:"pxratio,omitempty"`
// Attribute:
// js
// Type:
// integer
// Definition:
// Support for JavaScript, where 0 = no, 1 = yes.
JS int8 `json:"js,omitempty"`
// Attribute:
// lang
// Type:
// string
// Definition:
// Browser language using ISO-639-1-alpha-2.
Lang string `json:"lang,omitempty"`
// Attribute:
// langb
// Type:
// string
// Definition:
// Browser language using IETF BCP 47.
// Only one of lang or langb should be present.
LangB string `json:"langb,omitempty"`
// Attribute:
// ip
// Type:
// string
// Definition:
// IPv4 address closest to device.
IP string `json:"ip,omitempty"`
// Attribute:
// ipv6
// Type:
// string
// Definition:
// IP address closest to device as IPv6.
IPv6 string `json:"ipv6,omitempty"`
// Attribute:
// xff
// Type:
// string
// Definition:
// The value of the “x-forwarded-for” header.
XFF string `json:"xff,omitempty"`
// Attribute:
// iptr
// Type:
// integer
// Definition:
// Indicator of truncation of any of the IP attributes (i.e., ip, ipv6, xff), where 0 = no, 1 = yes (e.g., from 1.2.3.4 to 1.2.3.0).
// Refer to https://tools.ietf.org/html/rfc6235#section-4.1.1 for more information on IP truncation.
IPTr int8 `json:"iptr,omitempty"`
// Attribute:
// carrier
// Type:
// string
// Definition:
// Carrier or ISP (e.g., “VERIZON”) using exchange curated string names which should be published to bidders a priori.
Carrier string `json:"carrier,omitempty"`
// Attribute:
// mccmnc
// Type:
// string
// Definition:
// Mobile carrier as the concatenated MCC-MNC code (e.g., “310-005” identifies Verizon Wireless CDMA in the USA).
// Refer to https://en.wikipedia.org/wiki/Mobile_country_code for further information and references.
// Note that the dash between the MCC and MNC parts is required to remove parsing ambiguity.
MCCMNC string `json:"mccmnc,omitempty"`
// Attribute:
// mccmncsim
// Type:
// string
// Definition:
// MCC and MNC of the SIM card using the same format as mccmnc.
// When both values are available, a difference between them reveals that a user is roaming.
MCCMNCSIM string `json:"mccmncsim,omitempty"`
// Attribute:
// contype
// Type:
// integer
// Definition:
// Network connection type.
// Refer to List: Connection Types.
ConType ConnectionType `json:"contype,omitempty"`
// Attribute:
// geofetch
// Type:
// integer
// Definition:
// Indicates if the geolocation API will be available to JavaScript code running in display ad, where 0 = no, 1 = yes.
GeoFetch int8 `json:"geofetch,omitempty"`
// Attribute:
// geo
// Type:
// object
// Definition:
// Location of the device (i.e., typically the user's current location).
// Refer to Object: Geo.
Geo *Geo `json:"geo,omitempty"`
// Attribute:
// ext
// Type:
// object
// Definition:
// Optional vendor-specific extensions.
Ext json.RawMessage `json:"ext,omitempty"`
}