-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
34 lines (29 loc) · 667 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/antelman107/net-wait-go/wait"
)
func main() {
conf, output, err := getFlags(os.Args[0], os.Args[1:])
if err == flag.ErrHelp {
fmt.Println(output)
os.Exit(2)
} else if err != nil {
fmt.Println(err, "\n", output)
os.Exit(1)
}
if wait.New(
wait.WithProto(conf.proto),
wait.WithWait(time.Duration(conf.delayMS)*time.Millisecond),
wait.WithBreak(time.Duration(conf.breakMS)*time.Millisecond),
wait.WithDeadline(time.Duration(conf.deadlineMS)*time.Millisecond),
wait.WithDebug(conf.debug),
wait.WithUDPPacket(conf.packetBytes),
).Do(conf.addrsSlice) {
return
}
os.Exit(1)
}