crconfig

package
v5.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const CDNSOAAdmin = "traffic_ops"
View Source
const CDNSOAExpire = 604800 * time.Second
View Source
const CDNSOAMinimum = 30 * time.Second
View Source
const CDNSOARefresh = 28800 * time.Second
View Source
const CDNSOARetry = 7200 * time.Second
View Source
const DefaultTLDTTLNS = 3600 * time.Second
View Source
const DefaultTLDTTLSOA = 86400 * time.Second
View Source
const DefaultWeight = 0.999
View Source
const DefaultWeightMultiplier = 1000.0
View Source
const EdgeTypePrefix = "EDGE"
View Source
const GeoProviderMaxmindStr = "maxmindGeolocationService"
View Source
const GeoProviderNeustarStr = "neustarGeolocationService"
View Source
const MidTypePrefix = "MID"
View Source
const MonitorTypeName = "RASCAL"
View Source
const RouterTypeName = "CCR"

Variables

This section is empty.

Functions

func GetSnapshot

func GetSnapshot(tx *sql.Tx, cdn string) (string, bool, error)

GetSnapshot gets the snapshot for the given CDN. If the CDN does not exist, false is returned. If the CDN exists, but the snapshot does not, the string for an empty JSON object "{}" is returned. An error is only returned on database error, never if the CDN or snapshot does not exist.

func GetSnapshotMonitoring

func GetSnapshotMonitoring(tx *sql.Tx, cdn string) (string, bool, error)

GetSnapshotMonitoring gets the monitor snapshot for the given CDN. If the CDN does not exist, false is returned. If the CDN exists, but the snapshot does not, the string for an empty JSON object "{}" is returned. An error is only returned on database error, never if the CDN or snapshot does not exist. Because all snapshotting is handled by the crconfig endpoints we have to also do the monitoring one here as well

func Handler

func Handler(w http.ResponseWriter, r *http.Request)

Handler creates and serves the CRConfig from the raw SQL data. This MUST only be used for debugging or previewing, the raw un-snapshotted data MUST NOT be used by any component of the CDN.

func Make

func Make(tx *sql.Tx, cdn, user, toHost, reqPath, toVersion string, useClientReqHost bool, emulateOldPath bool) (*tc.CRConfig, error)

Make creates and returns the CRConfig from the database.

func Snapshot

func Snapshot(tx *sql.Tx, crc *tc.CRConfig, monitoringJSON *monitoring.Monitoring) error

Snapshot takes the CRConfig JSON-serializable object (which may be generated via crconfig.Make), and writes it to the snapshot table. It also takes the monitoring config JSON and writes it to the snapshot table.

func SnapshotGetHandler

func SnapshotGetHandler(w http.ResponseWriter, r *http.Request)

SnapshotGetHandler gets and serves the CRConfig from the snapshot table.

func SnapshotGetMonitoringHandler

func SnapshotGetMonitoringHandler(w http.ResponseWriter, r *http.Request)

SnapshotGetMonitoringHandler gets and serves the CRConfig from the snapshot table.

func SnapshotGetMonitoringLegacyHandler

func SnapshotGetMonitoringLegacyHandler(w http.ResponseWriter, r *http.Request)

func SnapshotHandler

func SnapshotHandler(w http.ResponseWriter, r *http.Request)

SnapshotHandler creates the CRConfig JSON and writes it to the snapshot table in the database.

func SnapshotHandlerDeprecated

func SnapshotHandlerDeprecated(w http.ResponseWriter, r *http.Request)

SnapshotHandlerDeprecated creates the CRConfig JSON and writes it to the snapshot table in the database for deprecated routes.

func SnapshotOldGUIHandler

func SnapshotOldGUIHandler(w http.ResponseWriter, r *http.Request)

SnapshotGUIHandler creates the CRConfig JSON and writes it to the snapshot table in the database. The response emulates the old Perl UI function. This should go away when the old Perl UI ceases to exist.

func SnapshotOldGetHandler

func SnapshotOldGetHandler(w http.ResponseWriter, r *http.Request)

SnapshotOldGetHandler gets and serves the CRConfig from the snapshot table, not wrapped in response to match the old non-API CRConfig-Snapshots endpoint

Types

type CRConfigConfigMaxmindDefaultOverride

type CRConfigConfigMaxmindDefaultOverride struct {
	CountryCode string  `json:"countryCode"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"long"`
}

type CRConfigConfigParameter

type CRConfigConfigParameter struct {
	Name  string
	Value string
}

type DSRouteInfo

type DSRouteInfo struct {
	IsDNS bool
	IsRaw bool
	Remap string
}

type ServerAndHost

type ServerAndHost struct {
	Server ServerUnion
	Host   string
}

type ServerParams

type ServerParams struct {
	APIPort          *string
	SecureAPIPort    *string
	Weight           *float64
	WeightMultiplier *float64
}

ServerParams contains parameter data filled in the CRConfig Servers objects. If a given param doesn't exist on the given server, it will be nil.

type ServerUnion

type ServerUnion struct {
	tc.CRConfigTrafficOpsServer
	APIPort       *string
	SecureAPIPort *string
}

ServerUnion has all fields from all servers. This is used to select all server data with a single query, and then convert each to the proper type afterwards.

Jump to

Keyboard shortcuts

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