From 73587b7534fc0c7239564b9584fb82332648c95a Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 26 Jan 2024 17:13:37 +0200 Subject: [PATCH] apply a different hostname on 127.0.0.2 for the people who connect to the hidden service --- src/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index a7d39ea..1627ffc 100644 --- a/src/main.c +++ b/src/main.c @@ -181,10 +181,18 @@ void accept_from_sock(struct listener *listener) cl->peername = mystrdup(client_addr); if (!cl->peername) abort(); cl->peerport = port; - if (cctx || !strcmp(cl->peername, "127.0.0.1")) + if (cctx) cl->umode |= UMODE_SECURE; extern const char *hostname; - cl->hostname = mystrdup(!strcmp(cl->peername, "127.0.0.1") ? "localhost" : hostname); + if (!strcmp(cl->peername, "127.0.0.1")) { + cl->hostname = mystrdup("localhost"); + cl->umode |= UMODE_SECURE; + } else if (!strcmp(cl->peername, "127.0.0.2")) { + cl->hostname = mystrdup("onion"); + cl->umode |= UMODE_SECURE; + } else { + cl->hostname = mystrdup(hostname); + } if (!cl->hostname) abort(); net_poll_add(cl->FD, SOCKTYPE_CLIENT, cl); -- 2.56.0