speedtest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServerConn

func NewServerConn() net.Conn

NewServerConn creates a new "pseudo" connection that implements the speed test protocol. It's called "pseudo" because it's not a real TCP connection - everything is done in memory.

Types

type Client

type Client struct {
	Conn net.Conn
}

func (*Client) Download

func (c *Client) Download(l uint32, cb func(time.Duration, uint32, bool)) error

Download requests the server to send l bytes of data. The callback function cb is called every second with the time since the last call, and the number of bytes received in that time.

func (*Client) Upload

func (c *Client) Upload(l uint32, cb func(time.Duration, uint32, bool)) error

Upload requests the server to receive l bytes of data. The callback function cb is called every second with the time since the last call, and the number of bytes sent in that time.

Jump to

Keyboard shortcuts

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