yanic/cmd/respond-query/main.go
Julian Kornberger 2d43dda380 Send unicast to nodes that did non answer the multicast
Use the state file to store last known IP address.

closes #13
2017-01-30 17:25:23 +01:00

34 lines
639 B
Go

package main
import (
"log"
"net"
"os"
"time"
"github.com/FreifunkBremen/respond-collector/models"
"github.com/FreifunkBremen/respond-collector/respond"
)
// Usage: respond-query wlp4s0 "[fe80::eade:27ff:dead:beef%wlp4s0]:1001"
func main() {
iface := os.Args[1]
dstAddress := os.Args[2]
log.Printf("Sending request address=%s iface=%s", dstAddress, iface)
nodes := models.NewNodes(&models.Config{})
collector := respond.NewCollector(nil, nodes, iface)
collector.SendPacket(net.ParseIP(dstAddress))
time.Sleep(time.Second)
for id, data := range nodes.List {
log.Printf("%s: %+v", id, data)
}
collector.Close()
}