2016-12-22 03:09:02 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
2017-01-29 22:14:40 +01:00
|
|
|
"net"
|
2016-12-22 03:09:02 +01:00
|
|
|
"os"
|
2017-01-29 22:14:40 +01:00
|
|
|
"time"
|
|
|
|
|
2017-03-03 16:19:35 +01:00
|
|
|
"github.com/FreifunkBremen/yanic/models"
|
|
|
|
"github.com/FreifunkBremen/yanic/respond"
|
2016-12-22 03:09:02 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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{})
|
|
|
|
|
2017-03-21 00:53:02 +01:00
|
|
|
collector := respond.NewCollector(nil, nodes, iface, 0)
|
2017-01-29 22:14:40 +01:00
|
|
|
collector.SendPacket(net.ParseIP(dstAddress))
|
2016-12-22 03:09:02 +01:00
|
|
|
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
|
|
|
|
for id, data := range nodes.List {
|
|
|
|
log.Printf("%s: %+v", id, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
collector.Close()
|
|
|
|
}
|