config

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyncResponseFormatIFrame   = "b" // b = blank HTML response
	SyncResponseFormatRedirect = "i" // i = image response
)
View Source
const (
	TCF2EnforceAlgoBasic = "basic"
	TCF2EnforceAlgoFull  = "full"
)
View Source
const (
	ValidationEnforce string = "enforce"
	ValidationWarn    string = "warn"
	ValidationSkip    string = "skip"
)
View Source
const (
	AdCertsSignerModeOff       = "off"
	AdCertsSignerModeInprocess = "inprocess"
	AdCertsSignerModeRemote    = "remote"
)
View Source
const MIN_COOKIE_SIZE_BYTES = 500

Variables

View Source
var (
	ErrSignerModeIncorrect              = errors.New("signer mode is not specified, specify 'off', 'inprocess' or 'remote'")
	ErrInProcessSignerInvalidPrivateKey = errors.New("private key for inprocess signer cannot be empty")

	ErrMsgInProcessSignerInvalidURL                = "invalid url for inprocess signer"
	ErrMsgInProcessSignerInvalidDNSRenewalInterval = "invalid dns renewal interval for inprocess signer"
	ErrMsgInProcessSignerInvalidDNSCheckInterval   = "invalid dns check interval for inprocess signer"
	ErrMsgInvalidRemoteSignerURL                   = "invalid url for remote signer"
	ErrMsgInvalidRemoteSignerSigningTimeout        = "invalid signing timeout for remote signer"
)
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.

Functions

func SetupViper

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

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

Types

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"`
	CCPA                    AccountCCPA                                 `mapstructure:"ccpa" json:"ccpa"`
	GDPR                    AccountGDPR                                 `mapstructure:"gdpr" json:"gdpr"`
	DebugAllow              bool                                        `mapstructure:"debug_allow" json:"debug_allow"`
	DefaultIntegration      string                                      `mapstructure:"default_integration" json:"default_integration"`
	CookieSync              CookieSync                                  `mapstructure:"cookie_sync" json:"cookie_sync"`
	Events                  Events                                      `mapstructure:"events" json:"events"` // Don't enable this feature. It is still under developmment - https://github.com/prebid/prebid-server/issues/1725
	TruncateTargetAttribute *int                                        `mapstructure:"truncate_target_attr" json:"truncate_target_attr"`
	AlternateBidderCodes    *openrtb_ext.ExtAlternateBidderCodes        `mapstructure:"alternatebiddercodes" json:"alternatebiddercodes"`
	Hooks                   AccountHooks                                `mapstructure:"hooks" json:"hooks"`
	PriceFloors             AccountPriceFloors                          `mapstructure:"price_floors" json:"price_floors"`
	Validations             Validations                                 `mapstructure:"validations" json:"validations"`
	DefaultBidLimit         int                                         `mapstructure:"default_bid_limit" json:"default_bid_limit"`
	BidAdjustments          *openrtb_ext.ExtRequestPrebidBidAdjustments `mapstructure:"bidadjustments" json:"bidadjustments"`
	Privacy                 AccountPrivacy                              `mapstructure:"privacy" json:"privacy"`
}

Account represents a publisher account configuration

type AccountCCPA

type AccountCCPA struct {
	Enabled        *bool          `mapstructure:"enabled" json:"enabled,omitempty"`
	ChannelEnabled AccountChannel `mapstructure:"channel_enabled" json:"channel_enabled"`
}

AccountCCPA represents account-specific CCPA configuration

func (*AccountCCPA) EnabledForChannelType

func (a *AccountCCPA) EnabledForChannelType(channelType ChannelType) *bool

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

type AccountChannel

type AccountChannel 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"`
	DOOH  *bool `mapstructure:"dooh" json:"dooh,omitempty"`
}

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

func (*AccountChannel) GetByChannelType

func (a *AccountChannel) GetByChannelType(channelType ChannelType) *bool

GetByChannelType looks up the account integration enabled setting for the specified channel type

type AccountFloorFetch added in v2.1.0

type AccountFloorFetch struct {
	Enabled       bool   `mapstructure:"enabled" json:"enabled"`
	URL           string `mapstructure:"url" json:"url"`
	Timeout       int    `mapstructure:"timeout_ms" json:"timeout_ms"`
	MaxFileSizeKB int    `mapstructure:"max_file_size_kb" json:"max_file_size_kb"`
	MaxRules      int    `mapstructure:"max_rules" json:"max_rules"`
	MaxAge        int    `mapstructure:"max_age_sec" json:"max_age_sec"`
	Period        int    `mapstructure:"period_sec" json:"period_sec"`
	MaxSchemaDims int    `mapstructure:"max_schema_dims" json:"max_schema_dims"`
	AccountID     string `mapstructure:"accountID" json:"accountID"`
}

AccountFloorFetch defines the configuration for dynamic floors fetching.

type AccountGDPR

type AccountGDPR struct {
	Enabled        *bool          `mapstructure:"enabled" json:"enabled,omitempty"`
	ChannelEnabled AccountChannel `mapstructure:"channel_enabled" json:"channel_enabled"`
	// Array of basic enforcement vendors that is used to create the hash table so vendor names can be instantly accessed
	BasicEnforcementVendors    []string `mapstructure:"basic_enforcement_vendors" json:"basic_enforcement_vendors"`
	BasicEnforcementVendorsMap map[string]struct{}
	Purpose1                   AccountGDPRPurpose `mapstructure:"purpose1" json:"purpose1"`
	Purpose2                   AccountGDPRPurpose `mapstructure:"purpose2" json:"purpose2"`
	Purpose3                   AccountGDPRPurpose `mapstructure:"purpose3" json:"purpose3"`
	Purpose4                   AccountGDPRPurpose `mapstructure:"purpose4" json:"purpose4"`
	Purpose5                   AccountGDPRPurpose `mapstructure:"purpose5" json:"purpose5"`
	Purpose6                   AccountGDPRPurpose `mapstructure:"purpose6" json:"purpose6"`
	Purpose7                   AccountGDPRPurpose `mapstructure:"purpose7" json:"purpose7"`
	Purpose8                   AccountGDPRPurpose `mapstructure:"purpose8" json:"purpose8"`
	Purpose9                   AccountGDPRPurpose `mapstructure:"purpose9" json:"purpose9"`
	Purpose10                  AccountGDPRPurpose `mapstructure:"purpose10" json:"purpose10"`
	// Hash table of purpose configs for convenient purpose config lookup
	PurposeConfigs      map[consentconstants.Purpose]*AccountGDPRPurpose
	PurposeOneTreatment AccountGDPRPurposeOneTreatment `mapstructure:"purpose_one_treatment" json:"purpose_one_treatment"`
	SpecialFeature1     AccountGDPRSpecialFeature      `mapstructure:"special_feature1" json:"special_feature1"`
}

AccountGDPR represents account-specific GDPR configuration

func (*AccountGDPR) EnabledForChannelType

func (a *AccountGDPR) EnabledForChannelType(channelType ChannelType) *bool

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

func (*AccountGDPR) FeatureOneEnforced

func (a *AccountGDPR) FeatureOneEnforced() (value, exists bool)

FeatureOneEnforced gets the account level feature one enforced setting returning the value and whether or not it was set. If not set, a default value of true is returned matching host default behavior.

func (*AccountGDPR) FeatureOneVendorException

func (a *AccountGDPR) FeatureOneVendorException(bidder openrtb_ext.BidderName) (value, exists bool)

FeatureOneVendorException checks if the given bidder is a vendor exception.

func (*AccountGDPR) PurposeEnforced

func (a *AccountGDPR) PurposeEnforced(purpose consentconstants.Purpose) (value, exists bool)

PurposeEnforced checks if full enforcement is turned on for a given purpose at the account level. It returns the enforcement strategy type and whether or not it is set on the account. If not set, a default value of true is returned matching host default behavior.

func (*AccountGDPR) PurposeEnforcementAlgo

func (a *AccountGDPR) PurposeEnforcementAlgo(purpose consentconstants.Purpose) (value TCF2EnforcementAlgo, exists bool)

PurposeEnforcementAlgo checks the purpose enforcement algo for a given purpose by first looking at the account settings, and if not set there, defaulting to the host configuration.

func (*AccountGDPR) PurposeEnforcingVendors

func (a *AccountGDPR) PurposeEnforcingVendors(purpose consentconstants.Purpose) (value, exists bool)

PurposeEnforcingVendors gets the account level enforce vendors setting for a given purpose returning the value and whether or not it is set. If not set, a default value of true is returned matching host default behavior.

func (*AccountGDPR) PurposeOneTreatmentAccessAllowed

func (a *AccountGDPR) PurposeOneTreatmentAccessAllowed() (value, exists bool)

PurposeOneTreatmentAccessAllowed gets the account level purpose one treatment access allowed setting returning the value and whether or not it is set. If not set, a default value of true is returned matching host default behavior.

func (*AccountGDPR) PurposeOneTreatmentEnabled

func (a *AccountGDPR) PurposeOneTreatmentEnabled() (value, exists bool)

PurposeOneTreatmentEnabled gets the account level purpose one treatment enabled setting returning the value and whether or not it is set. If not set, a default value of true is returned matching host default behavior.

func (*AccountGDPR) PurposeVendorExceptions

func (a *AccountGDPR) PurposeVendorExceptions(purpose consentconstants.Purpose) (value map[string]struct{}, exists bool)

PurposeVendorExceptions returns the vendor exception map for a given purpose.

type AccountGDPRPurpose

type AccountGDPRPurpose struct {
	EnforceAlgo string `mapstructure:"enforce_algo" json:"enforce_algo,omitempty"`
	// Integer representation of enforcement algo for performance improvement on compares
	EnforceAlgoID  TCF2EnforcementAlgo
	EnforcePurpose *bool `mapstructure:"enforce_purpose" json:"enforce_purpose,omitempty"`
	EnforceVendors *bool `mapstructure:"enforce_vendors" json:"enforce_vendors,omitempty"`
	// Array of vendor exceptions that is used to create the hash table VendorExceptionMap so vendor names can be instantly accessed
	VendorExceptions   []string `mapstructure:"vendor_exceptions" json:"vendor_exceptions"`
	VendorExceptionMap map[string]struct{}
}

AccountGDPRPurpose represents account-specific GDPR purpose configuration

type AccountGDPRPurposeOneTreatment

type AccountGDPRPurposeOneTreatment struct {
	Enabled       *bool `mapstructure:"enabled"`
	AccessAllowed *bool `mapstructure:"access_allowed"`
}

AccountGDPRPurposeOneTreatment represents account-specific GDPR purpose one treatment configuration

type AccountGDPRSpecialFeature

type AccountGDPRSpecialFeature struct {
	Enforce *bool `mapstructure:"enforce" json:"enforce"`
	// 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" json:"vendor_exceptions"`
	VendorExceptionMap map[openrtb_ext.BidderName]struct{}
}

AccountGDPRSpecialFeature represents account-specific GDPR special feature configuration

type AccountHooks

type AccountHooks struct {
	Modules       AccountModules    `mapstructure:"modules" json:"modules"`
	ExecutionPlan HookExecutionPlan `mapstructure:"execution_plan" json:"execution_plan"`
}

AccountHooks represents account-specific hooks configuration

type AccountModules

type AccountModules map[string]map[string]json.RawMessage

AccountModules mapping provides account-level module configuration format: map[vendor_name]map[module_name]json.RawMessage

func (AccountModules) ModuleConfig

func (m AccountModules) ModuleConfig(id string) (json.RawMessage, error)

ModuleConfig returns the account-level module config. The id argument must be passed in the form "vendor.module_name", otherwise an error is returned.

type AccountPriceFloors

type AccountPriceFloors struct {
	Enabled                bool              `mapstructure:"enabled" json:"enabled"`
	EnforceFloorsRate      int               `mapstructure:"enforce_floors_rate" json:"enforce_floors_rate"`
	AdjustForBidAdjustment bool              `mapstructure:"adjust_for_bid_adjustment" json:"adjust_for_bid_adjustment"`
	EnforceDealFloors      bool              `mapstructure:"enforce_deal_floors" json:"enforce_deal_floors"`
	UseDynamicData         bool              `mapstructure:"use_dynamic_data" json:"use_dynamic_data"`
	MaxRule                int               `mapstructure:"max_rules" json:"max_rules"`
	MaxSchemaDims          int               `mapstructure:"max_schema_dims" json:"max_schema_dims"`
	Fetcher                AccountFloorFetch `mapstructure:"fetch" json:"fetch"`
}

func (*AccountPriceFloors) IsAdjustForBidAdjustmentEnabled

func (pf *AccountPriceFloors) IsAdjustForBidAdjustmentEnabled() bool

type AccountPrivacy

type AccountPrivacy struct {
	AllowActivities *AllowActivities `mapstructure:"allowactivities" json:"allowactivities"`
	IPv6Config      IPv6             `mapstructure:"ipv6" json:"ipv6"`
	IPv4Config      IPv4             `mapstructure:"ipv4" json:"ipv4"`
	PrivacySandbox  PrivacySandbox   `mapstructure:"privacysandbox" json:"privacysandbox"`
}

type Activity

type Activity struct {
	Default *bool          `mapstructure:"default" json:"default"`
	Rules   []ActivityRule `mapstructure:"rules" json:"rules"`
}

type ActivityCondition

type ActivityCondition struct {
	ComponentName []string `mapstructure:"componentName" json:"componentName"`
	ComponentType []string `mapstructure:"componentType" json:"componentType"`
}

type ActivityRule

type ActivityRule struct {
	Condition ActivityCondition `mapstructure:"condition" json:"condition"`
	Allow     bool              `mapstructure:"allow" json:"allow"`
}

type Adapter

type Adapter struct {
	Endpoint         string
	ExtraAdapterInfo string

	// needed for Rubicon
	XAPI AdapterXAPI

	// needed for Facebook
	PlatformID string
	AppSecret  string
}

type AdapterXAPI

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

type Admin added in v2.13.0

type Admin struct {
	Enabled bool `mapstructure:"enabled"`
}

type AdsCertInProcess

type AdsCertInProcess struct {
	// Origin is ads.cert hostname for the originating party
	Origin string `mapstructure:"origin"`
	// PrivateKey is a base-64 encoded private key.
	PrivateKey string `mapstructure:"key"`
	// DNSCheckIntervalInSeconds specifies frequency to check origin _delivery._adscert and _adscert subdomains, used for indexing data, default: 30
	DNSCheckIntervalInSeconds int `mapstructure:"domain_check_interval_seconds"`
	// DNSRenewalIntervalInSeconds specifies frequency to renew origin _delivery._adscert and _adscert subdomains, used for indexing data, default: 30
	DNSRenewalIntervalInSeconds int `mapstructure:"domain_renewal_interval_seconds"`
}

AdsCertInProcess configures data to sign requests using ads certs library in core PBS logic

type AdsCertRemote

type AdsCertRemote struct {
	// Url is the address of gRPC server that will create a call signature
	Url string `mapstructure:"url"`
	// SigningTimeoutMs specifies how long this client will wait for signing to finish before abandoning
	SigningTimeoutMs int `mapstructure:"signing_timeout_ms"`
}

AdsCertRemote configures data to sign requests using remote signatory service

type AgmaAnalytics added in v2.11.0

type AgmaAnalytics struct {
	Enabled  bool                      `mapstructure:"enabled"`
	Endpoint AgmaAnalyticsHttpEndpoint `mapstructure:"endpoint"`
	Buffers  AgmaAnalyticsBuffer       `mapstructure:"buffers"`
	Accounts []AgmaAnalyticsAccount    `mapstructure:"accounts"`
}

type AgmaAnalyticsAccount added in v2.11.0

type AgmaAnalyticsAccount struct {
	Code        string `mapstructure:"code"`
	PublisherId string `mapstructure:"publisher_id"`
	SiteAppId   string `mapstructure:"site_app_id"`
}

type AgmaAnalyticsBuffer added in v2.11.0

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

type AgmaAnalyticsHttpEndpoint added in v2.11.0

type AgmaAnalyticsHttpEndpoint struct {
	Url     string `mapstructure:"url"`
	Timeout string `mapstructure:"timeout"`
	Gzip    bool   `mapstructure:"gzip"`
}

type AllowActivities

type AllowActivities struct {
	SyncUser                 Activity `mapstructure:"syncUser" json:"syncUser"`
	FetchBids                Activity `mapstructure:"fetchBids" json:"fetchBids"`
	EnrichUserFPD            Activity `mapstructure:"enrichUfpd" json:"enrichUfpd"`
	ReportAnalytics          Activity `mapstructure:"reportAnalytics" json:"reportAnalytics"`
	TransmitUserFPD          Activity `mapstructure:"transmitUfpd" json:"transmitUfpd"`
	TransmitPreciseGeo       Activity `mapstructure:"transmitPreciseGeo" json:"transmitPreciseGeo"`
	TransmitUniqueRequestIds Activity `mapstructure:"transmitUniqueRequestIds" json:"transmitUniqueRequestIds"`
	TransmitTids             Activity `mapstructure:"transmitTid" json:"transmitTid"`
}

type Analytics

type Analytics struct {
	File     FileLogs      `mapstructure:"file"`
	Agma     AgmaAnalytics `mapstructure:"agma"`
	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 BidderAdsCert

type BidderAdsCert struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

BidderAdsCert enables Call Sign feature for bidder

type BidderInfo

type BidderInfo struct {
	AliasOf          string `yaml:"aliasOf" mapstructure:"aliasOf"`
	Disabled         bool   `yaml:"disabled" mapstructure:"disabled"`
	Endpoint         string `yaml:"endpoint" mapstructure:"endpoint"`
	ExtraAdapterInfo string `yaml:"extra_info" mapstructure:"extra_info"`

	Maintainer              *MaintainerInfo   `yaml:"maintainer" mapstructure:"maintainer"`
	Capabilities            *CapabilitiesInfo `yaml:"capabilities" mapstructure:"capabilities"`
	ModifyingVastXmlAllowed bool              `yaml:"modifyingVastXmlAllowed" mapstructure:"modifyingVastXmlAllowed"`
	Debug                   *DebugInfo        `yaml:"debug" mapstructure:"debug"`
	GVLVendorID             uint16            `yaml:"gvlVendorID" mapstructure:"gvlVendorID"`

	Syncer *Syncer `yaml:"userSync" mapstructure:"userSync"`

	Experiment BidderInfoExperiment `yaml:"experiment" mapstructure:"experiment"`

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

	// needed for Facebook
	PlatformID string `yaml:"platform_id" mapstructure:"platform_id"`
	AppSecret  string `yaml:"app_secret" mapstructure:"app_secret"`
	// EndpointCompression determines, if set, the type of compression the bid request will undergo before being sent to the corresponding bid server
	EndpointCompression string       `yaml:"endpointCompression" mapstructure:"endpointCompression"`
	OpenRTB             *OpenRTBInfo `yaml:"openrtb" mapstructure:"openrtb"`
}

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

func (BidderInfo) IsEnabled

func (bi BidderInfo) IsEnabled() bool

type BidderInfoExperiment

type BidderInfoExperiment struct {
	AdsCert BidderAdsCert `yaml:"adsCert" mapstructure:"adsCert"`
}

BidderInfoExperiment specifies non-production ready feature config for a bidder

type BidderInfos

type BidderInfos map[string]BidderInfo

BidderInfos contains a mapping of bidder name to bidder info.

func LoadBidderInfo

func LoadBidderInfo(reader InfoReader) (BidderInfos, error)

func LoadBidderInfoFromDisk

func LoadBidderInfoFromDisk(path string) (BidderInfos, error)

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

GetBaseURL 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" mapstructure:"app"`
	Site *PlatformInfo `yaml:"site" mapstructure:"site"`
	DOOH *PlatformInfo `yaml:"dooh" mapstructure:"dooh"`
}

CapabilitiesInfo specifies the supported platforms for a bidder.

type ChannelType

type ChannelType string

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

const (
	ChannelAMP   ChannelType = "amp"
	ChannelApp   ChannelType = "app"
	ChannelVideo ChannelType = "video"
	ChannelWeb   ChannelType = "web"
	ChannelDOOH  ChannelType = "dooh"
)

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

type Compression

type Compression struct {
	Request  CompressionInfo `mapstructure:"request"`
	Response CompressionInfo `mapstructure:"response"`
}

type CompressionInfo

type CompressionInfo struct {
	GZIP bool `mapstructure:"enable_gzip"`
}

CompressionInfo defines what types of compression algorithms are supported.

func (*CompressionInfo) IsSupported

func (cfg *CompressionInfo) IsSupported(contentEncoding httputil.ContentEncoding) bool

type Configuration

type Configuration struct {
	ExternalURL      string      `mapstructure:"external_url"`
	Host             string      `mapstructure:"host"`
	Port             int         `mapstructure:"port"`
	UnixSocketEnable bool        `mapstructure:"unix_socket_enable"`
	UnixSocketName   string      `mapstructure:"unix_socket_name"`
	Client           HTTPClient  `mapstructure:"http_client"`
	CacheClient      HTTPClient  `mapstructure:"http_client_cache"`
	Admin            Admin       `mapstructure:"admin"`
	AdminPort        int         `mapstructure:"admin_port"`
	Compression      Compression `mapstructure:"compression"`
	// GarbageCollectorThreshold allocates virtual memory (in bytes) which is not used by PBS but
	// serves as a hack to trigger the garbage collector only when the heap reaches at least this size.
	// More info: https://github.com/golang/go/issues/48409
	GarbageCollectorThreshold int `mapstructure:"garbage_collector_threshold"`
	// 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"`
	TmaxAdjustments   TmaxAdjustments `mapstructure:"tmax_adjustments"`
	CacheURL          Cache           `mapstructure:"cache"`
	ExtCacheURL       ExternalCache   `mapstructure:"external_cache"`
	RecaptchaSecret   string          `mapstructure:"recaptcha_secret"`
	HostCookie        HostCookie      `mapstructure:"host_cookie"`
	Metrics           Metrics         `mapstructure:"metrics"`
	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"`
	StoredResponses StoredRequests `mapstructure:"stored_responses"`

	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
	// 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 bidrequest.id 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"`
	HostSChainNode    *openrtb2.SupplyChainNode `mapstructure:"host_schain_node"`
	// Experiment configures non-production ready features.
	Experiment Experiment `mapstructure:"experiment"`
	DataCenter string     `mapstructure:"datacenter"`
	// BidderInfos supports adapter overrides in extra configs like pbs.json, pbs.yaml, etc.
	// Refers to main.go `configFileName` constant
	BidderInfos BidderInfos `mapstructure:"adapters"`
	// Hooks provides a way to specify hook execution plan for specific endpoints and stages
	Hooks       Hooks       `mapstructure:"hooks"`
	Validations Validations `mapstructure:"validations"`
	PriceFloors PriceFloors `mapstructure:"price_floors"`
	// contains filtered or unexported fields
}

Configuration specifies the static application config.

func New

func New(v *viper.Viper, bidderInfos BidderInfos, normalizeBidderName func(string) (openrtb_ext.BidderName, bool)) (*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 CookieDeprecation added in v2.10.0

type CookieDeprecation struct {
	Enabled bool `mapstructure:"enabled"`
	TTLSec  int  `mapstructure:"ttl_sec"`
}

type CookieSync

type CookieSync struct {
	DefaultLimit    *int  `mapstructure:"default_limit" json:"default_limit"`
	MaxLimit        *int  `mapstructure:"max_limit" json:"max_limit"`
	DefaultCoopSync *bool `mapstructure:"default_coop_sync" json:"default_coop_sync"`
}

CookieSync represents the account-level defaults for the cookie sync endpoint.

type CurrencyConverter

type CurrencyConverter struct {
	FetchURL             string `mapstructure:"fetch_url"`
	FetchIntervalSeconds int    `mapstructure:"fetch_interval_seconds"`
	StaleRatesSeconds    int    `mapstructure:"stale_rates_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"
	ResponseDataType   DataType = "Response"
)

func (DataType) Section

func (dataType DataType) Section() string

Section returns the config section this type is defined in

type DatabaseCacheInitializer

type DatabaseCacheInitializer struct {
	Timeout int `mapstructure:"timeout_ms"`
	// Query should be something like:
	//
	// SELECT id, requestData, 'request' AS type FROM stored_requests
	// UNION ALL
	// 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/database/database.go
	Query string `mapstructure:"query"`
	// AmpQuery is just like Query, but for AMP Stored Requests
	AmpQuery string `mapstructure:"amp_query"`
}

type DatabaseConfig

type DatabaseConfig struct {
	ConnectionInfo      DatabaseConnection       `mapstructure:"connection"`
	FetcherQueries      DatabaseFetcherQueries   `mapstructure:"fetcher"`
	CacheInitialization DatabaseCacheInitializer `mapstructure:"initialize_caches"`
	PollUpdates         DatabaseUpdatePolling    `mapstructure:"poll_for_updates"`
}

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

type DatabaseConnection

type DatabaseConnection struct {
	Driver      string `mapstructure:"driver"`
	Database    string `mapstructure:"dbname"`
	Host        string `mapstructure:"host"`
	Port        int    `mapstructure:"port"`
	Username    string `mapstructure:"user"`
	Password    string `mapstructure:"password"`
	QueryString string `mapstructure:"query_string"`
	TLS         TLS    `mapstructure:"tls"`
}

DatabaseConnection has options which put types to the Database Connection string. See: https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters

type DatabaseFetcherQueries

type DatabaseFetcherQueries struct {
	// QueryTemplate is the Database 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"`
}

type DatabaseUpdatePolling

type DatabaseUpdatePolling 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 > $LAST_UPDATED
	// UNION ALL
	// SELECT id, impData, 'imp' AS type
	//   FROM stored_imps
	//   WHERE last_updated > $LAST_UPDATED
	//
	// 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 Debug

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

type DebugInfo

type DebugInfo struct {
	Allow bool `yaml:"allow" mapstructure:"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 want to stop collecting account debug request metrics
	AccountDebug bool `mapstructure:"account_debug"`

	// True if we want to stop collecting account stored respponses metrics
	AccountStoredResponses bool `mapstructure:"account_stored_responses"`

	// 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"`

	// True if we want to stop collecting account modules metrics
	AccountModulesMetrics bool `mapstructure:"account_modules_metrics"`
}

type Event

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

type Events

type Events struct {
	Enabled    bool        `mapstructure:"enabled" json:"enabled"`
	DefaultURL string      `mapstructure:"default_url" json:"default_url"`
	VASTEvents []VASTEvent `mapstructure:"vast_events" json:"vast_events,omitempty"`
}

Events indicates the various types of events to be captured typically for injecting tracker URLs within the VAST XML Don't enable this feature. It is still under developmment. Please follow https://github.com/prebid/prebid-server/issues/1725 for more updates

type Experiment

type Experiment struct {
	AdCerts ExperimentAdsCert `mapstructure:"adscert"`
}

Experiment defines if experimental features are available

type ExperimentAdsCert

type ExperimentAdsCert struct {
	Mode      string           `mapstructure:"mode"`
	InProcess AdsCertInProcess `mapstructure:"inprocess"`
	Remote    AdsCertRemote    `mapstructure:"remote"`
}

ExperimentAdsCert configures and enables functionality to generate and send Ads Cert Auth header to bidders

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 geo.country 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 HookExecutionGroup

type HookExecutionGroup struct {
	// Timeout specified in milliseconds.
	// Zero value marks the hook execution status with the "timeout" value.
	Timeout      int `mapstructure:"timeout" json:"timeout"`
	HookSequence []struct {
		// ModuleCode is a composite value in the format: {vendor_name}.{module_name}
		ModuleCode string `mapstructure:"module_code" json:"module_code"`
		// HookImplCode is an arbitrary value, used to identify hook when sending metrics, debug information, etc.
		HookImplCode string `mapstructure:"hook_impl_code" json:"hook_impl_code"`
	} `mapstructure:"hook_sequence" json:"hook_sequence"`
}

type HookExecutionPlan

type HookExecutionPlan struct {
	Endpoints map[string]struct {
		Stages map[string]struct {
			Groups []HookExecutionGroup `mapstructure:"groups" json:"groups"`
		} `mapstructure:"stages" json:"stages"`
	} `mapstructure:"endpoints" json:"endpoints"`
}

type Hooks

type Hooks struct {
	Enabled bool    `mapstructure:"enabled"`
	Modules Modules `mapstructure:"modules"`
	// HostExecutionPlan defined by the host company and is executed always
	HostExecutionPlan HookExecutionPlan `mapstructure:"host_execution_plan"`
	// DefaultAccountExecutionPlan can be replaced by the account-specific hook execution plan
	DefaultAccountExecutionPlan HookExecutionPlan `mapstructure:"default_account_execution_plan"`
}

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 IPv4

type IPv4 struct {
	AnonKeepBits int `mapstructure:"anon_keep_bits" json:"anon_keep_bits"`
}

func (*IPv4) Validate

func (ip *IPv4) Validate(errs []error) []error

type IPv6

type IPv6 struct {
	AnonKeepBits int `mapstructure:"anon_keep_bits" json:"anon_keep_bits"`
}

func (*IPv6) Validate

func (ip *IPv6) Validate(errs []error) []error

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"`
	// ResponsesCacheSize is the max number of bytes allowed in the cache for Stored Responses. Values <= 0 will have no limit
	RespCacheSize int `mapstructure:"resp_cache_size_bytes"`
}

type InfluxMetrics

type InfluxMetrics struct {
	Host               string `mapstructure:"host"`
	Database           string `mapstructure:"database"`
	Measurement        string `mapstructure:"measurement"`
	Username           string `mapstructure:"username"`
	Password           string `mapstructure:"password"`
	AlignTimestamps    bool   `mapstructure:"align_timestamps"`
	MetricSendInterval int    `mapstructure:"metric_send_interval"`
}

type InfoReader

type InfoReader interface {
	Read() (map[string][]byte, error)
}

type InfoReaderFromDisk

type InfoReaderFromDisk struct {
	Path string
}

func (InfoReaderFromDisk) Read

func (r InfoReaderFromDisk) Read() (map[string][]byte, error)

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" mapstructure:"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 Modules

type Modules map[string]map[string]interface{}

Modules mapping provides module specific configuration, format: map[vendor_name]map[module_name]interface{} actual configuration parsing performed by modules

type OpenRTBInfo

type OpenRTBInfo struct {
	Version      string `yaml:"version" mapstructure:"version"`
	GPPSupported bool   `yaml:"gpp-supported" mapstructure:"gpp-supported"`
}

OpenRTBInfo specifies the versions/aspects of openRTB that a bidder supports Version is not yet actively supported GPPSupported is not yet actively supported

type PlatformInfo

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

PlatformInfo specifies the supported media types for a bidder.

type PriceFloorFetcher added in v2.1.0

type PriceFloorFetcher struct {
	HttpClient HTTPClient `mapstructure:"http_client"`
	CacheSize  int        `mapstructure:"cache_size_mb"`
	Worker     int        `mapstructure:"worker"`
	Capacity   int        `mapstructure:"capacity"`
	MaxRetries int        `mapstructure:"max_retries"`
}

type PriceFloors

type PriceFloors struct {
	Enabled bool              `mapstructure:"enabled"`
	Fetcher PriceFloorFetcher `mapstructure:"fetcher"`
}

type Privacy

type Privacy struct {
	CCPA CCPA
	GDPR GDPR
	LMT  LMT
}

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

type PrivacySandbox added in v2.10.0

type PrivacySandbox struct {
	CookieDeprecation CookieDeprecation `mapstructure:"cookiedeprecation"`
}

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 Server

type Server struct {
	ExternalUrl string
	GvlID       int
	DataCenter  string
}

func (*Server) Empty

func (server *Server) Empty() bool

type SkipWhen added in v2.1.0

type SkipWhen struct {
	GDPR   bool     `yaml:"gdpr" mapstructure:"gdpr"`
	GPPSID []string `yaml:"gpp_sid" mapstructure:"gpp_sid"`
}

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"`
	// Database configures Fetchers and EventProducers which read from a Database.
	// Fetchers are in stored_requests/backends/db_fetcher/fetcher.go
	// EventProducers are in stored_requests/events/database
	Database DatabaseConfig `mapstructure:"database"`
	// 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

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"`

	// 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" mapstructure:"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"`

	// ExternalURL is available as a macro to the RedirectURL template.
	ExternalURL string `yaml:"externalUrl" mapstructure:"external_url"`

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

	// FormatOverride allows a bidder to override their callback type "b" for iframe, "i" for redirect
	FormatOverride string `yaml:"formatOverride" mapstructure:"format_override"`

	// Enabled signifies whether a bidder is enabled/disabled for user sync
	Enabled *bool `yaml:"enabled" mapstructure:"enabled"`

	// SkipWhen allows bidders to specify when they don't want to sync
	SkipWhen *SkipWhen `yaml:"skipwhen" mapstructure:"skipwhen"`
}

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

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

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: https://golang.org/pkg/text/template/
	//
	//  {{.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.
	//  {{.GPP}}		 - This will be replaced with the "gpp" property sent to /cookie_sync.
	//  {{.GPPSID}}		 - This will be replaced with the "gpp_sid" 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.
	//  {{.BidderName}}  - This will be replaced with the bidder name.
	//  {{.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}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&f={{.SyncType}}&uid={{.UserMacro}}`
	RedirectURL string `yaml:"redirectUrl" mapstructure:"redirect_url"`

	// ExternalURL is available as a macro to the RedirectURL template. If not specified, either the syncer configuration
	// value or 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: "https://sync.bidderserver.com/usersync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&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

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"`
	// Map of purpose configs for easy purpose lookup
	PurposeConfigs      map[consentconstants.Purpose]*TCF2Purpose
	SpecialFeature1     TCF2SpecialFeature      `mapstructure:"special_feature1"`
	PurposeOneTreatment TCF2PurposeOneTreatment `mapstructure:"purpose_one_treatment"`
}

TCF2 defines the TCF2 specific configurations for GDPR

func (*TCF2) ChannelEnabled

func (t *TCF2) ChannelEnabled(channelType ChannelType) bool

ChannelEnabled checks if a given channel type is enabled. All channel types are considered either enabled or disabled based on the Enabled flag.

func (*TCF2) FeatureOneEnforced

func (t *TCF2) FeatureOneEnforced() bool

FeatureOneEnforced checks if special feature one is enforced. If it is enforced, PBS will determine whether geo information may be passed through in the bid request.

func (*TCF2) FeatureOneVendorException

func (t *TCF2) FeatureOneVendorException(bidder openrtb_ext.BidderName) bool

FeatureOneVendorException checks if the specified bidder is considered a vendor exception for special feature one. If a bidder is a vendor exception, PBS will bypass the pass geo calculation passing the geo information in the bid request.

func (*TCF2) IsEnabled

func (t *TCF2) IsEnabled() bool

IsEnabled indicates if TCF2 is enabled

func (*TCF2) PurposeEnforced

func (t *TCF2) PurposeEnforced(purpose consentconstants.Purpose) (enforce bool)

PurposeEnforced checks if full enforcement is turned on for a given purpose. With full enforcement enabled, the GDPR full enforcement algorithm will execute for that purpose determining legal basis; otherwise it's skipped.

func (*TCF2) PurposeEnforcementAlgo

func (t *TCF2) PurposeEnforcementAlgo(purpose consentconstants.Purpose) (enforcement TCF2EnforcementAlgo)

PurposeEnforcementAlgo returns the default enforcement algorithm for a given purpose

func (*TCF2) PurposeEnforcingVendors

func (t *TCF2) PurposeEnforcingVendors(purpose consentconstants.Purpose) (enforce bool)

PurposeEnforcingVendors checks if enforcing vendors is turned on for a given purpose. With enforcing vendors enabled, the GDPR full enforcement algorithm considers the GVL when determining legal basis; otherwise it's skipped.

func (*TCF2) PurposeOneTreatmentAccessAllowed

func (t *TCF2) PurposeOneTreatmentAccessAllowed() bool

PurposeOneTreatmentAccessAllowed checks if purpose one treatment access is allowed.

func (*TCF2) PurposeOneTreatmentEnabled

func (t *TCF2) PurposeOneTreatmentEnabled() bool

PurposeOneTreatmentEnabled checks if purpose one treatment is enabled.

func (*TCF2) PurposeVendorExceptions

func (t *TCF2) PurposeVendorExceptions(purpose consentconstants.Purpose) (vendorExceptions map[string]struct{})

PurposeVendorExceptions returns the vendor exception map for a given purpose if it exists, otherwise it returns an empty map of vendor exceptions

type TCF2EnforcementAlgo

type TCF2EnforcementAlgo int
const (
	TCF2UndefinedEnforcement TCF2EnforcementAlgo = iota
	TCF2BasicEnforcement
	TCF2FullEnforcement
)

type TCF2Purpose

type TCF2Purpose struct {
	EnforceAlgo string `mapstructure:"enforce_algo"`
	// Integer representation of enforcement algo for performance improvement on compares
	EnforceAlgoID  TCF2EnforcementAlgo
	EnforcePurpose bool `mapstructure:"enforce_purpose"`
	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   []string `mapstructure:"vendor_exceptions"`
	VendorExceptionMap map[string]struct{}
}

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

type TCF2PurposeOneTreatment

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

type TCF2SpecialFeature

type TCF2SpecialFeature struct {
	Enforce bool `mapstructure:"enforce"`
	// 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{}
}

type TLS

type TLS struct {
	RootCert   string `mapstructure:"root_cert"`
	ClientCert string `mapstructure:"client_cert"`
	ClientKey  string `mapstructure:"client_key"`
}

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 TmaxAdjustments

type TmaxAdjustments struct {
	// Enabled indicates whether bidder tmax should be calculated and passed on to bid adapters
	Enabled bool `mapstructure:"enabled"`
	// BidderNetworkLatencyBuffer accounts for network delays between PBS and bidder servers.
	// A value of 0 indicates no network latency buffer should be accounted for when calculating the bidder tmax.
	BidderNetworkLatencyBuffer uint `mapstructure:"bidder_network_latency_buffer_ms"`
	// PBSResponsePreparationDuration accounts for amount of time required for PBS to process all bidder responses and generate final response for a request.
	// A value of 0 indicates PBS response preparation time shouldn't be accounted for when calculating bidder tmax.
	PBSResponsePreparationDuration uint `mapstructure:"pbs_response_preparation_duration_ms"`
	// BidderResponseDurationMin is the minimum amount of time expected to get a response from a bidder request.
	// PBS won't send a request to the bidder if the bidder tmax calculated is less than the BidderResponseDurationMin value
	BidderResponseDurationMin uint `mapstructure:"bidder_response_duration_min_ms"`
}

Tmax Adjustments enables PBS to estimate the tmax value for bidders, indicating the allotted time for them to respond to a request. It's important to note that the calculated tmax is just an estimate and will not be entirely precise. PBS will calculate the bidder tmax as follows: bidderTmax = request.tmax - reqProcessingTime - BidderNetworkLatencyBuffer - PBSResponsePreparationDuration Note that reqProcessingTime is time taken by PBS to process a given request before it is sent to bid adapters and is computed at run time.

type TrackingEventType

type TrackingEventType string

TrackingEventType indicates quartile events

const (
	Start         TrackingEventType = "start"
	FirstQuartile TrackingEventType = "firstQuartile"
	MidPoint      TrackingEventType = "midPoint"
	ThirdQuartile TrackingEventType = "thirdQuartile"
	Complete      TrackingEventType = "complete"
)

type UserSync

type UserSync struct {
	Cooperative    UserSyncCooperative `mapstructure:"coop_sync"`
	ExternalURL    string              `mapstructure:"external_url"`
	RedirectURL    string              `mapstructure:"redirect_url"`
	PriorityGroups [][]string          `mapstructure:"priority_groups"`
}

UserSync specifies the static global user sync configuration.

type UserSyncCooperative

type UserSyncCooperative struct {
	EnabledByDefault bool `mapstructure:"default"`
}

UserSyncCooperative specifies the static global default cooperative cookie sync

type VASTEvent

type VASTEvent struct {
	CreateElement     VASTEventElement  `mapstructure:"create_element" json:"create_element"`
	Type              TrackingEventType `mapstructure:"type" json:"type"`
	ExcludeDefaultURL bool              `mapstructure:"exclude_default_url" json:"exclude_default_url"`
	URLs              []string          `mapstructure:"urls" json:"urls"`
}

VASTEvent indicates the configurations required for injecting VAST event trackers within VAST XML

type VASTEventElement

type VASTEventElement string

VASTEventElement indicates valid VAST event element

const (
	ImpressionVASTElement             VASTEventElement = "impression"
	TrackingVASTElement               VASTEventElement = "tracking"
	ClickTrackingVASTElement          VASTEventElement = "clicktracking"
	CompanionClickThroughVASTElement  VASTEventElement = "companionclickthrough"
	ErrorVASTElement                  VASTEventElement = "error"
	NonLinearClickTrackingVASTElement VASTEventElement = "nonlinearclicktracking"
)

type VTrack

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

type Validations

type Validations struct {
	BannerCreativeMaxSize string `mapstructure:"banner_creative_max_size" json:"banner_creative_max_size"`
	SecureMarkup          string `mapstructure:"secure_markup" json:"secure_markup"`
	MaxCreativeWidth      int64  `mapstructure:"max_creative_width" json:"max_creative_width"`
	MaxCreativeHeight     int64  `mapstructure:"max_creative_height" json:"max_creative_height"`
}

func (*Validations) SetBannerCreativeMaxSize

func (host *Validations) SetBannerCreativeMaxSize(account Validations)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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