From ed542ac45e00c9b2faa0b41f3c00de6e291e5678 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 1 Jan 2021 11:30:03 -0800 Subject: fixes #1345 Restructure the source tree This is not quite complete, but it sets the stage for other protocols (such as zmq or mqtt) to be added to the project. --- tools/nngcat/CMakeLists.txt | 39 - tools/nngcat/nngcat.c | 1217 -------------------------------- tools/nngcat/nngcat_ambiguous_test.sh | 31 - tools/nngcat/nngcat_async_test.sh | 32 - tools/nngcat/nngcat_dup_proto_test.sh | 23 - tools/nngcat/nngcat_help_test.sh | 32 - tools/nngcat/nngcat_incompat_test.sh | 73 -- tools/nngcat/nngcat_need_proto_test.sh | 23 - tools/nngcat/nngcat_pubsub_test.sh | 45 -- tools/nngcat/nngcat_recvmaxsz_test.sh | 46 -- tools/nngcat/nngcat_stdin_pipe_test.sh | 44 -- tools/nngcat/nngcat_unlimited_test.sh | 46 -- tools/pubrefman/README.adoc | 10 - tools/pubrefman/go.mod | 11 - tools/pubrefman/go.sum | 277 -------- tools/pubrefman/pubrefman.go | 493 ------------- 16 files changed, 2442 deletions(-) delete mode 100644 tools/nngcat/CMakeLists.txt delete mode 100644 tools/nngcat/nngcat.c delete mode 100755 tools/nngcat/nngcat_ambiguous_test.sh delete mode 100755 tools/nngcat/nngcat_async_test.sh delete mode 100755 tools/nngcat/nngcat_dup_proto_test.sh delete mode 100755 tools/nngcat/nngcat_help_test.sh delete mode 100755 tools/nngcat/nngcat_incompat_test.sh delete mode 100755 tools/nngcat/nngcat_need_proto_test.sh delete mode 100755 tools/nngcat/nngcat_pubsub_test.sh delete mode 100755 tools/nngcat/nngcat_recvmaxsz_test.sh delete mode 100755 tools/nngcat/nngcat_stdin_pipe_test.sh delete mode 100755 tools/nngcat/nngcat_unlimited_test.sh delete mode 100644 tools/pubrefman/README.adoc delete mode 100644 tools/pubrefman/go.mod delete mode 100644 tools/pubrefman/go.sum delete mode 100644 tools/pubrefman/pubrefman.go (limited to 'tools') diff --git a/tools/nngcat/CMakeLists.txt b/tools/nngcat/CMakeLists.txt deleted file mode 100644 index bd7327ac..00000000 --- a/tools/nngcat/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2020 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -if (NNG_ENABLE_NNGCAT) - add_executable(nngcat nngcat.c) - target_include_directories(nngcat PUBLIC ${PROJECT_SOURCE_DIR}/src) - target_link_libraries(nngcat nng nng_private) - install(TARGETS nngcat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT Tools) - - if (NNG_TESTS AND CMAKE_SYSTEM_NAME MATCHES "Linux") - include(FindUnixCommands) - endif () - # TODO: This should be refactored to use a test driver. - # We only run the tests on Linux for now, because the Darwin CI/CD is too brittle. - if (NNG_TESTS AND BASH AND CMAKE_SYSTEM_NAME MATCHES "Linux") - macro(add_nngcat_test NAME TIMEOUT) - add_test(NAME nng.${NAME} COMMAND ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}_test.sh $) - set_tests_properties(nng.${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) - endmacro() - add_nngcat_test(nngcat_async 10) - add_nngcat_test(nngcat_ambiguous 10) - add_nngcat_test(nngcat_need_proto 10) - add_nngcat_test(nngcat_dup_proto 10) - add_nngcat_test(nngcat_help 10) - add_nngcat_test(nngcat_incompat 10) - add_nngcat_test(nngcat_pubsub 20) - add_nngcat_test(nngcat_recvmaxsz 20) - add_nngcat_test(nngcat_unlimited 20) - add_nngcat_test(nngcat_stdin_pipe 20) - endif () -endif () diff --git a/tools/nngcat/nngcat.c b/tools/nngcat/nngcat.c deleted file mode 100644 index 9e106069..00000000 --- a/tools/nngcat/nngcat.c +++ /dev/null @@ -1,1217 +0,0 @@ -// -// Copyright 2020 Staysail Systems, Inc. -// Copyright 2018 Capitar IT Group BV -// Copyright 2020 Lager Data, Inc. -// -// This software is supplied under the terms of the MIT License, a -// copy of which should be located in the distribution where this -// file was obtained (LICENSE.txt). A copy of the license may also be -// found online at https://opensource.org/licenses/MIT. -// - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Globals. We need this to avoid passing around everything. -int format = 0; -int proto = 0; -int verbose = 0; -int delay = 0; -nng_duration interval = NNG_DURATION_INFINITE; -nng_duration sendtimeo = NNG_DURATION_INFINITE; -nng_duration recvtimeo = NNG_DURATION_INFINITE; -void * data = NULL; -size_t datalen = 0; -int compat = 0; -int async = 0; -int insecure = 0; -void * cacert = NULL; -size_t cacertlen = 0; -void * keyfile = NULL; -size_t keylen = 0; -void * certfile = NULL; -size_t certlen = 0; -const char * zthome = NULL; -int count = 0; -int recvmaxsz = -1; - -// Options, must start at 1 because zero is sentinel. -enum options { - OPT_HELP = 1, - OPT_VERBOSE, - OPT_SILENT, - OPT_REP0, - OPT_REQ0, - OPT_PUSH0, - OPT_PULL0, - OPT_PUB0, - OPT_SUB0, - OPT_SURVEY0, - OPT_RESPOND0, - OPT_PAIR0, - OPT_PAIR1, - OPT_PAIR, - OPT_BUS0, - OPT_DIAL, - OPT_LISTEN, - OPT_DATA, - OPT_FILE, - OPT_SUBSCRIBE, - OPT_INTERVAL, - OPT_DELAY, - OPT_COUNT, - OPT_FORMAT, - OPT_RAW, - OPT_ASCII, - OPT_QUOTED, - OPT_MSGPACK, - OPT_HEX, - OPT_BLANK, // no printing, not an actual option. - OPT_COMPAT, - OPT_ASYNC, - OPT_RCV_TIMEO, - OPT_SND_TIMEO, - OPT_SOCK_NAME, - OPT_LISTEN_IPC, - OPT_DIAL_IPC, - OPT_LISTEN_LOCAL, - OPT_DIAL_LOCAL, - OPT_INSECURE, - OPT_CACERT, - OPT_KEYFILE, - OPT_CERTFILE, - OPT_VERSION, - OPT_RECVMAXSZ, - OPT_ZTHOME, -}; - -static nng_optspec opts[] = { - { .o_name = "help", .o_short = 'h', .o_val = OPT_HELP }, - { .o_name = "verbose", .o_short = 'v', .o_val = OPT_VERBOSE }, - { .o_name = "silent", .o_short = 'q', .o_val = OPT_SILENT }, - { .o_name = "req0", .o_val = OPT_REQ0 }, - { .o_name = "rep0", .o_val = OPT_REP0 }, - { .o_name = "push0", .o_val = OPT_PUSH0 }, - { .o_name = "pull0", .o_val = OPT_PULL0 }, - { .o_name = "pub0", .o_val = OPT_PUB0 }, - { .o_name = "sub", .o_val = OPT_SUB0 }, // explicit for alias - { .o_name = "sub0", .o_val = OPT_SUB0 }, - { .o_name = "surveyor0", .o_val = OPT_SURVEY0 }, - { .o_name = "respondent0", .o_val = OPT_RESPOND0 }, - { .o_name = "pair", .o_val = OPT_PAIR }, - { .o_name = "pair0", .o_val = OPT_PAIR0 }, - { .o_name = "pair1", .o_val = OPT_PAIR1 }, - { .o_name = "bus0", .o_val = OPT_BUS0 }, - { .o_name = "dial", .o_val = OPT_DIAL, .o_arg = true }, - { .o_name = "listen", .o_val = OPT_LISTEN, .o_arg = true }, - { .o_name = "data", .o_short = 'D', .o_val = OPT_DATA, .o_arg = true }, - { .o_name = "file", .o_short = 'F', .o_val = OPT_FILE, .o_arg = true }, - { .o_name = "subscribe", .o_val = OPT_SUBSCRIBE, .o_arg = true }, - { .o_name = "format", .o_val = OPT_FORMAT, .o_arg = true }, - { .o_name = "ascii", .o_short = 'A', .o_val = OPT_ASCII }, - { .o_name = "quoted", .o_short = 'Q', .o_val = OPT_QUOTED }, - { .o_name = "raw", .o_val = OPT_RAW }, - { .o_name = "hex", .o_val = OPT_HEX }, - { .o_name = "compat", .o_val = OPT_COMPAT }, - { .o_name = "async", .o_val = OPT_ASYNC }, - { .o_name = "msgpack", .o_val = OPT_MSGPACK }, - - { - .o_name = "recv-maxsz", - .o_short = 'Z', - .o_val = OPT_RECVMAXSZ, - .o_arg = true, - }, - { - .o_name = "count", - .o_short = 'C', - .o_val = OPT_COUNT, - .o_arg = true, - }, - { - .o_name = "delay", - .o_short = 'd', - .o_val = OPT_DELAY, - .o_arg = true, - }, - { - .o_name = "interval", - .o_short = 'i', - .o_val = OPT_INTERVAL, - .o_arg = true, - }, - { .o_name = "recv-timeout", .o_val = OPT_RCV_TIMEO, .o_arg = true }, - { .o_name = "send-timeout", .o_val = OPT_SND_TIMEO, .o_arg = true }, - { .o_name = "socket-name", .o_val = OPT_SOCK_NAME, .o_arg = true }, - - // Legacy compatibility with nanocat. - { .o_name = "bind", .o_val = OPT_LISTEN, .o_arg = true }, - { .o_name = "connect", .o_val = OPT_DIAL, .o_arg = true }, - { - .o_name = "bind-ipc", - .o_short = 'X', - .o_val = OPT_LISTEN_IPC, - .o_arg = true, - }, - { - .o_name = "connect-ipc", - .o_short = 'x', - .o_val = OPT_DIAL_IPC, - .o_arg = true, - }, - { - .o_name = "bind-local", - .o_short = 'L', - .o_val = OPT_LISTEN_LOCAL, - .o_arg = true, - }, - { - .o_name = "connect-local", - .o_short = 'l', - .o_val = OPT_DIAL_LOCAL, - .o_arg = true, - }, - { .o_name = "insecure", .o_short = 'k', .o_val = OPT_INSECURE }, - { .o_name = "cacert", .o_val = OPT_CACERT, .o_arg = true }, - { .o_name = "key", .o_val = OPT_KEYFILE, .o_arg = true }, - { - .o_name = "cert", - .o_short = 'E', - .o_val = OPT_CERTFILE, - .o_arg = true, - }, - { - .o_name = "zt-home", - .o_val = OPT_ZTHOME, - .o_arg = true, - }, - { .o_name = "version", .o_short = 'V', .o_val = OPT_VERSION }, - - // Sentinel. - { .o_name = NULL, .o_val = 0 }, -}; - -static void -fatal(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); - vfprintf(stderr, msg, ap); - va_end(ap); - fprintf(stderr, "\n"); - exit(1); -} - -static void -help(void) -{ - printf( - "Usage: nngcat ... [] [...] []\n\n"); - printf(" must be one of:\n"); - printf(" --req0 (or alias --req)\n"); - printf(" --rep0 (or alias --rep)\n"); - printf(" --pub0 (or alias --pub)\n"); - printf(" --sub0 (or alias --sub)\n"); - printf(" --push0 (or alias --push)\n"); - printf(" --pull0 (or alias --pull)\n"); - printf(" --surveyor0 (or alias --surveyor)\n"); - printf(" --respondent0 (or alias --respondent)\n"); - printf(" --pair0\n"); - printf(" --pair1\n"); - printf(" --pair (alias for either pair0 or pair1)\n"); - printf("\n must be one or more of:\n"); - printf(" --dial (or alias --connect )\n"); - printf(" --listen (or alias --bind )\n"); - printf(" --bind-local (or alias -L )\n"); - printf(" --connect-local (or alias -l )\n"); - printf(" --bind-ipc (or alias -X )\n"); - printf(" --connect-ipc (or alias -x )\n"); - printf("\n may be one or none of:\n"); - printf(" --format \n"); - printf(" --ascii (or alias -A)\n"); - printf(" --quoted (or alias -Q)\n"); - printf(" --hex\n"); - printf(" --msgpack\n"); - printf(" --raw\n"); - printf("\n may be any of:\n"); - printf(" --subscribe (only with --sub protocol)\n"); - printf(" --silent (or alias -q)\n"); - printf(" --verbose (or alias -v)\n"); - printf(" --count (or alias -C )\n"); - printf(" --delay (or alias -d )\n"); - printf(" --interval (or alias -i )\n"); - printf(" --recv-timeout \n"); - printf(" --send-timeout \n"); - printf(" --recv-maxsz (or alias -Z )\n"); - printf(" --compat\n"); - printf(" --async\n"); - printf(" --insecure (or alias -k)\n"); - printf(" --cacert \n"); - printf(" --cert (or alias -E )\n"); - printf(" --key \n"); - printf(" --zt-home \n"); - printf("\n may be one of:\n"); - printf(" --file (or alias -F ). " - "Use - for standard input.\n"); - printf(" --data (or alias -D )\n"); - exit(1); -} - -static int -intarg(const char *val, int maxv) -{ - int v = 0; - - if (val[0] == '\0') { - fatal("Empty integer argument."); - } - while (*val != '\0') { - if (!isdigit(*val)) { - fatal("Integer argument expected."); - } - v *= 10; - v += ((*val) - '0'); - val++; - if (v > maxv) { - fatal("Integer argument too large."); - } - } - if (v < 0) { - fatal("Integer argument overflow."); - } - return (v); -} - -// This reads a file into memory. Care is taken to ensure that -// the buffer is one byte larger and contains a terminating -// NUL. (Useful for key files and such.) -static void -loadfile(const char *path, void **datap, size_t *lenp) -{ - FILE * f; - size_t total_read = 0; - size_t allocation_size = BUFSIZ; - char * fdata; - char * realloc_result; - - if (strcmp(path, "-") == 0) { - f = stdin; - } else { - if ((f = fopen(path, "rb")) == NULL) { - fatal( - "Cannot open file %s: %s", path, strerror(errno)); - } - } - - if ((fdata = malloc(allocation_size + 1)) == NULL) { - fatal("Out of memory."); - } - - while (1) { - total_read += fread( - fdata + total_read, 1, allocation_size - total_read, f); - if (ferror(f)) { - if (errno == EINTR) { - continue; - } - fatal( - "Read from %s failed: %s", path, strerror(errno)); - } - if (feof(f)) { - break; - } - if (total_read == allocation_size) { - if (allocation_size > SIZE_MAX / 2) { - fatal("Out of memory."); - } - allocation_size *= 2; - if ((realloc_result = realloc( - fdata, allocation_size + 1)) == NULL) { - free(fdata); - fatal("Out of memory."); - } - fdata = realloc_result; - } - } - if (f != stdin) { - fclose(f); - } - fdata[total_read] = '\0'; - *datap = fdata; - *lenp = total_read; -} - -static void -configtls(nng_tls_config *tls) -{ - int rv = 0; - if (insecure) { - rv = nng_tls_config_auth_mode(tls, NNG_TLS_AUTH_MODE_NONE); - } - if ((rv == 0) && (certfile != NULL)) { - keyfile = keyfile ? keyfile : certfile; - rv = nng_tls_config_own_cert(tls, certfile, keyfile, NULL); - } - if ((rv == 0) && (cacert != NULL)) { - rv = nng_tls_config_ca_chain(tls, cacert, NULL); - } - if (rv != 0) { - fatal("Unable to configure TLS: %s", nng_strerror(rv)); - } -} - -struct addr { - struct addr *next; - int mode; - char * val; -}; - -struct addr ** -addaddr(struct addr **endp, int mode, const char *a) -{ - struct addr *na; - - if (((na = malloc(sizeof(*na))) == NULL) || - ((na->val = malloc(strlen(a) + 1)) == NULL)) { - fatal("Out of memory."); - } - na->mode = mode; - memcpy(na->val, a, strlen(a) + 1); - na->next = NULL; - *endp = na; - return (&na->next); -} - -struct topic { - struct topic *next; - char * val; -}; - -struct topic ** -addtopic(struct topic **endp, const char *s) -{ - struct topic *t; - - if (((t = malloc(sizeof(*t))) == NULL) || - ((t->val = malloc(strlen(s) + 1)) == NULL)) { - fatal("Out of memory."); - } - memcpy(t->val, s, strlen(s) + 1); - t->next = NULL; - *endp = t; - return (&t->next); -} - -void -printmsg(char *buf, size_t len) -{ - switch (format) { - case OPT_BLANK: // Suppress contents. - return; - case OPT_RAW: // Just emit raw contents. - fwrite(buf, 1, len, stdout); - break; - case OPT_ASCII: // ASCII, but non-ASCII substituted with '.' - for (size_t i = 0; i < len; i++) { - if (isprint(buf[i])) { - putchar(buf[i]); - } else { - putchar('.'); - } - } - break; - case OPT_QUOTED: // C style quoted strings. - putchar('"'); - for (size_t i = 0; i < len; i++) { - switch (buf[i]) { - case '\n': - putchar('\\'); - putchar('n'); - break; - case '\r': - putchar('\\'); - putchar('r'); - break; - case '\t': - putchar('\\'); - putchar('t'); - break; - case '"': - case '\\': - putchar('\\'); - putchar(buf[i]); - break; - default: - if (isprint(buf[i])) { - fputc(buf[i], stdout); - } else { - printf("\\x%02x", (uint8_t) buf[i]); - } - } - } - putchar('"'); - putchar('\n'); - break; - case OPT_MSGPACK: // MsgPack, we just encode prefix + len, then - // raw. - if (len < 256) { - putchar('\xc4'); - putchar(len & 0xff); - } else if (len < 65536) { - putchar('\xc5'); - putchar((len >> 8) & 0xff); - putchar(len & 0xff); - } else { - putchar('\xc6'); - putchar((len >> 24) & 0xff); - putchar((len >> 16) & 0xff); - putchar((len >> 8) & 0xff); - putchar(len & 0xff); - } - fwrite(buf, 1, len, stdout); - break; - case OPT_HEX: // Hex, quoted C string encoded with hex - // literals. - putchar('"'); - for (size_t i = 0; i < len; i++) { - printf("\\x%02x", (uint8_t) buf[i]); - } - putchar('"'); - putchar('\n'); - break; - } - fflush(stdout); -} - -void -recvloop(nng_socket sock) -{ - int iters = 0; - for (;;) { - int rv; - nng_msg *msg; - - if ((count > 0) && (iters >= count)) { - break; - } - rv = nng_recvmsg(sock, &msg, 0); - iters++; - switch (rv) { - case NNG_ETIMEDOUT: - case NNG_ESTATE: - // Either a regular timeout, or we reached the - // end of an event like a survey completing. - return; - case 0: - printmsg(nng_msg_body(msg), nng_msg_len(msg)); - nng_msg_free(msg); - continue; - default: - fatal("Receive error: %s", nng_strerror(rv)); - } - } -} - -void -resploop(nng_socket sock) -{ - int iters = 0; - for (;;) { - int rv; - nng_msg *msg; - - rv = nng_recvmsg(sock, &msg, 0); - if (rv != 0) { - fatal("Receive error: %s", nng_strerror(rv)); - } - printmsg(nng_msg_body(msg), nng_msg_len(msg)); - nng_msg_clear(msg); - if ((rv = nng_msg_append(msg, data, datalen)) != 0) { - fatal(nng_strerror(rv)); - } - if ((rv = nng_sendmsg(sock, msg, 0)) != 0) { - fatal("Send error: %s", nng_strerror(rv)); - } - - iters++; - if ((count > 0) && (iters >= count)) { - break; - } - } - - nng_msleep(200); -} - -void -sendloop(nng_socket sock) -{ - int iters = 0; - - if (data == NULL) { - fatal("No data to send (specify with --data or --file)"); - } - if (delay > 0) { - nng_msleep(delay); - } - - for (;;) { - int rv; - nng_msg * msg; - nng_time start; - nng_time end; - nng_duration delta; - - start = nng_clock(); - if (((rv = nng_msg_alloc(&msg, 0)) != 0) || - ((rv = nng_msg_append(msg, data, datalen)) != 0)) { - fatal(nng_strerror(rv)); - } - if ((rv = nng_sendmsg(sock, msg, 0)) != 0) { - fatal("Send error: %s", nng_strerror(rv)); - } - end = nng_clock(); - delta = (nng_duration)(end - start); - - iters++; - // By default, we don't loop. - if (((interval < 0) && (count == 0)) || - ((count > 0) && (iters >= count))) { - break; - } - - // We sleep, but we account for time spent, so that our - // interval appears more or less constant. Of course - // if we took more than the interval here, then we skip - // the sleep altogether. - if ((delta >= 0) && (delta < interval)) { - nng_msleep(interval - delta); - } - } - // Wait a bit to give queues a chance to drain. - nng_msleep(200); -} - -void -sendrecv(nng_socket sock) -{ - int iters = 0; - - if (data == NULL) { - fatal("No data to send (specify with --data or --file)"); - } - if (delay > 0) { - nng_msleep(delay); - } - - // We start by sending a message, then we receive iteratively - // but we set a concrete timeout if interval is set, to ensure - // that we exit the receive loop, and can continue. - for (;;) { - int rv; - nng_msg * msg; - nng_time start; - nng_time end; - nng_duration delta; - - start = nng_clock(); - if (((rv = nng_msg_alloc(&msg, 0)) != 0) || - ((rv = nng_msg_append(msg, data, datalen)) != 0)) { - fatal(nng_strerror(rv)); - } - if ((rv = nng_sendmsg(sock, msg, 0)) != 0) { - fatal("Send error: %s", nng_strerror(rv)); - } - if ((interval < 0) && (count == 0)) { - // Only one iteration through. - recvloop(sock); - break; - } - - // We would like to use recvloop, but we need to reset - // our timeout each time, as the timer counts down - // towards zero. Furthermore, with survey, we don't - // want to increment the iteration count. - - for (;;) { - delta = (nng_duration)(nng_clock() - start); - - nng_duration expire = interval - delta; - if ((recvtimeo >= 0) && (expire > recvtimeo)) { - expire = recvtimeo; - } - rv = - nng_socket_set_ms(sock, NNG_OPT_RECVTIMEO, expire); - if (rv != 0) { - fatal("Cannot set recv timeout: %s", - nng_strerror(rv)); - } - - rv = nng_recvmsg(sock, &msg, 0); - switch (rv) { - case 0: - printmsg(nng_msg_body(msg), nng_msg_len(msg)); - nng_msg_free(msg); - continue; - case NNG_ETIMEDOUT: - case NNG_ESTATE: - // We're done receiving - break; - default: - fatal("Cannot receive: %s", nng_strerror(rv)); - break; - } - - // We're done receiving, break out. - break; - } - - end = nng_clock(); - delta = (nng_duration)(end - start); - - iters++; - if ((count > 0) && (iters >= count)) { - break; - } - - // We sleep, but we account for time spent, so that our - // interval appears more or less constant. Of course - // if we took more than the interval here, then we skip - // the sleep altogether. - if ((delta >= 0) && (delta < interval)) { - nng_msleep(interval - delta); - } - } -} - -int -main(int ac, char **av) -{ - int idx; - char * arg; - int val; - int rv; - char scratch[512]; - struct addr * addrs = NULL; - struct addr ** addrend; - struct topic * topics = NULL; - struct topic **topicend; - nng_socket sock; - int port; - - idx = 1; - addrend = &addrs; - topicend = &topics; - - while ((rv = nng_opts_parse(ac, av, opts, &val, &arg, &idx)) == 0) { - switch (val) { - case OPT_HELP: - help(); - break; - case OPT_REQ0: - case OPT_REP0: - case OPT_SUB0: - case OPT_PUB0: - case OPT_BUS0: - case OPT_SURVEY0: - case OPT_RESPOND0: - case OPT_PAIR0: - case OPT_PAIR1: - case OPT_PUSH0: - case OPT_PULL0: - if (proto != 0) { - fatal("Only one protocol may be " - "specified."); - } - proto = val; - break; - case OPT_DIAL: - case OPT_LISTEN: - addrend = addaddr(addrend, val, arg); - break; - case OPT_DIAL_LOCAL: - case OPT_LISTEN_LOCAL: - port = intarg(arg, 65536); - snprintf(scratch, sizeof(scratch), - "tcp://127.0.0.1:%d", port); - addrend = addaddr(addrend, val, scratch); - break; - case OPT_DIAL_IPC: - case OPT_LISTEN_IPC: - snprintf(scratch, sizeof(scratch), "ipc:///%s", arg); - addrend = addaddr(addrend, val, scratch); - break; - case OPT_COUNT: - count = intarg(arg, 0x7fffffff); - break; - case OPT_SUBSCRIBE: - topicend = addtopic(topicend, arg); - break; - case OPT_VERBOSE: - case OPT_SILENT: - verbose = val; - break; - case OPT_DELAY: - delay = intarg(arg, 86400) * 1000; // max 1 day - break; - case OPT_INTERVAL: - interval = intarg(arg, 86400) * 1000; // max 1 day - break; - case OPT_SND_TIMEO: - sendtimeo = intarg(arg, 86400) * 1000; // max 1 day - break; - case OPT_RCV_TIMEO: - recvtimeo = intarg(arg, 86400) * 1000; // max 1 day - break; - case OPT_RECVMAXSZ: - recvmaxsz = intarg(arg, 0x7fffffff); - if (recvmaxsz == 0) { - recvmaxsz = 0x7fffffff; - } - break; - case OPT_COMPAT: - compat = 1; - break; - case OPT_ASYNC: - async = NNG_FLAG_NONBLOCK; - break; - case OPT_ASCII: - case OPT_RAW: - case OPT_QUOTED: - case OPT_MSGPACK: - case OPT_HEX: - if (format != 0) { - fatal("Format may be specified only " - "once."); - } - format = val; - break; - case OPT_FORMAT: - if (format != 0) { - fatal("Format may be specified only " - "once."); - } - if (strcmp(arg, "no") == 0) { - format = OPT_BLANK; - } else if (strcmp(arg, "ascii") == 0) { - format = OPT_ASCII; - } else if (strcmp(arg, "hex") == 0) { - format = OPT_HEX; - } else if (strcmp(arg, "quoted") == 0) { - format = OPT_QUOTED; - } else if (strcmp(arg, "raw") == 0) { - format = OPT_RAW; - } else if (strcmp(arg, "msgpack") == 0) { - format = OPT_MSGPACK; - } else { - fatal("Invalid format specified."); - } - break; - case OPT_FILE: - if (data != NULL) { - fatal("Data (--file, --data) may be " - "specified " - "only once."); - } - loadfile(arg, &data, &datalen); - break; - case OPT_DATA: - if (data != NULL) { - fatal("Data (--file, --data) may be " - "specified " - "only once."); - } - if ((data = malloc(strlen(arg) + 1)) == NULL) { - fatal("Out of memory."); - } - memcpy(data, arg, strlen(arg) + 1); - datalen = strlen(arg); - break; - case OPT_CACERT: - if (cacert != NULL) { - fatal("CA Certificate (--cacert) may be " - "specified only once."); - } - loadfile(arg, &cacert, &cacertlen); - break; - case OPT_KEYFILE: - if (keyfile != NULL) { - fatal( - "Key (--key) may be specified only once."); - } - loadfile(arg, &keyfile, &keylen); - break; - case OPT_CERTFILE: - if (certfile != NULL) { - fatal("Cert (--cert) may be specified " - "only " - "once."); - } - loadfile(arg, &certfile, &certlen); - break; - case OPT_ZTHOME: - zthome = arg; - break; - case OPT_INSECURE: - insecure = 1; - break; - case OPT_VERSION: - printf("%s\n", nng_version()); - exit(0); - } - } - switch (rv) { - case NNG_EINVAL: - fatal("Option %s is invalid.", av[idx]); - break; - case NNG_EAMBIGUOUS: - fatal("Option %s is ambiguous (specify in full).", av[idx]); - break; - case NNG_ENOARG: - fatal("Option %s requires argument.", av[idx]); - break; - default: - break; - } - - if (addrs == NULL) { - fatal("No address specified."); - } - - if (compat) { - if (async != 0) { - fatal("Options --async and --compat are " - "incompatible."); - } - if (count != 0) { - fatal("Options --count and --compat are " - "incompatible."); - } - if (proto == OPT_PAIR) { - proto = OPT_PAIR0; - } - if (proto == OPT_PAIR1) { - fatal("Protocol does not support --compat."); - } - async = NNG_FLAG_NONBLOCK; - } else { - if (proto == OPT_PAIR) { - proto = OPT_PAIR1; - } - } - if (proto == OPT_SUB0) { - if (topics == NULL) { - (void) addtopic(topicend, ""); // subscribe to all - } - } else { - if (topics != NULL) { - fatal("Protocol does not support --subscribe."); - } - } - - switch (proto) { - case OPT_PULL0: - case OPT_SUB0: - if (data != NULL) { - fatal("Protocol does not support --file or " - "--data."); - } - if (interval >= 0) { - fatal("Protocol does not support --interval."); - } - break; - case OPT_PUSH0: - case OPT_PUB0: - if (format != 0) { - fatal("Protocol does not support --format " - "options."); - } - if (data == NULL) { - fatal("Protocol requires either --file or " - "--data."); - } - break; - case OPT_SURVEY0: - case OPT_REQ0: - if (data == NULL) { - fatal("Protocol requires either --file or " - "--data."); - } - break; - case OPT_REP0: - case OPT_RESPOND0: - if (interval >= 0) { - fatal("Protocol does not support --interval."); - } - break; - case OPT_PAIR0: - case OPT_PAIR1: - case OPT_BUS0: - if ((interval >= 0) && (data == NULL)) { - fatal("Option --interval requires either " - "--file or --data."); - } - break; - default: - // Will be caught in next switch statement. - break; - } - - switch (proto) { - case OPT_REQ0: -#ifdef NNG_HAVE_REQ0 - rv = nng_req0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_REP0: -#ifdef NNG_HAVE_REP0 - rv = nng_rep0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_SUB0: -#ifdef NNG_HAVE_SUB0 - rv = nng_sub0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_PUB0: -#ifdef NNG_HAVE_PUB0 - rv = nng_pub0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_PAIR0: -#ifdef NNG_HAVE_PAIR0 - rv = nng_pair0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_PAIR1: -#ifdef NNG_HAVE_PAIR1 - rv = nng_pair1_open(&sock); -#else - fatal("Protocol not supported"); -#endif - break; - case OPT_BUS0: -#ifdef NNG_HAVE_BUS0 - rv = nng_bus0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_PUSH0: -#ifdef NNG_HAVE_PUSH0 - rv = nng_push0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_PULL0: -#ifdef NNG_HAVE_PULL0 - rv = nng_pull0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_SURVEY0: -#ifdef NNG_HAVE_SURVEYOR0 - rv = nng_surveyor0_open(&sock); -#else - fatal("Protocol not supported."); -#endif - break; - case OPT_RESPOND0: -#ifdef NNG_HAVE_RESPONDENT0 - rv = nng_respondent0_open(&sock); -#else - fatal("Protocol not supported"); -#endif - break; - case 0: - default: - fatal("No protocol specified."); - break; - } - if (rv != 0) { - fatal("Unable to open socket: %s", nng_strerror(rv)); - } - - for (struct topic *t = topics; t != NULL; t = t->next) { - rv = nng_socket_set( - sock, NNG_OPT_SUB_SUBSCRIBE, t->val, strlen(t->val)); - if (rv != 0) { - fatal("Unable to subscribe to topic %s: %s", t->val, - nng_strerror(rv)); - } - } - - if ((sendtimeo > 0) && - ((rv = nng_socket_set_ms(sock, NNG_OPT_SENDTIMEO, sendtimeo)) != - 0)) { - fatal("Unable to set send timeout: %s", nng_strerror(rv)); - } - if ((recvtimeo > 0) && - ((rv = nng_socket_set_ms(sock, NNG_OPT_RECVTIMEO, recvtimeo)) != - 0)) { - fatal("Unable to set send timeout: %s", nng_strerror(rv)); - } - - if ((recvmaxsz >= 0) && - ((rv = nng_socket_set_size(sock, NNG_OPT_RECVMAXSZ, recvmaxsz)) != - 0)) { - fatal("Unable to set max receive size: %s", nng_strerror(rv)); - } - - for (struct addr *a = addrs; a != NULL; a = a->next) { - char * act; - nng_listener l; - nng_dialer d; - nng_tls_config *tls; - switch (a->mode) { - case OPT_DIAL: - case OPT_DIAL_IPC: - case OPT_DIAL_LOCAL: - rv = nng_dialer_create(&d, sock, a->val); - if (rv != 0) { - fatal("Unable to create dialer for %s: %s", - a->val, nng_strerror(rv)); - } - rv = nng_dialer_getopt_ptr( - d, NNG_OPT_TLS_CONFIG, (void **) &tls); - if (rv == 0) { - configtls(tls); - } else if (rv != NNG_ENOTSUP) { - fatal("Unable to get TLS config: %s", - nng_strerror(rv)); - } - if (zthome != NULL) { - rv = nng_dialer_set(d, NNG_OPT_ZT_HOME, - zthome, strlen(zthome) + 1); - if ((rv != 0) && (rv != NNG_ENOTSUP)) { - fatal("Unable to set ZT home: %s", - nng_strerror(rv)); - } - } - rv = nng_dialer_start(d, async); - act = "dial"; - if ((rv == 0) && (verbose == OPT_VERBOSE)) { - char ustr[256]; - size_t sz; - sz = sizeof(ustr); - if (nng_dialer_getopt( - d, NNG_OPT_URL, ustr, &sz) == 0) { - printf("Connected to: %s\n", ustr); - } - } - break; - case OPT_LISTEN: - case OPT_LISTEN_IPC: - case OPT_LISTEN_LOCAL: - rv = nng_listener_create(&l, sock, a->val); - if (rv != 0) { - fatal("Unable to create listener for %s: %s", - a->val, nng_strerror(rv)); - } - rv = nng_listener_getopt_ptr( - l, NNG_OPT_TLS_CONFIG, (void **) &tls); - if (rv == 0) { - configtls(tls); - } else if (rv != NNG_ENOTSUP) { - fatal("Unable to get TLS config: %s", - nng_strerror(rv)); - } - if (zthome != NULL) { - rv = nng_listener_set(l, NNG_OPT_ZT_HOME, - zthome, strlen(zthome) + 1); - if ((rv != 0) && (rv != NNG_ENOTSUP)) { - fatal("Unable to set ZT home: %s", - nng_strerror(rv)); - } - } - rv = nng_listener_start(l, async); - act = "listen"; - if ((rv == 0) && (verbose == OPT_VERBOSE)) { - char ustr[256]; - size_t sz; - sz = sizeof(ustr); - if (nng_listener_getopt( - l, NNG_OPT_URL, ustr, &sz) == 0) { - printf("Listening at: %s\n", ustr); - } - } - break; - default: - fatal("Invalid address mode! (Bug!)"); - } - - if (rv != 0) { - fatal("Unable to %s on %s: %s", act, a->val, - nng_strerror(rv)); - } - } - - switch (proto) { - case OPT_SUB0: - case OPT_PULL0: - recvloop(sock); - break; - case OPT_REP0: - case OPT_RESPOND0: - if (data == NULL) { - recvloop(sock); - } else { - resploop(sock); - } - break; - case OPT_PUSH0: - case OPT_PUB0: - sendloop(sock); - break; - case OPT_BUS0: - case OPT_PAIR0: - case OPT_PAIR1: - if (data != NULL) { - sendrecv(sock); - } else { - recvloop(sock); - } - break; - case OPT_REQ0: - case OPT_SURVEY0: - sendrecv(sock); - break; - default: - fatal("Protocol handling unimplemented."); - } - - exit(0); -} diff --git a/tools/nngcat/nngcat_ambiguous_test.sh b/tools/nngcat/nngcat_ambiguous_test.sh deleted file mode 100755 index 414b6d19..00000000 --- a/tools/nngcat/nngcat_ambiguous_test.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} -CMD="${NNGCAT} --re --dial=tcp://127.0.0.1:27272" - -echo -n "Verify ambiguous options fail: " -if ${CMD} >/dev/null 2>&1 -then - echo "Failed: ambigous accepted" - exit 1 -fi -x=$(${CMD} 2>&1) -if [[ ${x} =~ "ambiguous" ]] -then - echo "pass" - exit 0 -fi - -echo "Failed: error did not match" -exit 1 diff --git a/tools/nngcat/nngcat_async_test.sh b/tools/nngcat/nngcat_async_test.sh deleted file mode 100755 index 2b03e522..00000000 --- a/tools/nngcat/nngcat_async_test.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} -ADDR="ipc:///tmp/nngcat_async_test" - -echo -n "Verify async connect: " - -${NNGCAT} --async -d 1 --connect ${ADDR} --req0 -D "ping" & - - -answer=$( ${NNGCAT} --rep0 --recv-timeout=3 --listen ${ADDR} -D "pong" --ascii 2>/dev/null ) - -if [[ ${answer} == "ping" ]] -then - echo "pass" - exit 0 -fi - -echo "Failed: req did not match" -echo "RES: $answer" -exit 1 diff --git a/tools/nngcat/nngcat_dup_proto_test.sh b/tools/nngcat/nngcat_dup_proto_test.sh deleted file mode 100755 index 1513d01c..00000000 --- a/tools/nngcat/nngcat_dup_proto_test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} - -echo -n "Verify only a single protocol is allowed: " -if ${NNGCAT} --pub0 --sub0 --dial=tcp://127.0.0.1:8989 >/dev/null 2>&1 -then - echo "Failed: duplicate protocols accepted" - exit 1 -fi -echo "pass" -exit 0 diff --git a/tools/nngcat/nngcat_help_test.sh b/tools/nngcat/nngcat_help_test.sh deleted file mode 100755 index 95ed9e3e..00000000 --- a/tools/nngcat/nngcat_help_test.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} - -echo -n "Verify nngcat help: " -if ${NNGCAT} --help >/dev/null 2>&1 -then - echo "Failed: help didn't return 1" - exit 1 -fi -x=$(${NNGCAT} --help 2>&1) -if [[ ${x} =~ "Usage:" ]] -then - echo "pass" - exit 0 -fi - -echo "Failed: usage did not match" -echo "Output:" -echo "$x" -exit 1 diff --git a/tools/nngcat/nngcat_incompat_test.sh b/tools/nngcat/nngcat_incompat_test.sh deleted file mode 100755 index 128b57ba..00000000 --- a/tools/nngcat/nngcat_incompat_test.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} - -echo "Verify incompatible options: " - -# Just bind something to this so other ones connect -${NNGCAT} --pull0 --ascii -X /tmp/bogusipc & -pid=$! - -trap "kill $pid && wait $pid 2>/dev/null" 0 - -echo -n " --subscribe doesn't work with non-sub" -if ${NNGCAT} --req0 -x /tmp/bogusipc --subscribe=oops >/dev/null 2>&1 -then - echo "fail" - exit 1 -fi -echo "pass" - -echo -n " --interval doesn't work with recv only: " -if ${NNGCAT} --interval 1 --pull -x /tmp/bogusipc >/dev/null 2>&1 -then - echo "fail" - exit 1 -fi -echo "pass" - -echo -n " --pair1 doesn't work with --compat: " -if ${NNGCAT} --compat --pair1 -x /tmp/bogusipc >/dev/null 2>&1 -then - echo "fail" - exit 1 -fi -echo "pass" - -echo -n " --count doesn't work with --compat: " -if ${NNGCAT} --compat --count=1 --pair0 -x /tmp/bogusipc >/dev/null 2>&1 -then - echo "fail" - exit 1 -fi -echo "pass" - -echo -n " --count fails with non-integer: " -if ${NNGCAT} --count=xyz --pair0 -x /tmp/bogusipc >/dev/null 2>&1 -then - echo "fail" - exit 1 -fi -echo "pass" - -echo -n " --file fails with non-existing file: " -if ${NNGCAT} --async --file=/nosuchfilehere --push0 -x /tmp/bogusipc >/dev/null 2>&1 -then - echo "fail" - exit 1 -fi -echo "pass" - -echo "PASS." -exit 0 diff --git a/tools/nngcat/nngcat_need_proto_test.sh b/tools/nngcat/nngcat_need_proto_test.sh deleted file mode 100755 index d6733cad..00000000 --- a/tools/nngcat/nngcat_need_proto_test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} - -echo -n "Verify a protocol is needed: " -if ${NNGCAT} --dial=tcp://127.0.0.1:8989 >/dev/null 2>&1 -then - echo "Failed: protocol should be required" - exit 1 -fi -echo "pass" -exit 0 diff --git a/tools/nngcat/nngcat_pubsub_test.sh b/tools/nngcat/nngcat_pubsub_test.sh deleted file mode 100755 index b9ba90ed..00000000 --- a/tools/nngcat/nngcat_pubsub_test.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} -ADDR="ipc:///tmp/nngcat_pub_sub_test" -OUTPUT=/tmp/nngcat_pubsub_test.$$.out - -echo -n "Verify pub sub: " - -trap "rm $OUTPUT" 0 - -${NNGCAT} --listen ${ADDR} --count=3 --recv-timeout=20 --sub0 --subscribe=one --subscribe=two --quoted > $OUTPUT 2>/dev/null & -sleep 1 -# for speed of execution, run these in the background, they should be ignored -${NNGCAT} -d 1 --connect ${ADDR} --pub0 --data "xyz" & -${NNGCAT} -d 1 --connect ${ADDR} --pub0 -D "none swam" & -# these we care about, due to ordering (checksum) so run them serially -${NNGCAT} -d 1 --connect ${ADDR} --pub0 -D "one flew" -${NNGCAT} -d 1 --connect ${ADDR} --pub0 --data "twofer test" -${NNGCAT} -d 1 --connect ${ADDR} --pub0 --data "one more" - -wait $bgid 2>/dev/null - -sum=$(cksum ${OUTPUT}) -sum=${sum%% *} -if [[ ${sum} == 3929078614 ]] -then - echo "pass" - exit 0 -fi -echo "FAIL: Checksum failed (Wanted 3929078614 got ${sum})" -echo "OUTPUT:" -cat ${OUTPUT} - -exit 1 diff --git a/tools/nngcat/nngcat_recvmaxsz_test.sh b/tools/nngcat/nngcat_recvmaxsz_test.sh deleted file mode 100755 index b5d4ff4a..00000000 --- a/tools/nngcat/nngcat_recvmaxsz_test.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} -ADDR="ipc:///tmp/nngcat_recvmaxsz_test" -OUTPUT=/tmp/nngcat_recvmaxsz_test.$$.out - -echo -n "Verify maximum receive size: " - -trap "rm $OUTPUT" 0 - -${NNGCAT} --listen ${ADDR} --count=3 --recv-maxsz=5 --pull0 --quoted > $OUTPUT 2>/dev/null & -sleep 1 -# for speed of execution, run these in the background, they should be ignored -${NNGCAT} --connect ${ADDR} --push0 --data "one" -${NNGCAT} --connect ${ADDR} --push0 --data "55555" -${NNGCAT} --connect ${ADDR} --push0 --data "666666" -${NNGCAT} --connect ${ADDR} --push0 --data "7777777" -${NNGCAT} --connect ${ADDR} --push0 --data "88888" - -wait $bgid 2>/dev/null - -sum=$(cksum ${OUTPUT}) -sum=${sum%% *} - -# This matches 3 lines of "one", "55555", "88888". -if [[ ${sum} == 4122906158 ]] -then - echo "pass" - exit 0 -fi -echo "FAIL: Checksum failed (Wanted 3929078614 got ${sum})" -echo "OUTPUT:" -cat ${OUTPUT} - -exit 1 diff --git a/tools/nngcat/nngcat_stdin_pipe_test.sh b/tools/nngcat/nngcat_stdin_pipe_test.sh deleted file mode 100755 index 5fec0ab7..00000000 --- a/tools/nngcat/nngcat_stdin_pipe_test.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# Copyright 2020 Lager Data, Inc. -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} -ADDR="ipc:///tmp/nngcat_stdin_pipe_test" -OUTPUT=/tmp/nngcat_stdin_pipe_test.$$.out - -echo -n "Verify reading from stdin pipe: " - -trap "rm $OUTPUT" 0 - -${NNGCAT} --listen ${ADDR} --count=1 --recv-timeout=3 --recv-maxsz=0 --pull0 --raw > $OUTPUT 2>/dev/null & -bgid=$! - -sleep 1 -# for speed of execution, run these in the background, they should be ignored -echo "hello world" | ${NNGCAT} --connect ${ADDR} --delay=1 --push0 --file - -wait "$bgid" 2>/dev/null - -sum=$(cksum ${OUTPUT}) -sum=${sum%% *} - -# This matches "hello world\n" since echo adds a trailing newline -if [[ ${sum} == 3733384285 ]] -then - echo "pass" - exit 0 -fi -echo "FAIL: Checksum failed (Wanted 3733384285 got ${sum})" -echo "OUTPUT:" -ls -la ${OUTPUT} - -exit 1 diff --git a/tools/nngcat/nngcat_unlimited_test.sh b/tools/nngcat/nngcat_unlimited_test.sh deleted file mode 100755 index 0486b9b1..00000000 --- a/tools/nngcat/nngcat_unlimited_test.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# -# Copyright 2018 Staysail Systems, Inc. -# Copyright 2018 Capitar IT Group BV -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -NNGCAT=${NNGCAT:=$1} -NNGCAT=${NNGCAT:-./nngcat} -ADDR="ipc:///tmp/nngcat_unlimited_test" -INPUT=/tmp/nngcat_unlimited_test.$$.in -OUTPUT=/tmp/nngcat_unlimited_test.$$.out - -echo -n "Verify unlimited receive size: " - -trap "rm $OUTPUT $INPUT" 0 - -# 4 MB -dd if=/dev/urandom of=${INPUT} bs=1024 count=4096 >/dev/null 2>&1 -goodsum=$(cksum ${INPUT}) -goodsum=${goodsum%% *} - -${NNGCAT} --listen ${ADDR} --count=1 --recv-maxsz=0 --pull0 --raw > $OUTPUT 2>/dev/null & -sleep 1 -# for speed of execution, run these in the background, they should be ignored -${NNGCAT} --connect ${ADDR} --delay=1 --push0 --file ${INPUT} -wait $bgid 2>/dev/null - -sum=$(cksum ${OUTPUT}) -sum=${sum%% *} - -if [[ ${sum} == ${goodsum} ]] -then - echo "pass" - exit 0 -fi -echo "FAIL: Checksum failed (Wanted ${goodsum} got ${sum})" -echo "OUTPUT:" -ls -la ${OUTPUT} - -exit 1 diff --git a/tools/pubrefman/README.adoc b/tools/pubrefman/README.adoc deleted file mode 100644 index a8929df9..00000000 --- a/tools/pubrefman/README.adoc +++ /dev/null @@ -1,10 +0,0 @@ -= pubrefman - -This directory contains a tool to publish (update) the reference manual -on the NNG documentation site. - -Run it with --help for options. You can build it with Go. - -It normally uploads to github, and will require a working SSH agent. - -If you're not a project maintainer, you probably don't need this tool. diff --git a/tools/pubrefman/go.mod b/tools/pubrefman/go.mod deleted file mode 100644 index b181f172..00000000 --- a/tools/pubrefman/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module go.nanomsg.org/nng/pubrefman - -go 1.14 - -require ( - github.com/bytesparadise/libasciidoc v0.3.1-0.20200802124845-5dcda3220c31 - github.com/go-git/go-billy/v5 v5.0.0 - github.com/go-git/go-git/v5 v5.1.0 - github.com/google/uuid v1.1.1 - github.com/spf13/jwalterweatherman v1.0.0 -) diff --git a/tools/pubrefman/go.sum b/tools/pubrefman/go.sum deleted file mode 100644 index 3d9237e3..00000000 --- a/tools/pubrefman/go.sum +++ /dev/null @@ -1,277 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs= -github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= -github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= -github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= -github.com/alecthomas/chroma v0.7.1 h1:G1i02OhUbRi2nJxcNkwJaY/J1gHXj9tt72qN6ZouLFQ= -github.com/alecthomas/chroma v0.7.1/go.mod h1:gHw09mkX1Qp80JlYbmN9L3+4R5o6DJJ3GRShh+AICNc= -github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= -github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= -github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= -github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= -github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bytesparadise/libasciidoc v0.3.1-0.20200802124845-5dcda3220c31 h1:Rf+HhYMHL9wl4nKv8Jgy5ss8Pksii1TWCgZIP6Cr1qE= -github.com/bytesparadise/libasciidoc v0.3.1-0.20200802124845-5dcda3220c31/go.mod h1:kWkgc6KJVCDUT2QlPbYIlYspvy0+3vuWriL0kV2NDig= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= -github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg= -github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM= -github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.0.1 h1:q+IFMfLx200Q3scvt2hN79JsEzy4AmBTp/pqnefH+Bc= -github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= -github.com/go-git/go-git/v5 v5.1.0 h1:HxJn9g/E7eYvKW3Fm7Jt4ee8LXfPOm/H1cdDu8vEssk= -github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= -github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY= -github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mna/pigeon v1.0.1-0.20200224192238-18953b277063 h1:V7s6vhIrNeOqocziAmRoVJh6gnPPx83ovlpT7Hf5shI= -github.com/mna/pigeon v1.0.1-0.20200224192238-18953b277063/go.mod h1:rkFeDZ0gc+YbnrXPw0q2RlI0QRuKBBPu67fgYIyGRNg= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5 h1:8Q0qkMVC/MmWkpIdlvZgcv2o2jrlF6zqVOh7W5YHdMA= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= -github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sozorogami/gover v0.0.0-20171022184752-b58185e213c5 h1:TAPeDBsd52dRWoWzf5trgBzxzMYHTYjYI+4xNyCdoCU= -github.com/sozorogami/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:nHNlDYIQZn44RvqH0kCpl/dMMVWXkav0QIgzGxV1Ab4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190830223141-573d9926052a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6 h1:nULzSsKgihxFGLnQFv2T7lE5vIhOtg8ZPpJHapEt7o0= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/tools/pubrefman/pubrefman.go b/tools/pubrefman/pubrefman.go deleted file mode 100644 index 9ed3f5af..00000000 --- a/tools/pubrefman/pubrefman.go +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright 2020 Staysail Systems, Inc. -// -// This software is supplied under the terms of the MIT License, a -// copy of which should be located in the distribution where this -// file was obtained (LICENSE.txt). A copy of the license may also be -// found online at https://opensource.org/licenses/MIT. -// - -package main - -import ( - "context" - "flag" - "fmt" - "io/ioutil" - "log" - "os" - "path" - "sort" - "strings" - "time" - - "github.com/bytesparadise/libasciidoc" - "github.com/bytesparadise/libasciidoc/pkg/configuration" - "github.com/go-git/go-billy/v5" - "github.com/go-git/go-billy/v5/memfs" - "github.com/go-git/go-git/v5" - "github.com/go-git/go-git/v5/plumbing" - "github.com/go-git/go-git/v5/plumbing/object" - "github.com/go-git/go-git/v5/storage/memory" - "github.com/google/uuid" - jww "github.com/spf13/jwalterweatherman" -) - -type Configuration struct { - Version string - Debug bool - Trace bool - Quiet bool - DryRun bool - Author string - Email string - Url string - Message string -} - -var Config Configuration - -func init() { - flag.StringVar(&Config.Version, "v", "tip", "Version to publish") - flag.BoolVar(&Config.Debug, "d", false, "Enable debugging") - flag.BoolVar(&Config.Trace, "t", false, "Enable tracing") - flag.BoolVar(&Config.Quiet, "q", false, "Run quietly") - flag.BoolVar(&Config.DryRun, "n", false, "Dry run, does not push changes") - flag.StringVar(&Config.Url, "u", "ssh://git@github.com/nanomsg/nng.git", "URL of repo to publish from") - flag.StringVar(&Config.Email, "E", "info@staysail.tech", "Author email for commit") - flag.StringVar(&Config.Author, "A", "Staysail Systems, Inc.", "Author name for commit") - flag.StringVar(&Config.Message, "m", "", "Commit message") -} - -func (g *Global) CheckError(err error, prefix string, args ...interface{}) { - if err == nil { - g.Log.TRACE.Printf("%s: ok", fmt.Sprintf(prefix, args...)) - return - } - g.Log.FATAL.Fatalf("Error: %s: %v", fmt.Sprintf(prefix, args...), err) -} - -func (g *Global) Fatal(format string, args ...interface{}) { - g.Log.FATAL.Fatalf("Error: %s", fmt.Sprintf(format, args...)) -} - -type Section struct { - Name string - Synopsis string - Description string - Pages []*Page -} - -type Page struct { - Name string - Section string - Description string - Content string -} - -type Global struct { - Config Configuration - SrcFs billy.Filesystem - DstFs billy.Filesystem - DstDir string - LaConfig configuration.Configuration - Sections map[string]*Section - Pages map[string]*Page - Repo *git.Repository - Index string - ToC string - Added map[string]bool - WorkTree *git.Worktree - Branch string - OldHash plumbing.Hash - NewHash plumbing.Hash - Log *jww.Notepad -} - -func (g *Global) Init() { - g.Config = Config - g.Sections = make(map[string]*Section) - g.Pages = make(map[string]*Page) - g.Added = make(map[string]bool) - g.SrcFs = memfs.New() - g.DstFs = memfs.New() - g.DstDir = path.Join("man", g.Config.Version) - g.LaConfig = configuration.Configuration{ - AttributeOverrides: map[string]string{ - "nofooter": "yes", - "icons": "font", - "linkcss": "yes", - "source-highlighter": "pygments", - }, - } - thresh := jww.LevelInfo - if g.Config.Quiet { - thresh = jww.LevelError - } - if g.Config.Debug { - thresh = jww.LevelDebug - } - if g.Config.Trace { - thresh = jww.LevelTrace - } - g.Log = jww.NewNotepad(thresh, thresh, os.Stdout, ioutil.Discard, "", log.Ldate|log.Ltime) -} - -func (g *Global) Destroy() { -} - -func (g *Global) Debug(format string, args ...interface{}) { - g.Log.DEBUG.Printf(format, args...) -} - -func (g *Global) Print(format string, args ...interface{}) { - g.Log.INFO.Printf(format, args...) -} - -func (g *Global) CloneSource() { - tag := g.Config.Version - if tag == "" || tag == "tip" { - tag = "master" - } - ref := plumbing.NewBranchReferenceName(tag) - if strings.HasPrefix(tag, "v") { - ref = plumbing.NewTagReferenceName(tag) - } - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - now := time.Now() - _, err := git.CloneContext(ctx, memory.NewStorage(), g.SrcFs, &git.CloneOptions{ - URL: g.Config.Url, - ReferenceName: ref, - }) - g.CheckError(err, "clone source") - g.Debug("Cloned source (%s) in %v", tag, time.Since(now)) -} - -func (g *Global) ClonePages() { - ref := plumbing.NewBranchReferenceName("gh-pages") - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - now := time.Now() - repo, err := git.CloneContext(ctx, memory.NewStorage(), g.DstFs, &git.CloneOptions{ - URL: g.Config.Url, - ReferenceName: ref, - RemoteName: "origin", - }) - g.CheckError(err, "clone gh-pages") - g.Repo = repo - g.Debug("Cloned pages in %v", time.Since(now)) -} - -func (g *Global) ProcessManPage(page os.FileInfo) { - source := g.ReadFile(page.Name()) - // Let's look for the description - inName := false - desc := "" - name := "" - for _, line := range strings.Split(source, "\n") { - line = strings.TrimRight(line, " \t\r") - if line == "" { - continue - } - if line == "== NAME" { - inName = true - continue - } - if inName { - w := strings.SplitN(line, " - ", 2) - if len(w) != 2 || w[1] == "" { - g.Fatal("page %s NAME malformed", page.Name()) - } - name = w[0] - desc = w[1] - strings.TrimSpace(name) - strings.TrimSpace(desc) - break - } - } - - if desc == "" { - g.Fatal("page %s NAME missing", page.Name()) - } - - html := &strings.Builder{} - - // Emit the title, as we are not letting libasciidoc do it (stripping headers) - cfg := g.LaConfig - cfg.Filename = page.Name() - cfg.LastUpdated = page.ModTime() - metadata, err := libasciidoc.Convert(strings.NewReader(source), html, cfg) - g.CheckError(err, "processing page %s", page.Name()) - w := strings.SplitN(metadata.Title, "(", 2) - sect := strings.TrimSuffix(w[1], ")") - if len(w) != 2 || name != w[0] || !strings.HasSuffix(w[1], ")") { - g.Fatal("page %s title incorrect (%s)", page.Name(), name) - } - if page.Name() != name+"."+sect+".adoc" { - g.Fatal("page %s(%s) does not match file name %s", name, sect, page.Name()) - } - result := &strings.Builder{} - _, _ = fmt.Fprintf(result, "---\n") - _, _ = fmt.Fprintf(result, "version: %s\n", g.Config.Version) - _, _ = fmt.Fprintf(result, "layout: %s\n", "manpage_v2") - _, _ = fmt.Fprintf(result, "---\n") - _, _ = fmt.Fprintf(result, "

%s(%s)

\n", name, sect) - result.WriteString(html.String()) - - g.Pages[page.Name()] = &Page{ - Name: name, - Section: sect, - Description: desc, - Content: result.String(), - } - g.Log.TRACE.Printf("HTML for %s:\n%s\n", name, result.String()) -} - -func (g *Global) ReadFile(name string) string { - f, err := g.SrcFs.Open(path.Join("docs/man", name)) - g.CheckError(err, "open file %s", name) - b, err := ioutil.ReadAll(f) - g.CheckError(err, "read file %s", name) - return string(b) -} - -func (g *Global) LoadSection(name string) { - section := strings.TrimPrefix(name, "man") - - g.Sections[section] = &Section{ - Name: section, - Synopsis: g.ReadFile(name + ".sect"), - Description: g.ReadFile(name + ".desc"), - } -} - -func (g *Global) ProcessSource() { - pages, err := g.SrcFs.ReadDir("docs/man") - g.CheckError(err, "reading source directory") - count := 0 - g.Debug("Total of %d files in man directory", len(pages)) - now := time.Now() - for _, page := range pages { - if page.IsDir() { - continue - } - if strings.HasSuffix(page.Name(), ".sect") { - g.LoadSection(strings.TrimSuffix(page.Name(), ".sect")) - } - if !strings.HasSuffix(page.Name(), ".adoc") { - continue - } - g.ProcessManPage(page) - count++ - } - g.Debug("Processed %d pages in %v", count, time.Since(now)) -} - -func (g *Global) GenerateToC() { - toc := &strings.Builder{} - idx := &strings.Builder{} - - for _, page := range g.Pages { - if sect := g.Sections[page.Section]; sect == nil { - g.Fatal("page %s section %s not found", page.Name, page.Section) - } else { - sect.Pages = append(sect.Pages, page) - } - } - - var sects []string - for name, sect := range g.Sections { - sects = append(sects, name) - sort.Slice(sect.Pages, func(i, j int) bool { return sect.Pages[i].Name < sect.Pages[j].Name }) - } - sort.Strings(sects) - - // And also the index page. - - // Emit the toc leader part - toc.WriteString("\n") - - index := &strings.Builder{} - _, _ = fmt.Fprintf(index, "---\n") - _, _ = fmt.Fprintf(index, "version: %s\n", g.Config.Version) - _, _ = fmt.Fprintf(index, "layout: %s\n", "manpage_v2") - _, _ = fmt.Fprintf(index, "---\n") - _, _ = fmt.Fprintf(index, "

NNG Reference Manual

\n") - - cfg := g.LaConfig - cfg.Filename = "index.adoc" - _, err := libasciidoc.Convert(strings.NewReader(idx.String()), index, cfg) - g.CheckError(err, "formatting index") - g.Index = index.String() - g.ToC = toc.String() -} - -func (g *Global) CreateBranch() { - brName := uuid.New().String() - var err error - - refName := plumbing.ReferenceName("refs/heads/" + brName) - g.Branch = brName - - g.WorkTree, err = g.Repo.Worktree() - g.CheckError(err, "getting worktree") - - err = g.WorkTree.Checkout(&git.CheckoutOptions{ - Branch: refName, - Create: true, - }) - g.CheckError(err, "creating branch") - g.Print("Checked out branch %v", brName) - pr, err := g.Repo.Head() - g.CheckError(err, "getting head hash") - g.OldHash = pr.Hash() -} - -func (g *Global) WriteFile(name string, content string) { - full := path.Join(g.DstDir, name) - f, err := g.DstFs.Create(full) - g.CheckError(err, "creating file %s", name) - _, err = f.Write([]byte(content)) - g.CheckError(err, "writing file %s", name) - err = f.Close() - g.CheckError(err, "closing file %s", name) - g.Add(name) -} - -func (g *Global) Add(name string) { - g.Log.TRACE.Printf("Adding file %s", name) - g.Added[name] = true -} - -func (g *Global) Delete(name string) { - g.Debug("Removing file %s", name) - _, err := g.WorkTree.Remove(path.Join(g.DstDir, name)) - g.CheckError(err, "removing file %s", name) -} - -func (g *Global) Commit() { - if status, err := g.WorkTree.Status(); status == nil { - g.CheckError(err, "obtaining status") - } else if status.IsClean() { - g.Print("No changes to commit.") - return - } - message := g.Config.Message - if message == "" { - message = "Manual page updates for " + g.Config.Version - } - var err error - g.NewHash, err = g.WorkTree.Commit(message, &git.CommitOptions{ - Author: &object.Signature{ - Email: g.Config.Email, - Name: g.Config.Author, - When: time.Now(), - }, - }) - g.CheckError(err, "committing branch") -} - -func (g *Global) Push() { - if g.NewHash.IsZero() { - g.Print("Nothing to push.") - return - } - - ci, err := g.Repo.Log(&git.LogOptions{ - From: g.NewHash, - }) - g.CheckError(err, "getting commit log") - commit, err := ci.Next() - g.CheckError(err,"getting single commit") - if commit != nil { - g.Print(commit.String()) - if fs, _ := commit.Stats(); fs != nil { - g.Debug(fs.String()) - } - } - if g.Config.DryRun { - g.Print("Not pushing changes (dry-run mode.)") - } else { - err := g.Repo.Push(&git.PushOptions{ - RemoteName: "origin", - }) - g.CheckError(err, "pushing changes") - g.Print("Pushed branch %v\n", g.Branch) - } -} - -func (g *Global) WriteOutput() { - - for _, p := range g.Pages { - fName := fmt.Sprintf("%s.%s.html", p.Name, p.Section) - g.WriteFile(fName, p.Content) - } - g.WriteFile("_toc.html", g.ToC) - g.WriteFile("index.html", g.Index) - - _, err := g.WorkTree.Add(g.DstDir) - g.CheckError(err, "adding directory") - files, err := g.DstFs.ReadDir(g.DstDir) - g.CheckError(err, "scanning destination directory") - for _, file := range files { - if file.IsDir() { - continue - } - if g.Added[file.Name()] { - continue - } - g.Delete(file.Name()) - } - status, err := g.WorkTree.Status() - g.CheckError(err, "obtaining commit status") - if !status.IsClean() { - g.Debug("No changes.") - } else { - g.Debug(status.String()) - } -} - -func main() { - g := &Global{} - flag.Parse() - g.Init() - defer g.Destroy() - - g.CloneSource() - g.ClonePages() - g.ProcessSource() - g.GenerateToC() - g.CreateBranch() - g.WriteOutput() - g.Commit() - g.Push() -} -- cgit v1.2.3-70-g09d2