+static struct option const long_options[] = {
+ {"datagram", no_argument, NULL, 'd'},
+ {"quit", no_argument, NULL, 'q'},
+ {"readonly", no_argument, NULL, 'r'},
+ {"writeonly", no_argument, NULL, 'w'},
+ {"packet-loss", required_argument, NULL, 'L'},
+ {"replay-window", required_argument, NULL, 'W'},
+ {"verbose", required_argument, NULL, 'v'},
+ {"help", no_argument, NULL, 1},
+ {NULL, 0, NULL, 0}
+};
+
+const char *program_name;
+
+static void usage() {
+ fprintf(stderr, "Usage: %s [options] my_ecdsa_key_file his_ecdsa_key_file [host] port\n\n", program_name);
+ fprintf(stderr, "Valid options are:\n"
+ " -d, --datagram Enable datagram mode.\n"
+ " -q, --quit Quit when EOF occurs on stdin.\n"
+ " -r, --readonly Only send data from the socket to stdout.\n"
+#ifdef HAVE_LINUX
+ " -t, --tun Use a tun device instead of stdio.\n"
+#endif
+ " -w, --writeonly Only send data from stdin to the socket.\n"
+ " -L, --packet-loss RATE Fake packet loss of RATE percent.\n"
+ " -R, --replay-window N Set replay window to N bytes.\n"
+ " -v, --verbose Display debug messages.\n"
+ "\n");
+ fprintf(stderr, "Report bugs to bugs@meshlink.io.\n");
+}
+