Version: v0.180.0 Latest Latest

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 20 Imported by: 81




View Source


View Source
var ResolvedInterstitialSizes = []InterstitialSize{}/* 250 elements not displayed */

ResolvedInterstitialSizes is a list of sizes sorted by size (larger first) and frequency (more common sizes first) since that seemed like a reasonable weight balancing the two factors. Originally sources from AppNexus/Xandr stats.


func SetupViper

func SetupViper(v *viper.Viper, filename string)

Set the default config values for the viper object we are using.


type Account

type Account struct {
	ID            string      `mapstructure:"id" json:"id"`
	Disabled      bool        `mapstructure:"disabled" json:"disabled"`
	CacheTTL      DefaultTTLs `mapstructure:"cache_ttl" json:"cache_ttl"`
	EventsEnabled bool        `mapstructure:"events_enabled" json:"events_enabled"`
	CCPA          AccountCCPA `mapstructure:"ccpa" json:"ccpa"`
	GDPR          AccountGDPR `mapstructure:"gdpr" json:"gdpr"`
	DebugAllow    bool        `mapstructure:"debug_allow" json:"debug_allow"`

Account represents a publisher account configuration

type AccountCCPA

type AccountCCPA struct {
	Enabled            *bool              `mapstructure:"enabled" json:"enabled,omitempty"`
	IntegrationEnabled AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`

AccountCCPA represents account-specific CCPA configuration

func (*AccountCCPA) EnabledForIntegrationType

func (a *AccountCCPA) EnabledForIntegrationType(integrationType IntegrationType) *bool

EnabledForIntegrationType indicates whether CCPA is turned on at the account level for the specified integration type by using the integration type setting if defined or the general CCPA setting if defined; otherwise it returns nil

type AccountGDPR

type AccountGDPR struct {
	Enabled                 *bool              `mapstructure:"enabled" json:"enabled,omitempty"`
	IntegrationEnabled      AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
	BasicEnforcementVendors []string           `mapstructure:"basic_enforcement_vendors" json:"basic_enforcement_vendors"`

AccountGDPR represents account-specific GDPR configuration

func (*AccountGDPR) EnabledForIntegrationType

func (a *AccountGDPR) EnabledForIntegrationType(integrationType IntegrationType) *bool

EnabledForIntegrationType indicates whether GDPR is turned on at the account level for the specified integration type by using the integration type setting if defined or the general GDPR setting if defined; otherwise it returns nil

type AccountIntegration

type AccountIntegration struct {
	AMP   *bool `mapstructure:"amp" json:"amp,omitempty"`
	App   *bool `mapstructure:"app" json:"app,omitempty"`
	Video *bool `mapstructure:"video" json:"video,omitempty"`
	Web   *bool `mapstructure:"web" json:"web,omitempty"`

AccountIntegration indicates whether a particular privacy policy (GDPR, CCPA) is enabled for each integration type

func (*AccountIntegration) GetByIntegrationType

func (a *AccountIntegration) GetByIntegrationType(integrationType IntegrationType) *bool

GetByIntegrationType looks up the account integration enabled setting for the specified integration type

type Adapter

type Adapter struct {
	Disabled         bool    `mapstructure:"disabled"`
	Endpoint         string  `mapstructure:"endpoint"`
	ExtraAdapterInfo string  `mapstructure:"extra_info"`
	Syncer           *Syncer `mapstructure:"usersync"`

	// needed for backwards compatibility
	UserSyncURL string `mapstructure:"usersync_url"`

	// needed for Rubicon
	XAPI AdapterXAPI `mapstructure:"xapi"`

	// needed for Facebook
	PlatformID string `mapstructure:"platform_id"`
	AppSecret  string `mapstructure:"app_secret"`

type AdapterXAPI

type AdapterXAPI struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Tracker  string `mapstructure:"tracker"`

type Analytics

type Analytics struct {
	File     FileLogs `mapstructure:"file"`
	Pubstack Pubstack `mapstructure:"pubstack"`

type AuctionTimeouts

type AuctionTimeouts struct {
	// The default timeout is used if the user's request didn't define one. Use 0 if there's no default.
	Default uint64 `mapstructure:"default"`
	// The max timeout is used as an absolute cap, to prevent excessively long ones. Use 0 for no cap
	Max uint64 `mapstructure:"max"`

func (*AuctionTimeouts) LimitAuctionTimeout

func (cfg *AuctionTimeouts) LimitAuctionTimeout(requested time.Duration) time.Duration

LimitAuctionTimeout returns the min of requested or cfg.MaxAuctionTimeout. Both values treat "0" as "infinite".

type BidderInfo

type BidderInfo struct {
	Enabled                 bool              // copied from adapter config for convenience. to be refactored.
	Maintainer              *MaintainerInfo   `yaml:"maintainer"`
	Capabilities            *CapabilitiesInfo `yaml:"capabilities"`
	ModifyingVastXmlAllowed bool              `yaml:"modifyingVastXmlAllowed"`
	Debug                   *DebugInfo        `yaml:"debug"`
	GVLVendorID             uint16            `yaml:"gvlVendorID"`
	Syncer                  *Syncer           `yaml:"userSync"`

BidderInfo specifies all configuration for a bidder except for enabled status, endpoint, and extra information.

type BidderInfos

type BidderInfos map[string]BidderInfo

BidderInfos contains a mapping of bidder name to bidder info.

func LoadBidderInfoFromDisk

func LoadBidderInfoFromDisk(path string, adapterConfigs map[string]Adapter, bidders []string) (BidderInfos, error)

LoadBidderInfoFromDisk parses all static/bidder-info/{bidder}.yaml files from the file system.

func (BidderInfos) ToGVLVendorIDMap

func (infos BidderInfos) ToGVLVendorIDMap() map[openrtb_ext.BidderName]uint16

ToGVLVendorIDMap transforms a BidderInfos object to a map of bidder names to GVL id. Disabled bidders are omitted from the result.

type CCPA

type CCPA struct {
	Enforce bool `mapstructure:"enforce"`

type Cache

type Cache struct {
	Scheme string `mapstructure:"scheme"`
	Host   string `mapstructure:"host"`
	Query  string `mapstructure:"query"`

	// A static timeout here is not ideal. This is a hack because we have some aggressive timelines for OpenRTB support.
	// This value specifies how much time the prebid server host expects a call to prebid cache to take.
	// OpenRTB allows the caller to specify the auction timeout. Prebid Server will subtract _this_ amount of time
	// from the timeout it gives demand sources to respond.
	// In reality, the cache response time will probably fluctuate with the traffic over time. Someday,
	// this should be replaced by code which tracks the response time of recent cache calls and
	// adjusts the time dynamically.
	ExpectedTimeMillis int `mapstructure:"expected_millis"`

	DefaultTTLs DefaultTTLs `mapstructure:"default_ttl_seconds"`

Cache configures the url used internally by Prebid Server to communicate with Prebid Cache.

func (*Cache) GetBaseURL

func (cfg *Cache) GetBaseURL() string

Allows for protocol relative URL if scheme is empty

type CacheEventsConfig

type CacheEventsConfig struct {
	// Enabled should be true to enable the events api endpoint
	Enabled bool `mapstructure:"enabled"`
	// Endpoint is the url path exposed for this stored requests events api
	Endpoint string `mapstructure:"endpoint"`

CacheEventsConfig configured stored_requests/events/api/api.go

type CapabilitiesInfo

type CapabilitiesInfo struct {
	App  *PlatformInfo `yaml:"app"`
	Site *PlatformInfo `yaml:"site"`

CapabilitiesInfo specifies the supported platforms for a bidder.

type Configuration

type Configuration struct {
	ExternalURL string     `mapstructure:"external_url"`
	Host        string     `mapstructure:"host"`
	Port        int        `mapstructure:"port"`
	Client      HTTPClient `mapstructure:"http_client"`
	CacheClient HTTPClient `mapstructure:"http_client_cache"`
	AdminPort   int        `mapstructure:"admin_port"`
	EnableGzip  bool       `mapstructure:"enable_gzip"`
	// StatusResponse is the string which will be returned by the /status endpoint when things are OK.
	// If empty, it will return a 204 with no content.
	StatusResponse    string          `mapstructure:"status_response"`
	AuctionTimeouts   AuctionTimeouts `mapstructure:"auction_timeouts_ms"`
	CacheURL          Cache           `mapstructure:"cache"`
	ExtCacheURL       ExternalCache   `mapstructure:"external_cache"`
	RecaptchaSecret   string          `mapstructure:"recaptcha_secret"`
	HostCookie        HostCookie      `mapstructure:"host_cookie"`
	Metrics           Metrics         `mapstructure:"metrics"`
	DataCache         DataCache       `mapstructure:"datacache"`
	StoredRequests    StoredRequests  `mapstructure:"stored_requests"`
	StoredRequestsAMP StoredRequests  `mapstructure:"stored_amp_req"`
	CategoryMapping   StoredRequests  `mapstructure:"category_mapping"`
	VTrack            VTrack          `mapstructure:"vtrack"`
	Event             Event           `mapstructure:"event"`
	Accounts          StoredRequests  `mapstructure:"accounts"`
	UserSync          UserSync        `mapstructure:"user_sync"`
	// Note that StoredVideo refers to stored video requests, and has nothing to do with caching video creatives.
	StoredVideo StoredRequests `mapstructure:"stored_video_req"`

	// Adapters should have a key for every openrtb_ext.BidderName, converted to lower-case.
	// Se also:
	Adapters             map[string]Adapter `mapstructure:"adapters"`
	MaxRequestSize       int64              `mapstructure:"max_request_size"`
	Analytics            Analytics          `mapstructure:"analytics"`
	AMPTimeoutAdjustment int64              `mapstructure:"amp_timeout_adjustment_ms"`
	GDPR                 GDPR               `mapstructure:"gdpr"`
	CCPA                 CCPA               `mapstructure:"ccpa"`
	LMT                  LMT                `mapstructure:"lmt"`
	CurrencyConverter    CurrencyConverter  `mapstructure:"currency_converter"`
	DefReqConfig         DefReqConfig       `mapstructure:"default_request"`

	VideoStoredRequestRequired bool `mapstructure:"video_stored_request_required"`

	// Array of blacklisted apps that is used to create the hash table BlacklistedAppMap so App.ID's can be instantly accessed.
	BlacklistedApps   []string `mapstructure:"blacklisted_apps,flow"`
	BlacklistedAppMap map[string]bool
	// Array of blacklisted accounts that is used to create the hash table BlacklistedAcctMap so Account.ID's can be instantly accessed.
	BlacklistedAccts   []string `mapstructure:"blacklisted_accts,flow"`
	BlacklistedAcctMap map[string]bool
	// Is publisher/account ID required to be submitted in the OpenRTB2 request
	AccountRequired bool `mapstructure:"account_required"`
	// AccountDefaults defines default settings for valid accounts that are partially defined
	// and provides a way to set global settings that can be overridden at account level.
	AccountDefaults Account `mapstructure:"account_defaults"`

	// Local private file containing SSL certificates
	PemCertsFile string `mapstructure:"certificates_file"`
	// Custom headers to handle request timeouts from queueing infrastructure
	RequestTimeoutHeaders RequestTimeoutHeaders `mapstructure:"request_timeout_headers"`
	// Debug/logging flags go here
	Debug Debug `mapstructure:"debug"`
	// RequestValidation specifies the request validation options.
	RequestValidation RequestValidation `mapstructure:"request_validation"`
	// When true, PBS will assign a randomly generated UUID to req.Source.TID if it is empty
	AutoGenSourceTID bool `mapstructure:"auto_gen_source_tid"`
	//When true, new bid id will be generated in seatbid[].bid[].ext.prebid.bidid and used in event urls instead
	GenerateBidID bool `mapstructure:"generate_bid_id"`
	// GenerateRequestID overrides the in an AMP Request or an App Stored Request with a generated UUID if set to true. The default is false.
	GenerateRequestID bool `mapstructure:"generate_request_id"`

	// EnableLegacyAuction specifies if the original /auction endpoint with a custom PBS data model is allowed
	// by the host.
	EnableLegacyAuction bool `mapstructure:"enable_legacy_auction"`
	// contains filtered or unexported fields

Configuration specifies the static application config.

func New

func New(v *viper.Viper) (*Configuration, error)

New uses viper to get our server configurations.

func (*Configuration) AccountDefaultsJSON

func (cfg *Configuration) AccountDefaultsJSON() json.RawMessage

AccountDefaultsJSON returns the precompiled JSON form of account_defaults

func (*Configuration) GetCachedAssetURL

func (cfg *Configuration) GetCachedAssetURL(uuid string) string

func (*Configuration) MarshalAccountDefaults

func (cfg *Configuration) MarshalAccountDefaults() error

MarshalAccountDefaults compiles AccountDefaults into the JSON format used for merge patch

type Cookie struct {
	Name  string `mapstructure:"name"`
	Value string `mapstructure:"value"`

type CurrencyConverter

type CurrencyConverter struct {
	FetchURL             string `mapstructure:"fetch_url"`
	FetchIntervalSeconds int    `mapstructure:"fetch_interval_seconds"`
	StaleRatesSeconds    int    `mapstructure:"stale_rates_seconds"`

type DataCache

type DataCache struct {
	Type       string `mapstructure:"type"`
	Filename   string `mapstructure:"filename"`
	CacheSize  int    `mapstructure:"cache_size"`
	TTLSeconds int    `mapstructure:"ttl_seconds"`

type DataType

type DataType string

DataType constants

const (
	RequestDataType    DataType = "Request"
	CategoryDataType   DataType = "Category"
	VideoDataType      DataType = "Video"
	AMPRequestDataType DataType = "AMP Request"
	AccountDataType    DataType = "Account"

func (DataType) Section

func (dataType DataType) Section() string

Section returns the config section this type is defined in

type Debug

type Debug struct {
	TimeoutNotification TimeoutNotification `mapstructure:"timeout_notification"`
	OverrideToken       string              `mapstructure:"override_token"`

type DebugInfo

type DebugInfo struct {
	Allow bool `yaml:"allow"`

DebugInfo specifies the supported debug options for a bidder.

type DefReqConfig

type DefReqConfig struct {
	Type       string      `mapstructure:"type"`
	FileSystem DefReqFiles `mapstructure:"file"`
	AliasInfo  bool        `mapstructure:"alias_info"`

AliasConfig will define the various source(s) or the default aliases Currently only filesystem is supported, but keeping the config structure

type DefReqFiles

type DefReqFiles struct {
	FileName string `mapstructure:"name"`

type DefaultTTLs

type DefaultTTLs struct {
	Banner int `mapstructure:"banner"`
	Video  int `mapstructure:"video"`
	Native int `mapstructure:"native"`
	Audio  int `mapstructure:"audio"`

Default TTLs to use to cache bids for different types of imps.

type DisabledMetrics

type DisabledMetrics struct {
	// True if we want to stop collecting account-to-adapter metrics
	AccountAdapterDetails bool `mapstructure:"account_adapter_details"`

	// True if we don't want to collect metrics about the connections prebid
	// server establishes with bidder servers such as the number of connections
	// that were created or reused.
	AdapterConnectionMetrics bool `mapstructure:"adapter_connections_metrics"`

	// True if we don't want to collect the per adapter GDPR request blocked metric
	AdapterGDPRRequestBlocked bool `mapstructure:"adapter_gdpr_request_blocked"`

type Event

type Event struct {
	TimeoutMS int64 `mapstructure:"timeout_ms"`

type ExternalCache

type ExternalCache struct {
	Scheme string `mapstructure:"scheme"`
	Host   string `mapstructure:"host"`
	Path   string `mapstructure:"path"`

ExternalCache configures the externally accessible cache url.

type FileFetcherConfig

type FileFetcherConfig struct {
	// Enabled should be true if Stored Requests should be loaded from the filesystem.
	Enabled bool `mapstructure:"enabled"`
	// Path to the directory this file fetcher gets data from.
	Path string `mapstructure:"directorypath"`

FileFetcherConfig configures a stored_requests/backends/file_fetcher/fetcher.go

type FileLogs

type FileLogs struct {
	Filename string `mapstructure:"filename"`

FileLogs Corresponding config for FileLogger as a PBS Analytics Module

type GDPR

type GDPR struct {
	Enabled                 bool         `mapstructure:"enabled"`
	HostVendorID            int          `mapstructure:"host_vendor_id"`
	DefaultValue            string       `mapstructure:"default_value"`
	Timeouts                GDPRTimeouts `mapstructure:"timeouts_ms"`
	NonStandardPublishers   []string     `mapstructure:"non_standard_publishers,flow"`
	NonStandardPublisherMap map[string]struct{}
	TCF2                    TCF2 `mapstructure:"tcf2"`
	AMPException            bool `mapstructure:"amp_exception"` // Deprecated: Use account-level GDPR settings (gdpr.integration_enabled.amp) instead
	// EEACountries (EEA = European Economic Area) are a list of countries where we should assume GDPR applies.
	// If the gdpr flag is unset in a request, but is set, we will assume GDPR applies if and only
	// if the country matches one on this list. If both the GDPR flag and country are not set, we default
	// to DefaultValue
	EEACountries    []string `mapstructure:"eea_countries"`
	EEACountriesMap map[string]struct{}

type GDPRTimeouts

type GDPRTimeouts struct {
	InitVendorlistFetch   int `mapstructure:"init_vendorlist_fetches"`
	ActiveVendorlistFetch int `mapstructure:"active_vendorlist_fetch"`

func (*GDPRTimeouts) ActiveTimeout

func (t *GDPRTimeouts) ActiveTimeout() time.Duration

func (*GDPRTimeouts) InitTimeout

func (t *GDPRTimeouts) InitTimeout() time.Duration

type HTTPClient

type HTTPClient struct {
	MaxConnsPerHost     int `mapstructure:"max_connections_per_host"`
	MaxIdleConns        int `mapstructure:"max_idle_connections"`
	MaxIdleConnsPerHost int `mapstructure:"max_idle_connections_per_host"`
	IdleConnTimeout     int `mapstructure:"idle_connection_timeout_seconds"`

type HTTPEventsConfig

type HTTPEventsConfig struct {
	Endpoint    string `mapstructure:"endpoint"`
	RefreshRate int64  `mapstructure:"refresh_rate_seconds"`
	Timeout     int    `mapstructure:"timeout_ms"`
	AmpEndpoint string `mapstructure:"amp_endpoint"`

HTTPEventsConfig configures stored_requests/events/http/http.go

func (HTTPEventsConfig) RefreshRateDuration

func (cfg HTTPEventsConfig) RefreshRateDuration() time.Duration

func (HTTPEventsConfig) TimeoutDuration

func (cfg HTTPEventsConfig) TimeoutDuration() time.Duration

type HTTPFetcherConfig

type HTTPFetcherConfig struct {
	Endpoint    string `mapstructure:"endpoint"`
	AmpEndpoint string `mapstructure:"amp_endpoint"`

HTTPFetcherConfig configures a stored_requests/backends/http_fetcher/fetcher.go

type HostCookie

type HostCookie struct {
	Domain             string `mapstructure:"domain"`
	Family             string `mapstructure:"family"`
	CookieName         string `mapstructure:"cookie_name"`
	OptOutURL          string `mapstructure:"opt_out_url"`
	OptInURL           string `mapstructure:"opt_in_url"`
	MaxCookieSizeBytes int    `mapstructure:"max_cookie_size_bytes"`
	OptOutCookie       Cookie `mapstructure:"optout_cookie"`
	// Cookie timeout in days
	TTL int64 `mapstructure:"ttl_days"`

func (*HostCookie) TTLDuration

func (cfg *HostCookie) TTLDuration() time.Duration

type InMemoryCache

type InMemoryCache struct {
	// Identify the type of memory cache. "none", "unbounded", "lru"
	Type string `mapstructure:"type"`
	// TTL is the maximum number of seconds that an unused value will stay in the cache.
	// TTL <= 0 can be used for "no ttl". Elements will still be evicted based on the Size.
	TTL int `mapstructure:"ttl_seconds"`
	// Size is the max total cache size allowed for single caches
	Size int `mapstructure:"size_bytes"`
	// RequestCacheSize is the max number of bytes allowed in the cache for Stored Requests. Values <= 0 will have no limit
	RequestCacheSize int `mapstructure:"request_cache_size_bytes"`
	// ImpCacheSize is the max number of bytes allowed in the cache for Stored Imps. Values <= 0 will have no limit
	ImpCacheSize int `mapstructure:"imp_cache_size_bytes"`

type InfluxMetrics

type InfluxMetrics struct {
	Host               string `mapstructure:"host"`
	Database           string `mapstructure:"database"`
	Username           string `mapstructure:"username"`
	Password           string `mapstructure:"password"`
	MetricSendInterval int    `mapstructure:"metric_send_interval"`

type IntegrationType

type IntegrationType string

IntegrationType enumerates the values of integrations Prebid Server can configure for an account

const (
	IntegrationTypeAMP   IntegrationType = "amp"
	IntegrationTypeApp   IntegrationType = "app"
	IntegrationTypeVideo IntegrationType = "video"
	IntegrationTypeWeb   IntegrationType = "web"

Possible values of integration types Prebid Server can configure for an account

type InterstitialSize

type InterstitialSize struct {
	Width  uint64
	Height uint64

InterstitialSize represents the width and height of an interstitial ad.

type LMT

type LMT struct {
	Enforce bool `mapstructure:"enforce"`

type MaintainerInfo

type MaintainerInfo struct {
	Email string `yaml:"email"`

MaintainerInfo specifies the support email address for a bidder.

type Metrics

type Metrics struct {
	Influxdb   InfluxMetrics     `mapstructure:"influxdb"`
	Prometheus PrometheusMetrics `mapstructure:"prometheus"`
	Disabled   DisabledMetrics   `mapstructure:"disabled_metrics"`

type PlatformInfo

type PlatformInfo struct {
	MediaTypes []openrtb_ext.BidType `yaml:"mediaTypes"`

PlatformInfo specifies the supported media types for a bidder.

type PostgresCacheInitializer

type PostgresCacheInitializer struct {
	Timeout int `mapstructure:"timeout_ms"`
	// Query should be something like:
	// SELECT id, requestData, 'request' AS type FROM stored_requests
	// SELECT id, impData, 'imp' AS type FROM stored_imps
	// This query will be run once on startup to fetch _all_ known Stored Request data from the database.
	// For more details on the expected format of requestData and impData, see stored_requests/events/postgres/polling.go
	Query string `mapstructure:"query"`
	// AmpQuery is just like Query, but for AMP Stored Requests
	AmpQuery string `mapstructure:"amp_query"`

type PostgresConfig

type PostgresConfig struct {
	ConnectionInfo      PostgresConnection       `mapstructure:"connection"`
	FetcherQueries      PostgresFetcherQueries   `mapstructure:"fetcher"`
	CacheInitialization PostgresCacheInitializer `mapstructure:"initialize_caches"`
	PollUpdates         PostgresUpdatePolling    `mapstructure:"poll_for_updates"`

PostgresConfig configures the Stored Request ecosystem to use Postgres. This must include a Fetcher, and may optionally include some EventProducers to populate and refresh the caches.

type PostgresConnection

type PostgresConnection struct {
	Database string `mapstructure:"dbname"`
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"user"`
	Password string `mapstructure:"password"`

PostgresConnection has options which put types to the Postgres Connection string. See:

func (*PostgresConnection) ConnString

func (cfg *PostgresConnection) ConnString() string

type PostgresFetcherQueries

type PostgresFetcherQueries struct {
	// QueryTemplate is the Postgres Query which can be used to fetch configs from the database.
	// It is a Template, rather than a full Query, because a single HTTP request may reference multiple Stored Requests.
	// In the simplest case, this could be something like:
	//   SELECT id, requestData, 'request' as type
	//     FROM stored_requests
	//     WHERE id in %REQUEST_ID_LIST%
	//     UNION ALL
	//   SELECT id, impData, 'imp' as type
	//     FROM stored_imps
	//     WHERE id in %IMP_ID_LIST%
	// The MakeQuery function will transform this query into:
	//   SELECT id, requestData, 'request' as type
	//     FROM stored_requests
	//     WHERE id in ($1)
	//     UNION ALL
	//   SELECT id, impData, 'imp' as type
	//     FROM stored_imps
	//     WHERE id in ($2, $3, $4, ...)
	// ... where the number of "$x" args depends on how many IDs are nested within the HTTP request.
	QueryTemplate string `mapstructure:"query"`

	// AmpQueryTemplate is the same as QueryTemplate, but used in the `/openrtb2/amp` endpoint.
	AmpQueryTemplate string `mapstructure:"amp_query"`

func (*PostgresFetcherQueries) MakeQuery

func (cfg *PostgresFetcherQueries) MakeQuery(numReqs int, numImps int) (query string)

MakeQuery builds a query which can fetch numReqs Stored Requests and numImps Stored Imps. See the docs on PostgresConfig.QueryTemplate for a description of how it works.

type PostgresUpdatePolling

type PostgresUpdatePolling struct {
	// RefreshRate determines how frequently the Query and AmpQuery are run.
	RefreshRate int `mapstructure:"refresh_rate_seconds"`

	// Timeout is the amount of time before a call to the database is aborted.
	Timeout int `mapstructure:"timeout_ms"`

	// An example UpdateQuery is:
	// SELECT id, requestData, 'request' AS type
	//   FROM stored_requests
	//   WHERE last_updated > $1
	// SELECT id, requestData, 'imp' AS type
	//   FROM stored_imps
	//   WHERE last_updated > $1
	// The code will be run periodically to fetch updates from the database.
	Query string `mapstructure:"query"`
	// AmpQuery is the same as Query, but used for the `/openrtb2/amp` endpoint.
	AmpQuery string `mapstructure:"amp_query"`

type Privacy

type Privacy struct {

Privacy is a grouping of privacy related configs to assist in dependency injection.

type PrometheusMetrics

type PrometheusMetrics struct {
	Port             int    `mapstructure:"port"`
	Namespace        string `mapstructure:"namespace"`
	Subsystem        string `mapstructure:"subsystem"`
	TimeoutMillisRaw int    `mapstructure:"timeout_ms"`

func (*PrometheusMetrics) Timeout

func (m *PrometheusMetrics) Timeout() time.Duration

type Pubstack

type Pubstack struct {
	Enabled     bool           `mapstructure:"enabled"`
	ScopeId     string         `mapstructure:"scopeid"`
	IntakeUrl   string         `mapstructure:"endpoint"`
	Buffers     PubstackBuffer `mapstructure:"buffers"`
	ConfRefresh string         `mapstructure:"configuration_refresh_delay"`

type PubstackBuffer

type PubstackBuffer struct {
	BufferSize string `mapstructure:"size"`
	EventCount int    `mapstructure:"count"`
	Timeout    string `mapstructure:"timeout"`

type RequestTimeoutHeaders

type RequestTimeoutHeaders struct {
	RequestTimeInQueue    string `mapstructure:"request_time_in_queue"`
	RequestTimeoutInQueue string `mapstructure:"request_timeout_in_queue"`

type RequestValidation

type RequestValidation struct {
	IPv4PrivateNetworks       []string `mapstructure:"ipv4_private_networks,flow"`
	IPv4PrivateNetworksParsed []net.IPNet

	IPv6PrivateNetworks       []string `mapstructure:"ipv6_private_networks,flow"`
	IPv6PrivateNetworksParsed []net.IPNet

RequestValidation specifies the request validation options.

func (*RequestValidation) Parse

func (r *RequestValidation) Parse() error

Parse converts the CIDR representation of the IPv4 and IPv6 private networks as net.IPNet structs, or returns an error if at least one is invalid.

type StoredRequests

type StoredRequests struct {

	// Files should be used if Stored Requests should be loaded from the filesystem.
	// Fetchers are in stored_requests/backends/file_system/fetcher.go
	Files FileFetcherConfig `mapstructure:"filesystem"`
	// Postgres configures Fetchers and EventProducers which read from a Postgres DB.
	// Fetchers are in stored_requests/backends/db_fetcher/postgres.go
	// EventProducers are in stored_requests/events/postgres
	Postgres PostgresConfig `mapstructure:"postgres"`
	// HTTP configures an instance of stored_requests/backends/http/http_fetcher.go.
	// If non-nil, Stored Requests will be fetched from the endpoint described there.
	HTTP HTTPFetcherConfig `mapstructure:"http"`
	// InMemoryCache configures an instance of stored_requests/caches/memory/cache.go.
	// If non-nil, Stored Requests will be saved in an in-memory cache.
	InMemoryCache InMemoryCache `mapstructure:"in_memory_cache"`
	// CacheEvents configures an instance of stored_requests/events/api/api.go.
	// This is a sub-object containing the endpoint name to use for this API endpoint.
	CacheEvents CacheEventsConfig `mapstructure:"cache_events"`
	// HTTPEvents configures an instance of stored_requests/events/http/http.go.
	// If non-nil, the server will use those endpoints to populate and update the cache.
	HTTPEvents HTTPEventsConfig `mapstructure:"http_events"`
	// contains filtered or unexported fields

StoredRequests struct defines options for stored requests for each data type including some amp stored_requests options

func (*StoredRequests) DataType

func (sr *StoredRequests) DataType() DataType

DataType returns the DataType associated with this config

func (*StoredRequests) Section

func (sr *StoredRequests) Section() string

Section returns the config section

func (*StoredRequests) SetDataType

func (sr *StoredRequests) SetDataType(dataType DataType)

SetDataType sets the DataType on this config. Needed for tests.

type Syncer added in v0.173.0

type Syncer struct {
	// Key is used as the record key for the user sync cookie. We recommend using the bidder name
	// as the key for consistency, but that is not enforced as a requirement.
	Key string `yaml:"key" mapstructure:"key"`

	// Default identifies which endpoint is preferred if both are allowed by the publisher. This is
	// only required if there is more than one endpoint configured for the bidder. Valid values are
	// `iframe` and `redirect`.
	Default string `yaml:"default" mapstructure:"default"`

	// Supports allows bidders to specify which user sync endpoints they support but which don't have
	// good defaults. Host companies should contact the bidder for the endpoint configuration. Hosts
	// may not override this value.
	Supports []string `yaml:"supports"`

	// IFrame configures an iframe endpoint for user syncing.
	IFrame *SyncerEndpoint `yaml:"iframe" mapstructure:"iframe"`

	// Redirect configures an redirect endpoint for user syncing. This is also known as an image
	// endpoint in the Prebid.js project.
	Redirect *SyncerEndpoint `yaml:"redirect" mapstructure:"redirect"`

	// SupportCORS identifies if CORS is supported for the user syncing endpoints.
	SupportCORS *bool `yaml:"supportCors" mapstructure:"support_cors"`

Syncer specifies the user sync settings for a bidder. This struct is shared by the account config, so it needs to have both yaml and mapstructure mappings.

func (*Syncer) Override added in v0.173.0

func (s *Syncer) Override(original *Syncer) *Syncer

Override returns a new Syncer object where values in the original are replaced by non-empty/non-default values in the override, except for the Supports field which may not be overridden. No changes are made to the original or override Syncer.

type SyncerEndpoint added in v0.173.0

type SyncerEndpoint struct {
	// URL is the endpoint on the bidder server the user will be redirected to when a user sync is
	// requested. The following macros are resolved at application startup:
	//  {{.RedirectURL}} - This will be replaced with a redirect url generated using the RedirectURL
	//                     template and url escaped for safe inclusion in any part of the URL.
	// The following macros are specific to individual requests and are resolved at runtime using the
	// Go template engine. For more information on Go templates, see:
	//  {{.GDPR}}        - This will be replaced with the "gdpr" property sent to /cookie_sync.
	//  {{.Consent}}     - This will be replaced with the "consent" property sent to /cookie_sync.
	//  {{.USPrivacy}}   - This will be replaced with the "us_privacy" property sent to /cookie_sync.
	URL string `yaml:"url" mapstructure:"url"`

	// RedirectURL is an endpoint on the host server the user will be redirected to when a user sync
	// request has been completed by the bidder server. The following macros are resolved at application
	// startup:
	//  {{.ExternalURL}} - This will be replaced with the host server's externally reachable http path.
	//  {{.SyncerKey}}   - This will be replaced with the syncer key.
	//  {{.SyncType}}    - This will be replaced with the sync type, either 'b' for iframe syncs or 'i'
	//                     for redirect/image syncs.
	//  {{.UserMacro}}   - This will be replaced with the bidder server's user id macro.
	// The endpoint on the host server is usually Prebid Server's /setuid endpoint. The default value is:
	// `{{.ExternalURL}}/setuid?bidder={{.SyncerKey}}&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&f={{.SyncType}}&uid={{.UserMacro}}`
	RedirectURL string `yaml:"redirectUrl" mapstructure:"redirect_url"`

	// ExternalURL is available as a macro to the RedirectURL template. If not specified, the host configuration
	// value is used.
	ExternalURL string `yaml:"externalUrl" mapstructure:"external_url"`

	// UserMacro is available as a macro to the RedirectURL template. This value is specific to the bidder server
	// and has no default.
	UserMacro string `yaml:"userMacro" mapstructure:"user_macro"`

SyncerEndpoint specifies the configuration of the URL returned by the /cookie_sync endpoint for a specific bidder. Bidders must specify at least one endpoint configuration to be eligible for selection during a user sync request.

URL is the only required field, although we highly recommend to use the available macros to make the configuration readable and maintainable. User sync urls include a redirect url back to Prebid Server which is url escaped and can be very diffcult for humans to read.

In most cases, bidders will specify a URL with a `{{.RedirectURL}}` macro for the call back to Prebid Server and a UserMacro which the bidder server will replace with the user's id. Example:

url: "{{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}"
userMacro: "$UID"

Prebid Server is configured with a default RedirectURL template matching the /setuid call. This may be overridden for all bidders with the `user_sync.redirect_url` host configuration or for a specific bidder with the RedirectURL value in this struct.

func (*SyncerEndpoint) Override added in v0.173.0

func (s *SyncerEndpoint) Override(original *SyncerEndpoint) *SyncerEndpoint

Override returns a new SyncerEndpoint object where values in the original are replaced by non-empty/non-default values in the override. No changes are made to the original or override SyncerEndpoint.

type TCF2

type TCF2 struct {
	Enabled             bool                    `mapstructure:"enabled"`
	Purpose1            TCF2Purpose             `mapstructure:"purpose1"`
	Purpose2            TCF2Purpose             `mapstructure:"purpose2"`
	Purpose3            TCF2Purpose             `mapstructure:"purpose3"`
	Purpose4            TCF2Purpose             `mapstructure:"purpose4"`
	Purpose5            TCF2Purpose             `mapstructure:"purpose5"`
	Purpose6            TCF2Purpose             `mapstructure:"purpose6"`
	Purpose7            TCF2Purpose             `mapstructure:"purpose7"`
	Purpose8            TCF2Purpose             `mapstructure:"purpose8"`
	Purpose9            TCF2Purpose             `mapstructure:"purpose9"`
	Purpose10           TCF2Purpose             `mapstructure:"purpose10"`
	SpecialPurpose1     TCF2Purpose             `mapstructure:"special_purpose1"`
	PurposeOneTreatment TCF2PurposeOneTreatment `mapstructure:"purpose_one_treatment"`

TCF2 defines the TCF2 specific configurations for GDPR

type TCF2Purpose added in v0.168.0

type TCF2Purpose struct {
	Enabled        bool `mapstructure:"enabled"`
	EnforceVendors bool `mapstructure:"enforce_vendors"`
	// Array of vendor exceptions that is used to create the hash table VendorExceptionMap so vendor names can be instantly accessed
	VendorExceptions   []openrtb_ext.BidderName `mapstructure:"vendor_exceptions"`
	VendorExceptionMap map[openrtb_ext.BidderName]struct{}

Making a purpose struct so purpose specific details can be added later.

type TCF2PurposeOneTreatment added in v0.168.0

type TCF2PurposeOneTreatment struct {
	Enabled       bool `mapstructure:"enabled"`
	AccessAllowed bool `mapstructure:"access_allowed"`

type TimeoutNotification

type TimeoutNotification struct {
	// Log timeout notifications in the application log
	Log bool `mapstructure:"log"`
	// Fraction of notifications to log
	SamplingRate float32 `mapstructure:"sampling_rate"`
	// Only log failures
	FailOnly bool `mapstructure:"fail_only"`

type UserSync added in v0.173.0

type UserSync struct {
	Cooperative UserSyncCooperative `mapstructure:"coop_sync"`
	ExternalURL string              `mapstructure:"external_url"`
	RedirectURL string              `mapstructure:"redirect_url"`

UserSync specifies the static global user sync configuration.

type UserSyncCooperative added in v0.173.0

type UserSyncCooperative struct {
	EnabledByDefault bool       `mapstructure:"default"`
	PriorityGroups   [][]string `mapstructure:"priority_groups"`

UserSyncCooperative specifies the static global default cooperative cookie sync

type VTrack

type VTrack struct {
	TimeoutMS          int64 `mapstructure:"timeout_ms"`
	AllowUnknownBidder bool  `mapstructure:"allow_unknown_bidder"`
	Enabled            bool  `mapstructure:"enabled"`


Path Synopsis

Jump to

Keyboard shortcuts

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