librespeed

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoServers = errors.New("no servers available")
	ErrInternet  = errors.New("internet error. Please try again later")
)

Functions

This section is empty.

Types

type Client

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

Client represents a LibreSpeed speed test client

func New

func New() *Client

New creates a new LibreSpeed client

func (*Client) Init

func (c *Client) Init() error

Init initializes the client by finding the best server

func (*Client) IsAvailable

func (c *Client) IsAvailable() bool

IsAvailable checks if LibreSpeed is accessible

func (*Client) MeasureDownload

func (c *Client) MeasureDownload(speedChan chan<- float64) error

MeasureDownload measures download speed (implements Provider interface)

func (*Client) MeasureJitter

func (c *Client) MeasureJitter(samples int) (time.Duration, error)

func (*Client) MeasureLatency

func (c *Client) MeasureLatency() (time.Duration, error)

MeasureLatency measures the round-trip time (implements Provider interface)

func (*Client) MeasureUpload

func (c *Client) MeasureUpload(duration time.Duration, speedChan chan<- float64) error

MeasureUpload measures upload speed (implements Provider interface)

func (*Client) Name

func (c *Client) Name() string

Name returns the provider name

type Server

type Server struct {
	URL  string  `json:"url"`
	Name string  `json:"name"`
	Ping float64 `json:"ping"`
}

Server represents a LibreSpeed server

Jump to

Keyboard shortcuts

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