Documentation
¶
Index ¶
- Constants
- Variables
- func PrepareDomain(domain string) (list []string)
- func WithContext(ctx context.Context, cli *Client) context.Context
- type App
- type Browser
- type Carrier
- type Client
- type Device
- type DeviceType
- type Extension
- type Geo
- type OS
- type Request
- type Response
- type Site
- type Transport
- type User
Constants ¶
View Source
const UndefinedCountryCode = "**"
UndefinedCountryCode 2 chars
Variables ¶
View Source
var DeviceDefault = Device{Browser: &BrowserDefault, OS: &OSDefault}
DeviceDefault value
View Source
var GeoDefault = Geo{Country: UndefinedCountryCode, Carrier: &CarrierDefault}
GeoDefault value
Functions ¶
Types ¶
type App ¶
type App struct {
ExtID string `json:"eid,omitempty"` // External ID
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords about the site.
Cat []string `json:"cat,omitempty"` // Array of categories
Bundle string `json:"bundle,omitempty"` // App bundle or package name
StoreURL string `json:"storeurl,omitempty"` // App store URL for an installed app
Ver string `json:"ver,omitempty"` // App version
Paid int `json:"paid,omitempty"` // "1": Paid, "2": Free
PrivacyPolicy int `json:"pivacypolicy,omitempty"` // Default: 1 ("1": has a privacy policy)
}
App information
var AppDefault App
AppDefault object
type Browser ¶
type Browser struct {
ID uint64 `json:"id,omitempty"` // Internal system ID
Name string `json:"name,omitempty"` //
Version string `json:"ver,omitempty"` //
DNT int8 `json:"dnt,omitempty"` // "1": Do not track
LMT int8 `json:"lmt,omitempty"` // "1": Limit Ad Tracking
AdBlock int8 `json:"ab,omitempty"` // "1": AdBlock is ON
PrivateBrowsing int8 `json:"pb,omitempty"` // "1": Private Browsing mode ON
IsRobot int8 `json:"rb,omitempty"`
JS int8 `json:"js,omitempty"` //
UA string `json:"ua,omitempty"` // User agent
Ref string `json:"r,omitempty"` // Referer
Languages []string `json:"langs,omitempty"` //
PrimaryLanguage string `json:"lang,omitempty"` // Browser language (en-US)
FlashVer string `json:"flver,omitempty"` // Flash version
Width int `json:"w,omitempty"` // Window in pixels
Height int `json:"h,omitempty"` // Window in pixels
Extensions []Extension `json:"extensions,omitempty"`
}
Browser base information structure
var BrowserDefault Browser
BrowserDefault value
type Carrier ¶
type Carrier struct {
ID uint `json:"id,omitempty"` // Internal carrier ID
Name string `json:"name,omitempty"` //
Code string `json:"carrier,omitempty"` //
}
Carrier base information structure
var CarrierDefault Carrier
CarrierDefault value
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implementation fordata requests
func FromContext ¶
FromContext returns client from context
type Device ¶
type Device struct {
ID uint `json:"id,omitempty"` // Device ID
Make string `json:"make,omitempty"` // Device make
Model string `json:"model,omitempty"` // Device model
OS *OS `json:"os,omitempty"` // Device OS
Browser *Browser `json:"browser,omitempty"` // Device OS version
ConnType int `json:"connectiontype,omitempty"` //
DeviceType DeviceType `json:"devicetype,omitempty"` //
IFA string `json:"ifa,omitempty"` // Native identifier for advertisers
Height int `json:"h,omitempty"` // Physical height of the screen in pixels.
Width int `json:"w,omitempty"` // Physical width of the screen in pixels.
PPI int `json:"ppi,omitempty"` // Screen size as pixels per linear inch.
PxRatio float64 `json:"pxratio,omitempty"` // The ratio of physical pixels to device independent pixels.
HwVer string `json:"hwv,omitempty"` // Hardware version of the device (e.g., "5S" for iPhone 5S).
}
Device base information structure
type DeviceType ¶
type DeviceType int
DeviceType object declaration
const ( DeviceTypeUnknown DeviceType = 0 DeviceTypeMobile DeviceType = 1 DeviceTypePC DeviceType = 2 DeviceTypeTV DeviceType = 3 DeviceTypePhone DeviceType = 4 DeviceTypeTablet DeviceType = 5 DeviceTypeConnected DeviceType = 6 DeviceTypeSetTopBox DeviceType = 7 DeviceTypeWatch DeviceType = 8 DeviceTypeGlasses DeviceType = 9 DeviceTypeOOH DeviceType = 10 )
RTB 5.17 Device Type
type Geo ¶
type Geo struct {
ID uint `json:"id,omitempty"` // Internal geo ID
IP net.IP `json:"ip,omitempty"` // IPv4/6
Carrier *Carrier `json:"carrier,omitempty"` // Carrier or ISP derived from the IP address
Lat float64 `json:"lat,omitempty"` // Latitude from -90 to 90
Lon float64 `json:"lon,omitempty"` // Longitude from -180 to 180
Country string `json:"country,omitempty"` // Country using ISO 3166-1 Alpha 2
Region string `json:"region,omitempty"` // Region using ISO 3166-2
RegionFIPS104 string `json:"regionFIPS104,omitempty"` // Region of a country using FIPS 10-4
Metro string `json:"metro,omitempty"` //
City string `json:"city,omitempty"` //
ZIP string `json:"zip,omitempty"` //
UTCOffset int `json:"utcoffset,omitempty"` // Local time as the number +/- of minutes from UTC
}
Geo base information structure
type OS ¶
type OS struct {
ID uint `json:"id"` // Internal system ID
Name string `json:"name,omitempty"`
Version string `json:"ver,omitempty"`
}
OS base information structure
var OSDefault OS
OSDefault value
type Request ¶
type Request struct {
UDID string `json:"udid,omitempty"` // Advertisement Device ID (IDFA, AAID), Identifier for Advertising (IFA)
UID uuid.UUID `json:"uid,omitempty"`
SessID uuid.UUID `json:"sessid,omitempty"`
IP string `json:"ip,omitempty"`
UA string `json:"ua,omitempty"`
URL string `json:"url,omitempty"`
Ref string `json:"r,omitempty"` // Referer
DNT int8 `json:"dnt,omitempty"` // "1": Do not track
LMT int8 `json:"lmt,omitempty"` // "1": Limit Ad Tracking
AdBlock int8 `json:"ab,omitempty"` // "1": AdBlock is ON
PrivateBrowsing int8 `json:"pb,omitempty"` // "1": Private Browsing mode ON
JS int8 `json:"js,omitempty"` //
Languages []string `json:"langs,omitempty"` //
PrimaryLanguage string `json:"lang,omitempty"` // Browser language (en-US)
FlashVer string `json:"flver,omitempty"` // Flash version
Width int `json:"w,omitempty"` // Window in pixels
Height int `json:"h,omitempty"` // Window in pixels
Extensions []Extension `json:"extensions,omitempty"`
}
Request object
type Response ¶
type Response struct {
User *User `json:"user"`
Device *Device `json:"device"`
Geo *Geo `json:"geo"`
}
Response object
type Site ¶
type Site struct {
ExtID string `json:"eid,omitempty"` // External ID
Domain string `json:"domain,omitempty"` //
Cat []string `json:"cat,omitempty"` // Array of categories
PrivacyPolicy int `json:"pivacypolicy,omitempty"` // Default: 1 ("1": has a privacy policy)
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords about the site.
Page string `json:"page,omitempty"` // URL of the page
Referrer string `json:"ref,omitempty"` // Referrer URL
Search string `json:"search,omitempty"` // Search string that caused naviation
Mobile int `json:"mobile,omitempty"` // Mobile ("1": site is mobile optimised)
}
Site information
var SiteDefault Site
SiteDefault info
type Transport ¶
type Transport interface {
io.Closer
Detect(ctx context.Context, req *protocol.Request) (*protocol.Response, error)
}
Transport interface defenition
type User ¶
type User struct {
UUID uuid.UUID `json:"uuid"`
SessionID string `json:"sessid"`
FingerPrintID string `json:"fpid,omitempty"`
ETag string `json:"etag,omitempty"`
AgeStart int `json:"age_start,omitempty"` // Year of birth from
AgeEnd int `json:"age_end,omitempty"` // Year of birth to
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords, interests, or intent
Interests map[string]float64 `json:"interests,omitempty"` //
Sex map[int]float64 `json:"sex,omitempty"` // 0 – undefined, 1 – man, 2 – woman
}
User object info
Source Files
¶
Click to show internal directories.
Click to hide internal directories.