implement --bind --storage --hours instead of positional parameters
parent
a28cde8010
commit
237d5e34a9
10
README.md
10
README.md
|
@ -209,11 +209,13 @@ And then 'service ubxtool restart'.
|
|||
|
||||
Distributed setup
|
||||
-----------------
|
||||
Run `navrecv :: ./storage` to receive frames on port 29603 of ::, aka all your IPv6 addresses (and IPv4 too on Linux).
|
||||
This allows anyone to send you frames, so be aware.
|
||||
Run `navrecv -b :: --storage ./storage` to receive frames on port 29603 of
|
||||
::, aka all your IPv6 addresses (and IPv4 too on Linux). This allows anyone
|
||||
to send you frames, so be aware.
|
||||
|
||||
Next up, run `navnexus ./storage ::`, which will serve your recorded data from port 29601. It will merge messages
|
||||
coming in from all sources and serve them in time order.
|
||||
Next up, run `navnexus --storage ./storage -b ::`, which will serve your
|
||||
recorded data from port 29601. It will merge messages coming in from all
|
||||
sources and serve them in time order.
|
||||
|
||||
Finally, you can do `nc 127.0.0.1 29601 | ./navdump`, which will give you all messages over the past 24 hours, and stream you more.
|
||||
This also works for `navparse` for the pretty website and influx storage, `nc 127.0.0.1 29601 | ./navparse --influxdb=galileo`,
|
||||
|
|
18
navnexus.cc
18
navnexus.cc
|
@ -153,9 +153,12 @@ int main(int argc, char** argv)
|
|||
bool doVERSION{false};
|
||||
|
||||
CLI::App app(program);
|
||||
|
||||
string localAddress("127.0.0.1");
|
||||
int hours = 4;
|
||||
app.add_flag("--version", doVERSION, "show program version and copyright");
|
||||
|
||||
app.add_option("--bind,-b", localAddress, "Address:port to bind to");
|
||||
app.add_option("--storage,-s", g_storage, "Location of storage files");
|
||||
app.add_option("--hours", hours, "Number of hours of backlog to replay");
|
||||
try {
|
||||
app.parse(argc, argv);
|
||||
} catch(const CLI::Error &e) {
|
||||
|
@ -168,14 +171,9 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
if(argc < 3) {
|
||||
cout<<"Syntax: navnexus storage listen-address [backlog-hours]"<<endl;
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
g_storage=argv[1];
|
||||
|
||||
ComboAddress sendaddr(argv[2], 29601);
|
||||
int hours = argc > 3 ? atoi(argv[3]) : 4;
|
||||
|
||||
ComboAddress sendaddr(localAddress, 29601);
|
||||
|
||||
cout<<"Listening on "<<sendaddr.toStringWithPort()<<", backlog "<<hours<<" hours, storage: "<<g_storage<<endl;
|
||||
Socket sender(sendaddr.sin4.sin_family, SOCK_STREAM);
|
||||
SSetsockopt(sender, SOL_SOCKET, SO_REUSEADDR, 1 );
|
||||
|
|
13
navrecv.cc
13
navrecv.cc
|
@ -192,9 +192,11 @@ int main(int argc, char** argv)
|
|||
bool doVERSION{false};
|
||||
|
||||
CLI::App app(program);
|
||||
|
||||
string localAddress("127.0.0.1");
|
||||
app.add_flag("--version", doVERSION, "show program version and copyright");
|
||||
|
||||
|
||||
app.add_option("--bind,-b", localAddress, "Address:port to bind to");
|
||||
app.add_option("--storage,-s", g_storagedir, "Location to store files");
|
||||
try {
|
||||
app.parse(argc, argv);
|
||||
} catch(const CLI::Error &e) {
|
||||
|
@ -207,13 +209,8 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
if(argc != 3) {
|
||||
cout<<"Syntax: navrecv listen-address storage"<<endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
g_storagedir=argv[2];
|
||||
|
||||
ComboAddress recvaddr(argv[1], 29603);
|
||||
ComboAddress recvaddr(localAddress, 29603);
|
||||
Socket receiver(recvaddr.sin4.sin_family, SOCK_STREAM, 0);
|
||||
SSetsockopt(receiver,SOL_SOCKET, SO_REUSEADDR, 1 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue