Help us shape the future of Go! Take the 2026 Go Developer Survey

data

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataProviderNameRIPEAtlas  = "ripeatlas"
	DataProviderNameWheresitup = "wheresitup"
)
View Source
const (
	DefaultMaxPoints = 1000
)

Variables

View Source
var (
	ErrInvalidEnvironment = fmt.Errorf("invalid environment")
)

Functions

func NewProvider

func NewProvider(cfg *ProviderConfig) (*provider, error)

Types

type Circuit

type Circuit struct {
	Code           string   `json:"code"`
	OriginExchange Exchange `json:"origin_exchange"`
	TargetExchange Exchange `json:"target_exchange"`
}

type CircuitLatenciesWithHeader

type CircuitLatenciesWithHeader struct {
	Header  *telemetry.InternetLatencySamplesHeader
	Samples []datastats.CircuitLatencySample
}

type EpochRange

type EpochRange struct {
	From uint64
	To   uint64
}

type Exchange

type Exchange struct {
	PK        solana.PublicKey `json:"pk"`
	Code      string           `json:"code"`
	Name      string           `json:"name"`
	Latitude  float64          `json:"latitude"`
	Longitude float64          `json:"longitude"`
}

type GetCircuitLatenciesConfig

type GetCircuitLatenciesConfig struct {
	Epochs       *EpochRange
	Time         *TimeRange
	MaxPoints    uint64
	Interval     time.Duration
	Unit         Unit
	Circuit      string
	DataProvider string
}

type Provider

type Provider interface {
	GetCircuits(ctx context.Context) ([]Circuit, error)
	GetCircuitLatencies(ctx context.Context, cfg GetCircuitLatenciesConfig) ([]stats.CircuitLatencyStat, error)
}

type ProviderConfig

type ProviderConfig struct {
	Logger               *slog.Logger
	ServiceabilityClient ServiceabilityClient
	TelemetryClient      TelemetryClient
	EpochFinder          epoch.Finder
	AgentPK              solana.PublicKey

	CircuitsCacheTTL               time.Duration
	HistoricEpochLatenciesCacheTTL time.Duration
	CurrentEpochLatenciesCacheTTL  time.Duration
	GetCircuitLatenciesPoolSize    int
}

func (*ProviderConfig) Validate

func (c *ProviderConfig) Validate() error

type Server

type Server struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log *slog.Logger, mainnetProvider, testnetProvider, devnetProvider Provider) (*Server, error)

type ServiceabilityClient

type ServiceabilityClient interface {
	GetProgramData(ctx context.Context) (*serviceability.ProgramData, error)
}

type TelemetryClient

type TelemetryClient interface {
	GetInternetLatencySamples(ctx context.Context, dataProvider string, originExchangePK, targetExchangePK solana.PublicKey, agentPK solana.PublicKey, epoch uint64) (*telemetry.InternetLatencySamples, error)
}

type TimeRange

type TimeRange struct {
	From time.Time
	To   time.Time
}

type Unit

type Unit string
const (
	UnitMillisecond Unit = "ms"
	UnitMicrosecond Unit = "us"
)

Jump to

Keyboard shortcuts

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