Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: librespeed/speedtest-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: FreedomNetNL/speedtest-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 6 commits
  • 9 files changed
  • 2 contributors

Commits on Feb 2, 2022

  1. Implement debian package

    lucasvbeek committed Feb 2, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    49b855c View commit details
  2. Implement CI

    lucasvbeek committed Feb 2, 2022
    Copy the full SHA
    c2c92db View commit details
  3. Merge pull request #1 from FreedomNetNL/feature/ci

    Feature/ci
    lucasvbeek authored Feb 2, 2022
    Copy the full SHA
    3f8d1e9 View commit details
  4. Fix default settings

    lucasvbeek committed Feb 2, 2022
    Copy the full SHA
    2f99238 View commit details
  5. Fix boltdb

    lucasvbeek committed Feb 2, 2022
    Copy the full SHA
    8c7aded View commit details
  6. Copy the full SHA
    5d1ab13 View commit details
Showing with 125 additions and 116 deletions.
  1. +30 −0 .github/workflows/build.yml
  2. +29 −114 .goreleaser.yml
  3. +2 −2 go.mod
  4. +4 −0 go.sum
  5. +5 −0 scripts/defaults
  6. 0 scripts/librespeed-go.db
  7. +13 −0 scripts/postinstall.sh
  8. +30 −0 scripts/settings.toml
  9. +12 −0 scripts/systemd/librespeed-go.service
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: build

on: [push]

jobs:
builds:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store build
uses: actions/upload-artifact@v2
with:
name: build
path: dist/*
143 changes: 29 additions & 114 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,120 +1,35 @@
project_name: 'speedtest-go'
#dist: ./out
before:
hooks:
- go mod download
project_name: 'librespeed-go'

builds:
- main: ./main.go
id: speedtest-backend
binary: speedtest-backend
env:
- env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- windows
- linux
- darwin
goarch:
- 386
- amd64
- arm
- arm64
- mips
- mipsle
goarm:
- 5
- 6
- 7
gomips:
- hardfloat
- softfloat
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
hooks:
post: upx -9 "{{ .Path }}"
- main: ./main.go
id: speedtest-backend-freebsd
binary: speedtest-backend
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- freebsd
goarch:
- 386
- amd64
- arm
- arm64
- mips
- mipsle
goarm:
- 5
- 6
- 7
gomips:
- hardfloat
- softfloat
- main: ./main.go
id: speedtest-backend-noupx-linux
binary: speedtest-backend
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- linux
goarch:
- mips64
- mips64le
gomips:
- hardfloat
- softfloat
- main: ./main.go
id: speedtest-backend-noupx-windows-arm64
binary: speedtest-backend
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- windows
goarch:
- arm
- arm64
goarm:
- 5
- 6
- 7

nfpms:
- homepage: https://freedom.nl
description: LibreSpeed-Go backend
maintainer: Freedom Internet DevOps <systeembeheer@freedomnet.nl>
license: LGPL 3.0
vendor: Freedom Internet
contents:
- src: scripts/defaults
dst: /etc/default/librespeed-go
- src: scripts/systemd/librespeed-go.service
dst: /usr/lib/systemd/system/librespeed-go.service
- src: web/assets
dst: /usr/local/share/librespeed-go/assets
- src: scripts/settings.toml
dst: /etc/librespeed-go/settings.toml
type: config
formats:
- deb
- rpm
dependencies:
- systemd
scripts:
postinstall: scripts/postinstall.sh

archives:
- format_overrides:
- goos: windows
format: zip
files:
- files:
- README.md
- LICENSE
- settings.toml
checksum:
name_template: 'checksums.txt'
changelog:
skip: false
sort: asc
release:
github:
owner: librespeed
name: speedtest-go
disable: false
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ module github.com/librespeed/speedtest
go 1.16

require (
github.com/breml/rootcerts v0.2.1
github.com/breml/rootcerts v0.2.2
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/go-chi/chi/v5 v5.0.7
github.com/go-chi/cors v1.2.0
@@ -21,5 +21,5 @@ require (
github.com/umahmood/haversine v0.0.0-20151105152445-808ab04add26
go.etcd.io/bbolt v1.3.6
golang.org/x/image v0.0.0-20211028202545-6944b10bf410
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -68,6 +68,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/breml/rootcerts v0.2.1 h1:GZMVDXOs945764NFck0vtHSjktKYubOFM0kjf5HAuwc=
github.com/breml/rootcerts v0.2.1/go.mod h1:24FDtzYMpqIeYC7QzaE8VPRQaFZU5TIUDlyk8qwjD88=
github.com/breml/rootcerts v0.2.2 h1:hkHEpbTdYaNvDoYeq+mwRvCeg/YTTl23DjQ1Tnj71Zs=
github.com/breml/rootcerts v0.2.2/go.mod h1:24FDtzYMpqIeYC7QzaE8VPRQaFZU5TIUDlyk8qwjD88=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
@@ -567,6 +569,8 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
5 changes: 5 additions & 0 deletions scripts/defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set the command-line arguments to pass to the server.
# Due to shell scaping, to pass backslashes for regexes, you need to double
# them (\\d for \d). If running under systemd, you need to double them again
# (\\\\d to mean \d), and escape newlines too.
ARGS="-c /etc/librespeed-go/settings.toml"
Empty file added scripts/librespeed-go.db
Empty file.
13 changes: 13 additions & 0 deletions scripts/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

adduser --quiet --system --home /var/lib/librespeed-go --no-create-home \
--group --gecos "LibreSpeed-Go" librespeed

mkdir -p /var/lib/librespeed-go
touch /var/lib/librespeed-go/librespeed-go.db
chown -R librespeed:librespeed /var/lib/librespeed-go/
chmod 0600 /var/lib/librespeed-go/librespeed-go.db

systemctl daemon-reload
systemctl enable librespeed-go
systemctl start librespeed-go
30 changes: 30 additions & 0 deletions scripts/settings.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# bind address, use empty string to bind to all interfaces
bind_address=""
# backend listen port
listen_port=8989
# proxy protocol port, use 0 to disable
proxyprotocol_port=0
# Server location
server_lat=1
server_lng=1
# ipinfo.io API key, if applicable
ipinfo_api_key=""

# assets directory path, defaults to `assets` in the same directory
assets_path="/usr/local/share/librespeed-go/assets"

# password for logging into statistics page
statistics_password="PASSWORD"
# redact IP addresses
redact_ip_addresses=false

# database type for statistics data, currently supports: none, memory, bolt, mysql, postgresql
# if none is specified, no telemetry/stats will be recorded, and no result PNG will be generated
database_type="bolt"
database_hostname=""
database_name=""
database_username=""
database_password=""

# if you use `bolt` as database, set database_file to database file location
database_file="/var/lib/librespeed-go/librespeed-go.db"
12 changes: 12 additions & 0 deletions scripts/systemd/librespeed-go.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=LibreSpeed-Go backend
Documentation=https://github.com/FreedomNetNL/speedtest-go

[Service]
Restart=on-failure
User=librespeed
EnvironmentFile=/etc/default/librespeed-go
ExecStart=/usr/local/bin/librespeed-go $ARGS

[Install]
WantedBy=multi-user.target