gslbcore

package
v0.0.0-...-7ddeb54 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchPoPStatusOverHTTP

func FetchPoPStatusOverHTTP(ctx context.Context, ip netip.Addr) (*types.PoPStatus, error)

Types

type AnnotatedLookup

type AnnotatedLookup struct {
	Ip    netip.Addr `json:"ip"`
	PopId string     `json:"pop_id"`
}

type Config

type Config struct {
	Pops         []types.PoPInfo
	Regions      []types.RegionInfo
	ProberSecret string
	HTTPServer   string

	FetchPoPStatus      FetchPoPStatusFunc
	MakeLatencyMeasurer MakeLatencyMeasurerFunc
}

type FetchPoPStatusFunc

type FetchPoPStatusFunc func(ctx context.Context, ip netip.Addr) (*types.PoPStatus, error)

FetchPoPStatus is a function that fetches PoP status from a PoP.

type GslbCore

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

func New

func New(cfg *Config) *GslbCore

func (*GslbCore) PopIdFromIP

func (c *GslbCore) PopIdFromIP(ip netip.Addr) string

func (*GslbCore) Query

func (c *GslbCore) Query(srcIP netip.Addr) []netip.Addr

func (*GslbCore) Run

func (c *GslbCore) Run(ctx context.Context) error

func (*GslbCore) Serial

func (c *GslbCore) Serial() uint32

func (*GslbCore) UpdateLatency

func (c *GslbCore) UpdateLatency(ctx context.Context)

func (*GslbCore) UpdatePoPStatus

func (c *GslbCore) UpdatePoPStatus(ctx context.Context)

type LatencyMeasurer

type LatencyMeasurer interface {
	DebugString() string

	// MeasureLatency is a function that measures the latency to the `url`.
	MeasureLatency(ctx context.Context, endpointUrl string) (float64, error)
}

type MakeLatencyMeasurerFunc

type MakeLatencyMeasurerFunc func(proberURL, secret string) LatencyMeasurer

type ProbeOverJSONRPC

type ProbeOverJSONRPC struct {
	ProberURL string
	Secret    string
}

func (ProbeOverJSONRPC) DebugString

func (p ProbeOverJSONRPC) DebugString() string

func (ProbeOverJSONRPC) MeasureLatency

func (p ProbeOverJSONRPC) MeasureLatency(ctx context.Context, url string) (float64, error)

type RegionState

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

Jump to

Keyboard shortcuts

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