server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server hosts the speed-test endpoints and the embedded web UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) *http.Server

New returns an *http.Server wired up with the speed-test handlers and the embedded web UI. Caller is responsible for ListenAndServe.

Types

type Config

type Config struct {
	Addr           string        // e.g. ":8080"
	MaxDownloadMiB int64         // safety cap, default 1024 (1 GiB)
	MaxUploadMiB   int64         // safety cap, default 1024
	ReadTimeout    time.Duration // per request, default 60s — uploads can be large
	IPInfoToken    string        // optional ipinfo.io token for richer ISP data
}

Config controls the HTTP server.

type InfoResponse

type InfoResponse struct {
	ClientIP   string `json:"client_ip"`
	ISP        string `json:"isp,omitempty"`
	City       string `json:"city,omitempty"`
	Region     string `json:"region,omitempty"`
	Country    string `json:"country,omitempty"`
	ServerHost string `json:"server_host"`
	ServerTime string `json:"server_time"`
}

InfoResponse is what /api/info returns.

Jump to

Keyboard shortcuts

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