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

networkquality

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: GPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfigURL = "https://mensura.cdn-apple.com/api/v1/gm/config"
View Source
const DefaultMaxRuntime = 20 * time.Second

Variables

This section is empty.

Functions

func FormatBitrate

func FormatBitrate(bps int64) string

func NewHTTPClient

func NewHTTPClient(dialer N.Dialer) *http.Client

Types

type Accuracy

type Accuracy int32
const (
	AccuracyLow    Accuracy = 0
	AccuracyMedium Accuracy = 1
	AccuracyHigh   Accuracy = 2
)

func (Accuracy) String

func (a Accuracy) String() string

type Config

type Config struct {
	Version      int    `json:"version"`
	TestEndpoint string `json:"test_endpoint"`
	URLs         URLs   `json:"urls"`
}

type MeasurementClientFactory

type MeasurementClientFactory func(
	connectEndpoint string,
	singleConnection bool,
	disableKeepAlives bool,
	readCounters []N.CountFunc,
	writeCounters []N.CountFunc,
) (*http.Client, error)

func NewHTTP3MeasurementClientFactory

func NewHTTP3MeasurementClientFactory(dialer N.Dialer) (MeasurementClientFactory, error)

func NewOptionalHTTP3Factory

func NewOptionalHTTP3Factory(dialer N.Dialer, useHTTP3 bool) (MeasurementClientFactory, error)

type Options

type Options struct {
	ConfigURL            string
	HTTPClient           *http.Client
	NewMeasurementClient MeasurementClientFactory
	Serial               bool
	MaxRuntime           time.Duration
	OnProgress           func(Progress)
	Context              context.Context
}

type Phase

type Phase int32
const (
	PhaseIdle     Phase = 0
	PhaseDownload Phase = 1
	PhaseUpload   Phase = 2
	PhaseDone     Phase = 3
)

type Progress

type Progress struct {
	Phase                    Phase
	DownloadCapacity         int64
	UploadCapacity           int64
	DownloadRPM              int32
	UploadRPM                int32
	IdleLatencyMs            int32
	ElapsedMs                int64
	DownloadCapacityAccuracy Accuracy
	UploadCapacityAccuracy   Accuracy
	DownloadRPMAccuracy      Accuracy
	UploadRPMAccuracy        Accuracy
}

type Result

type Result struct {
	DownloadCapacity         int64
	UploadCapacity           int64
	DownloadRPM              int32
	UploadRPM                int32
	IdleLatencyMs            int32
	DownloadCapacityAccuracy Accuracy
	UploadCapacityAccuracy   Accuracy
	DownloadRPMAccuracy      Accuracy
	UploadRPMAccuracy        Accuracy
}

func Run

func Run(options Options) (*Result, error)

type URLs

type URLs struct {
	SmallHTTPSDownloadURL string `json:"small_https_download_url"`
	LargeHTTPSDownloadURL string `json:"large_https_download_url"`
	HTTPSUploadURL        string `json:"https_upload_url"`
	SmallDownloadURL      string `json:"small_download_url"`
	LargeDownloadURL      string `json:"large_download_url"`
	UploadURL             string `json:"upload_url"`
}

Jump to

Keyboard shortcuts

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