vendorlist

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vendor

type Vendor interface {
	// Purpose returns true if this vendor claims to use data for the given purpose, or false otherwise
	Purpose(purposeID consentconstants.Purpose) bool

	// LegitimateInterest retursn true if this vendor claims a "Legitimate Interest" to
	// use data for the given purpose.
	//
	// For an explanation of legitimate interest, see https://www.gdpreu.org/the-regulation/key-concepts/legitimate-interest/
	LegitimateInterest(purposeID consentconstants.Purpose) bool
}

Vendor describes which purposes a given vendor claims to use data for, in this vendor list.

type VendorList

type VendorList interface {
	// Version returns the version of the vendor list which this is.
	//
	// If the input was malformed, this will return 0.
	Version() uint16

	// Vendor returns info about the vendor with the given ID.
	// This returns nil if that vendor isn't in this list, or the input was malformed somehow.
	//
	// If callers need to query multiple Purpose or LegitimateInterest statuses from the same vendor,
	// they should call this function once and then reuse the object it returns for future queries.
	Vendor(vendorID uint16) Vendor
}

VendorList is an interface used to fetch information about an IAB Global Vendor list. For the latest version, see: https://vendorlist.consensu.org/vendorlist.json

func ParseEagerly

func ParseEagerly(data []byte) (VendorList, error)

ParseEagerly interprets and validates the Vendor List data up front, before returning it. The returned object can be shared safely between goroutines.

This is ideal if:

  1. You plan to call functions on the returned VendorList many times before discarding it.
  2. You need strong input validation and good error messages.

Otherwise, you may get better performance with ParseLazily.

func ParseLazily

func ParseLazily(data []byte) VendorList

ParseLazily returns a view of the data which re-calculates things on each function call. The returned object can be shared safely between goroutines.

This is ideal if:

  1. You only need to look up a few vendors or purpose IDs
  2. You don't need good errors on malformed input

Otherwise, you may get better performance with ParseEagerly.

Jump to

Keyboard shortcuts

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