Skip to content

Commit

Permalink
ndt7-client.go: add -no-verify flag (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Jul 8, 2019
1 parent 5cd2b01 commit 83af94e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/ndt7-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
//
// Usage:
//
// ndt7-client [-batch] [-hostname <hostname>] [-timeout <string>]
// ndt7-client [-batch] [-hostname <name>] [-no-verify] [-timeout <string>]
//
// The `-batch` flag causes the command to emit JSON messages on the
// standard output, thus allowing for easy machine parsing. The default
// is to emit user friendly pretty output.
//
// The `-hostname <hostname>` flag specifies the hostname to use for
// The `-hostname <name>` flag specifies to use the `name` hostname for
// performing the ndt7 test. The default is to auto-discover a suitable
// server by using Measurement Lab's locate service.
//
// The `-no-verify` flag allows to skip TLS certificate verification.
//
// The `-timeout <string>` flag specifies the time after which the
// whole test is interrupted. The `<string>` is a string suitable to
// be passed to time.ParseDuration, e.g., "15s". The default is a large
Expand Down Expand Up @@ -73,6 +75,7 @@ package main

import (
"context"
"crypto/tls"
"flag"
"os"
"time"
Expand All @@ -89,6 +92,7 @@ const (

var (
flagBatch = flag.Bool("batch", false, "emit JSON events on stdout")
flagNoVerify = flag.Bool("no-verify", false, "skip TLS certificate verification")
flagHostname = flag.String("hostname", "", "optional ndt7 server hostname")
flagTimeout = flag.Duration(
"timeout", defaultTimeout, "time after which the test is aborted")
Expand Down Expand Up @@ -160,6 +164,9 @@ func main() {
defer cancel()
var r runner
r.client = ndt7.NewClient(userAgent)
r.client.Dialer.TLSClientConfig = &tls.Config{
InsecureSkipVerify: *flagNoVerify,
}
r.client.FQDN = *flagHostname
if *flagBatch {
r.emitter = emitter.NewBatch()
Expand Down

0 comments on commit 83af94e

Please sign in to comment.