From: Egor Date: Fri, 26 Jan 2024 15:13:37 +0000 (+0200) Subject: apply a different hostname on 127.0.0.2 X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=73587b7534fc0c7239564b9584fb82332648c95a;p=patchyircd.git apply a different hostname on 127.0.0.2 for the people who connect to the hidden service --- 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);