cmd yanic-query fix help and print ip-address
This commit is contained in:
parent
cbb5f2e59b
commit
4aa8acabfc
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ Usage:
|
|||
yanic query <interface> <destination> [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
|
||||
|
|
|
@ -16,11 +16,11 @@ var wait int
|
|||
var queryCmd = &cobra.Command{
|
||||
Use: "query <interface> <destination>",
|
||||
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))
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue