tlsgate

TLS reverse proxy
git clone git://git.akobets.xyz/tlsgate
Log | Files | Refs | README | LICENSE

commit 39744c8a9c981460b01349791873bfaca262002e
parent 5fa5415a8061fbd07048315ac50843b263e71634
Author: Artem Kobets <artem@akobets.xyz>
Date:   Sat, 19 Sep 2020 08:30:38 +0300

move args to global scope

Diffstat:
Mmain.c | 25++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/main.c b/main.c @@ -15,14 +15,23 @@ // milliseconds #define REQUEST_TIMEOUT 30000 -static void serve(struct tls *ctx, int cfd, const char *server_host, const char *server_port, const char *server_udsfile); +static void serve(struct tls *ctx, int cfd); static void sigchld(int unused); static void usage(void); char *argv0; +static char *cert_file = NULL; +static char *key_file = NULL; +static char *ca_file = NULL; +static char *proxy_host = NULL; +static char *proxy_port = NULL; +static char *server_host = NULL; +static char *server_port = NULL; +static char *server_udsfile = NULL; + void -serve(struct tls *ctx, int cfd, const char *server_host, const char *server_port, const char *server_udsfile) +serve(struct tls *ctx, int cfd) { struct tls *cctx = NULL; int sfd = -1; @@ -198,20 +207,10 @@ usage(void) exit(1); } - int main(int argc, char **argv) { int opt; - char *cert_file = NULL; - char *key_file = NULL; - char *ca_file = NULL; - char *proxy_host = NULL; - char *proxy_port = NULL; - char *server_host = NULL; - char *server_port = NULL; - char *server_udsfile = NULL; - struct tls *ctx; struct tls_config *config; int fd; @@ -308,7 +307,7 @@ main(int argc, char **argv) switch (pid = fork()) { case 0: { - serve(ctx, cfd, server_host, server_port, server_udsfile); + serve(ctx, cfd); _exit(0); } case -1: