Skip to content

Commit

Permalink
cmd/multiping: place stubs for ICMP6
Browse files Browse the repository at this point in the history
  • Loading branch information
dmke committed Feb 21, 2018
1 parent 6e09d59 commit ba49c50
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/multiping/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,26 @@ var opts = struct {
timeout time.Duration
interval time.Duration
statBufferSize uint
bind string
bind4 string
bind6 string
remotes []unit

pinger *ping.Pinger
table *tview.Table
}{
timeout: 1000 * time.Millisecond,
interval: 1000 * time.Millisecond,
bind: "0.0.0.0",
bind4: "0.0.0.0",
bind6: "::",
statBufferSize: 50,
}

func main() {
flag.DurationVar(&opts.timeout, "timeout", opts.timeout, "timeout for a single echo request")
flag.DurationVar(&opts.interval, "interval", opts.interval, "polling interval")
flag.UintVar(&opts.statBufferSize, "buf", opts.statBufferSize, "buffer size for statistics")
flag.StringVar(&opts.bind, "bind", opts.bind, "bind address")
flag.StringVar(&opts.bind4, "bind4", opts.bind4, "IPv4 bind address")
flag.StringVar(&opts.bind6, "bind6", opts.bind6, "IPv6 bind address")
flag.Parse()

log.SetFlags(0)
Expand All @@ -78,7 +81,7 @@ func main() {
}
}

if instance, err := ping.New(opts.bind); err == nil {
if instance, err := ping.New(opts.bind4); err == nil {
instance.Timeout = opts.timeout
instance.Attempts = 1
opts.pinger = instance
Expand Down

0 comments on commit ba49c50

Please sign in to comment.