yandex

package
v0.0.0-...-6394218 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTUI

func RunTUI(client *Client) error

Types

type Client

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

func NewClient

func NewClient(cfg *Config) *Client

func (*Client) GetIPv4

func (c *Client) GetIPv4() (string, error)

func (*Client) GetIPv6

func (c *Client) GetIPv6() (string, error)

func (*Client) GetISP

func (c *Client) GetISP() (*ISPInfo, error)

func (*Client) GetProbes

func (c *Client) GetProbes() (*ProbesResponse, error)

func (*Client) GetRegion

func (c *Client) GetRegion() (string, error)

func (*Client) GetServerTime

func (c *Client) GetServerTime() (string, error)

func (*Client) RunSpeedTest

func (c *Client) RunSpeedTest(ctx context.Context, progress ProgressFunc) (*SpeedResult, error)

type Config

type Config struct {
	BaseURL     string
	UserAgent   string
	Timeout     time.Duration
	Language    string // "ru" or "en"
	Concurrency int
}

type FullInfo

type FullInfo struct {
	IPv4      string `json:"ipv4"`
	IPv6      string `json:"ipv6"`
	Region    string `json:"region"`
	Browser   string `json:"browser"`
	OS        string `json:"os"`
	Timestamp string `json:"timestamp"`
}

type IPResponse

type IPResponse struct {
	IP string `json:"ip"`
}

type ISPInfo

type ISPInfo struct {
	Name string `json:"name"`
	ASN  int    `json:"asn"`
}

type Probe

type Probe struct {
	URL     string `json:"url"`
	Timeout int    `json:"timeout,omitempty"`
}

type ProbesResponse

type ProbesResponse struct {
	MID     string   `json:"mid"`
	LID     []string `json:"lid"`
	Latency struct {
		Probes []Probe `json:"probes"`
	} `json:"latency"`
	Download struct {
		Probes []Probe `json:"probes"`
	} `json:"download"`
	Upload struct {
		Warmup struct {
			Duration int `json:"duration"`
			Probes   []struct {
				URLs  []string `json:"urls"`
				Size  int      `json:"size"`
				Count int      `json:"count"`
			} `json:"probes"`
		} `json:"warmup"`
		Probes []struct {
			Size int    `json:"size"`
			URL  string `json:"url"`
		} `json:"probes"`
	} `json:"upload"`
}

type ProgressFunc

type ProgressFunc func(ProgressReport)

type ProgressReport

type ProgressReport struct {
	Bytes      int64
	IsDownload bool
}

type RegionInfo

type RegionInfo struct {
	Name string `json:"name"`
}

type SpeedResult

type SpeedResult struct {
	DownloadMbps float64
	UploadMbps   float64
	Latency      time.Duration
}

type UploadProbeGroup

type UploadProbeGroup struct {
	Duration int `json:"duration"`
	Probes   []struct {
		Paths []string `json:"urls"`
		Size  int      `json:"size"`
		Count int      `json:"count"`
	} `json:"probes"`
}

Jump to

Keyboard shortcuts

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