pbs

package
v0.0.0-...-0a9f55e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_BIDDERS = 8

Variables

This section is empty.

Functions

func GetUIDs

func GetUIDs(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func InitUsersyncHandlers

func InitUsersyncHandlers(router *httprouter.Router, metricsRegistry metrics.Registry, cdomain string,
	xternal_url string, captcha_secret string)

split this for testability

func OptOut

func SetUID

func SetUIDCookie

func SetUIDCookie(w http.ResponseWriter, pc *PBSCookie)

func VerifyRecaptcha

func VerifyRecaptcha(response string) error

Types

type AdUnit

type AdUnit struct {
	Code     string           `json:"code"`
	TopFrame int8             `json:"is_top_frame"`
	Sizes    []openrtb.Format `json:"sizes"`
	Bids     []Bids           `json:"bids"`
	ConfigID string           `json:"config_id"`
}

type BidderDebug

type BidderDebug struct {
	RequestURI   string `json:"request_uri,omitempty"`
	RequestBody  string `json:"request_body,omitempty"`
	ResponseBody string `json:"response_body,omitempty"`
	StatusCode   int    `json:"status_code,omitempty"`
}

type Bids

type Bids struct {
	BidderCode string          `json:"bidder"`
	BidID      string          `json:"bid_id"`
	Params     json.RawMessage `json:"params"`
}

func ConfigGet

func ConfigGet(cache cache.Cache, id string) ([]Bids, error)

type ConfigCache

type ConfigCache interface {
	LoadConfig(string) ([]Bids, error)
}

type PBSAdUnit

type PBSAdUnit struct {
	Sizes    []openrtb.Format
	TopFrame int8
	Code     string
	BidID    string
	Params   json.RawMessage
}

type PBSBid

type PBSBid struct {
	BidID       string  `json:"bid_id"`
	AdUnitCode  string  `json:"code"`
	Creative_id string  `json:"creative_id,omitempty"`
	BidderCode  string  `json:"bidder"`
	BidHash     string  `json:"-"` // this is the hash of the bidder's unique bid identifier for blockchain. Should not be sent to browser.
	Price       float64 `json:"price"`
	Currency    string  `json:"currency,omitempty"`
	NURL        string  `json:"nurl,omitempty"`
	Adm         string  `json:"adm,omitempty"`
	Width       uint64  `json:"width,omitempty"`
	Height      uint64  `json:"height,omitempty"`
	DealId      string  `json:"deal_id,omitempty"`
	CacheID     string  `json:"cache_id,omitempty"`
}

type PBSBidSlice

type PBSBidSlice []*PBSBid

func (PBSBidSlice) Len

func (bids PBSBidSlice) Len() int

Implement sort.Interface

func (PBSBidSlice) Less

func (bids PBSBidSlice) Less(i, j int) bool

func (PBSBidSlice) Swap

func (bids PBSBidSlice) Swap(i, j int)

type PBSBidder

type PBSBidder struct {
	BidderCode   string         `json:"bidder"`
	AdUnitCode   string         `json:"ad_unit,omitempty"` // for index to dedup responses
	ResponseTime int            `json:"response_time_ms,omitempty"`
	NumBids      int            `json:"num_bids,omitempty"`
	Error        string         `json:"error,omitempty"`
	NoCookie     bool           `json:"no_cookie,omitempty"`
	NoBid        bool           `json:"no_bid,omitempty"`
	UsersyncInfo *UsersyncInfo  `json:"usersync,omitempty"`
	Debug        []*BidderDebug `json:"debug,omitempty"`

	AdUnits []PBSAdUnit `json:"-"`
}

func (*PBSBidder) LookupBidID

func (bidder *PBSBidder) LookupBidID(Code string) string

type PBSCookie

type PBSCookie struct {
	UIDs     map[string]string `json:"uids,omitempty"`
	OptOut   bool              `json:"optout,omitempty"`
	Birthday *time.Time        `json:"bday,omitempty"`
}

func ParseUIDCookie

func ParseUIDCookie(r *http.Request) *PBSCookie

type PBSRequest

type PBSRequest struct {
	AccountID     string          `json:"account_id"`
	Tid           string          `json:"tid"`
	CacheMarkup   int8            `json:"cache_markup"`
	Secure        int8            `json:"secure"`
	TimeoutMillis uint64          `json:"timeout_millis"`
	AdUnits       []AdUnit        `json:"ad_units"`
	IsDebug       bool            `json:"is_debug"`
	App           *openrtb.App    `json:"app"`
	Device        *openrtb.Device `json:"device"`

	// internal
	Bidders []*PBSBidder      `json:"-"`
	UserIDs map[string]string `json:"-"`
	Url     string            `json:"-"`
	Domain  string            `json:"-"`
	Start   time.Time
}

func ParsePBSRequest

func ParsePBSRequest(r *http.Request, cache cache.Cache) (*PBSRequest, error)

func (PBSRequest) Elapsed

func (req PBSRequest) Elapsed() int

func (PBSRequest) GetUserID

func (req PBSRequest) GetUserID(BidderCode string) string

func (PBSRequest) String

func (p PBSRequest) String() string

type PBSResponse

type PBSResponse struct {
	TID          string       `json:"tid,omitempty"`
	Status       string       `json:"status,omitempty"`
	BidderStatus []*PBSBidder `json:"bidder_status,omitempty"`
	Bids         PBSBidSlice  `json:"bids,omitempty"`
	BUrl         string       `json:"burl,omitempty"`
}

type UsersyncInfo

type UsersyncInfo struct {
	URL         string `json:"url,omitempty"`
	Type        string `json:"type,omitempty"`
	SupportCORS bool   `json:"supportCORS,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL