From 4aa8acabfce243efc3469430c6e2067c507d1f15 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Sun, 1 Oct 2017 11:13:26 +0200 Subject: [PATCH] cmd yanic-query fix help and print ip-address --- INSTALL.md | 4 ++-- README.md | 2 +- cmd/query.go | 6 +++--- config_example.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index fe0be5f..8950c56 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -26,7 +26,7 @@ export PATH=$PATH:$GOPATH/bin ### Compile ```sh -go get -v -u github.com/FreifunkBremen/yanic/cmd/... +go get -v -u github.com/FreifunkBremen/yanic ``` #### Work with other databases @@ -40,7 +40,7 @@ cp /opt/go/src/github.com/FreifunkBremen/yanic/config_example.toml /etc/yanic.co You only need to edit `/etc/yanic.conf` under section `[respondd]` the `interface` for a easy startup. And create the following folders: ```sh -mkdir -p /var/lib/collector +mkdir -p /var/lib/yanic mkdir -p /var/www/html/meshviewer/data ``` diff --git a/README.md b/README.md index 0a2621d..2e54cc8 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Usage: yanic query [flags] Examples: - yanic query wlan0 "[fe80::eade:27ff:dead:beef%wlp4s0]:1001" + yanic query wlan0 "fe80::eade:27ff:dead:beef" Flags: -h, --help help for query diff --git a/cmd/query.go b/cmd/query.go index a5e2a7b..79ffa20 100644 --- a/cmd/query.go +++ b/cmd/query.go @@ -16,11 +16,11 @@ var wait int var queryCmd = &cobra.Command{ Use: "query ", Short: "Sends a query on the interface to the destination and waits for a response", - Example: `yanic query wlan0 "[fe80::eade:27ff:dead:beef%wlp4s0]:1001"`, + Example: `yanic query wlan0 "fe80::eade:27ff:dead:beef"`, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { iface := args[0] - dstAddress := args[1] + dstAddress := net.ParseIP(args[1]) log.Printf("Sending request address=%s iface=%s", dstAddress, iface) @@ -28,7 +28,7 @@ var queryCmd = &cobra.Command{ collector := respond.NewCollector(nil, nodes, iface, 0) defer collector.Close() - collector.SendPacket(net.ParseIP(dstAddress)) + collector.SendPacket(dstAddress) time.Sleep(time.Second * time.Duration(wait)) diff --git a/config_example.toml b/config_example.toml index 34ebcf7..931fb84 100644 --- a/config_example.toml +++ b/config_example.toml @@ -25,7 +25,7 @@ webroot = "/var/www/html/meshviewer" enable = true # state-version of nodes.json to store cached data, # these is the directly collected respondd data -state_path = "/var/lib/collector/state.json" +state_path = "/var/lib/yanic/state.json" # Export nodes and graph periodically save_interval = "5s"