Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.4.3 #36

Merged
merged 9 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: golang
name: coverage
on:
pull_request:
push:
schedule:
- cron: "17 14 * * 4"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: "1.15"
go-version: "1.18.3"
- uses: actions/checkout@v2
- run: go test -race -v -coverprofile=dash.cov -coverpkg=./... ./...
- uses: shogo82148/actions-goveralls@v1
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/privacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: privacy
on:
pull_request:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: "1.18.3"
- uses: actions/checkout@v2
- run: go build -v ./cmd/dash-client
- run: |
if ./dash-client; then
echo "expected this command to fail"
exit 1
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/certs
.DS_Store
/datadir
/dash-client
/dash-server
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.15.0-alpine3.12 as build
FROM golang:1.18.3-alpine as build
RUN apk add --no-cache git
ADD . /go/src/github.com/neubot/dash
WORKDIR /go/src/github.com/neubot/dash
RUN ./build.sh
RUN go build -v -tags netgo -ldflags "-s -w -extldflags \"-static\"" ./cmd/dash-server

FROM gcr.io/distroless/static@sha256:3cd546c0b3ddcc8cae673ed078b59067e22dea676c66bd5ca8d302aef2c6e845
COPY --from=build /go/bin/dash-server /
FROM gcr.io/distroless/static@sha256:2ad95019a0cbf07e0f917134f97dd859aaccc09258eb94edcb91674b3c1f448f
COPY --from=build /go/src/github.com/neubot/dash/dash-server /
EXPOSE 80/tcp 443/tcp
WORKDIR /
ENTRYPOINT ["/dash-server"]
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ docker tag neubot/dash neubot/dash:`git describe --tags --dirty`-`date -u +%Y%m%

### Test locally

The following command should work on a Linux system:

```bash
rm -f ./certs/*.pem && \
rm -f ./certs/cert.pem ./certs/key.pem && \
./mkcerts.bash && \
sudo chown root:root ./certs/*.pem && \
docker run --network=bridge \
Expand Down Expand Up @@ -51,3 +53,15 @@ access prometheus metrics.
```bash
docker push neubot/dash
```

## Client

Build using:

```bash
go build -v ./cmd/dash-client
```

Make sure you read [PRIVACY.md](PRIVACY.md) before running. The command
will anyway refuse to run unless you acknowledge the privacy policy by
passing the `-y` command line flag.
4 changes: 0 additions & 4 deletions build.sh

This file was deleted.

1 change: 1 addition & 0 deletions certs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*.pem
14 changes: 13 additions & 1 deletion cmd/dash-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
//
// Usage:
//
// dash-client [-hostname <name>] [-timeout <string>] [-scheme <scheme>]
// dash-client -y [-hostname <name>] [-timeout <string>] [-scheme <scheme>]
//
// The `-y` flag indicates you have read the data policy and accept it.
//
// The `-hostname <name>` flag specifies to use the `name` hostname for
// performing the dash test. The default is to autodiscover a suitable
Expand All @@ -26,6 +28,7 @@ import (
"encoding/json"
"flag"
"fmt"
"os"
"time"

"github.com/apex/log"
Expand All @@ -48,6 +51,7 @@ var (
Options: []string{"https", "http"},
Value: "https",
}
flagY = flag.Bool("y", false, "I have read and accept the privacy policy at https://github.com/neubot/dash/blob/master/PRIVACY.md")
)

func init() {
Expand Down Expand Up @@ -88,6 +92,14 @@ func init() {

func internalmain(ctx context.Context) error {
flag.Parse()
if !*flagY {
fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, "Please, read the privacy policy at https://github.com/neubot/dash/blob/master/PRIVACY.md.\n")
fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, "If you accept the privacy policy, rerun adding the `-y` flag to the command line.\n")
fmt.Fprintf(os.Stderr, "\n")
os.Exit(1)
}
client := client.New(clientName, clientVersion)
client.Logger = log.Log
client.FQDN = *flagHostname
Expand Down
4 changes: 4 additions & 0 deletions cmd/dash-client/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import (
"github.com/neubot/dash/server"
)

func init() {
*flagY = true // acknowledge privacy policy for running integration tests
}

func TestRealmainSuccessful(t *testing.T) {
testhelper(t, func(idx int, config testconfig) {
time.Sleep(time.Duration(idx) * 100 * time.Millisecond)
Expand Down
12 changes: 9 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ go 1.14

require (
github.com/apex/log v1.9.0
github.com/google/uuid v1.1.2
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/google/uuid v1.3.0
github.com/gorilla/handlers v1.5.1
github.com/m-lab/go v0.1.43
github.com/m-lab/ndt5-client-go v0.0.0-20201022101818-2339aa62fcf1
github.com/m-lab/go v0.1.48
github.com/m-lab/ndt5-client-go v0.1.0
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/common v0.34.0 // indirect
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c // indirect
google.golang.org/protobuf v1.28.0 // indirect
)
Loading