device

package
v0.0.0-...-e66327c Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AuthKey  string         `yaml:"auth_key"`
	ZoneMaps []*ZoneMapSpec `yaml:"zone_maps"`
}

Config stores options for the device info manager.

type DeviceID

type DeviceID []byte

DeviceID is an opaque random device identifier.

func (DeviceID) String

func (d DeviceID) String() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager can provide DeviceInfo entries for incoming HTTP requests.

func New

func New(config *Config, urlPrefix string) (*Manager, error)

New returns a new Manager with the given configuration.

func (*Manager) GetDeviceInfoFromRequest

func (m *Manager) GetDeviceInfoFromRequest(w http.ResponseWriter, req *http.Request) *usermetadb.DeviceInfo

GetDeviceInfoFromRequest will retrieve or create a DeviceInfo object for the given request. It will always return a valid object. The ResponseWriter is needed to store the unique ID on the client when a new device info object is created.

type ZoneMapSpec

type ZoneMapSpec struct {
	Type           string   `yaml:"type"`
	GeoIPDataFiles []string `yaml:"geoip_data_files"`
	Path           string   `yaml:"path"`
	Value          string   `yaml:"value"`
}

ZoneMapSpec describes ip -> zone lookup maps.

Jump to

Keyboard shortcuts

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