UDP transport with broadcast support, -udp and -iface flags on info
This commit is contained in:
@@ -73,12 +73,16 @@ func printInfo(dev string, info *client.ResponseInfo) {
|
||||
func cmdInfo(args []string) error {
|
||||
fs := flag.NewFlagSet("info", flag.ExitOnError)
|
||||
udpAddr := fs.String("udp", "", "connect via UDP to this IP address")
|
||||
iface := fs.String("iface", "", "bind to this network interface (for broadcast)")
|
||||
fs.Parse(args)
|
||||
|
||||
if *udpAddr != "" {
|
||||
log := slog.With("addr", *udpAddr)
|
||||
if *iface != "" {
|
||||
log = log.With("iface", *iface)
|
||||
}
|
||||
log.Info("connecting via UDP")
|
||||
c, err := client.NewUDP(*udpAddr, 2*time.Second)
|
||||
c, err := client.NewUDP(*udpAddr, *iface, 2*time.Second)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user