This commit is contained in:
Diego Fernando Carrión 2024-10-21 22:56:04 +02:00
parent 994b9215f6
commit 2752be4a23
Signed by: CRThaze
GPG Key ID: 8279B79A1A7F8194

84
main.go
View File

@ -16,15 +16,15 @@ import (
)
const (
bandwidthScale = 125000.0
defaultListenPort = 9090
defaultListenAddr = "0.0.0.0"
defaultTestPeriod = 5
bandwidthScale = 125000.0
defaultListenPort = 9090
defaultListenAddr = "0.0.0.0"
defaultTestPeriod = 5
defaultSpeedtestExec = "/usr/bin/speedtest"
listenPortEnvVar = "SPEEDTEST_METRICS_LISTEN_PORT"
listenAddrEnvVar = "SPEEDTEST_METRICS_LISTEN_ADDR"
testPeriodEnvVar = "SPEEDTEST_PERIOD_MINS"
speedtestExecEnvVar = "SPEEDTEST_EXEC"
listenPortEnvVar = "SPEEDTEST_METRICS_LISTEN_PORT"
listenAddrEnvVar = "SPEEDTEST_METRICS_LISTEN_ADDR"
testPeriodEnvVar = "SPEEDTEST_PERIOD_MINS"
speedtestExecEnvVar = "SPEEDTEST_EXEC"
)
var (
@ -61,65 +61,65 @@ var (
},
labels,
)
listenPort uint16
listenAddr string
listenPort uint16
listenAddr string
testPeriodMins uint
speedtestExec string
speedtestExec string
)
type SpeedTestResult struct {
Type string
Type string
Timestamp time.Time
Ping struct {
Jitter float64
Ping struct {
Jitter float64
Latency float64
Low float64
High float64
Low float64
High float64
}
Download struct {
Bandwidth int
Bytes int
Elapsed int
Latency struct {
IQM float64
Low float64
High float64
Bytes int
Elapsed int
Latency struct {
IQM float64
Low float64
High float64
Jitter float64
}
}
Upload struct {
Bandwidth int
Bytes int
Elapsed int
Latency struct {
IQM float64
Low float64
High float64
Bytes int
Elapsed int
Latency struct {
IQM float64
Low float64
High float64
Jitter float64
}
}
PacketLoss float64
ISP string
Interface struct {
ISP string
Interface struct {
InternalIP string
Name string
MACAddr string
IsVPN bool
Name string
MACAddr string
IsVPN bool
ExternalIP string
}
Server struct {
ID int
Host string
Port int16
Name string
ID int
Host string
Port int16
Name string
Location string
Country string
IP string
Country string
IP string
}
Result struct {
ID string
URL string
ID string
URL string
Persisted bool
}
}