rofl0r / microsocks

tiny, portable SOCKS5 server with very moderate resource usage
Other
1.48k stars 266 forks source link

Parameter -q (quiet) to disable logging #43

Closed webaddicto closed 2 years ago

webaddicto commented 3 years ago

I am using microsocks and it works perfectly, so very good job!

I have just one question:

Can we disable the logging, such as:

client[4] 123.123.123.123: connected to www.yahoo.com:443

Would be useful a parameter like -q (quiet) or -nolog or similar.

I found the logging code in sockssrv.c:

    if(CONFIG_LOG) {
        char clientname[256];
        af = SOCKADDR_UNION_AF(&client->addr);
        void *ipdata = SOCKADDR_UNION_ADDRESS(&client->addr);
        inet_ntop(af, ipdata, clientname, sizeof clientname);
        dolog("client[%d] %s: connected to %s:%d\n", client->fd, clientname, namebuf, port);
    }
rofl0r commented 3 years ago

yeah, you can compile microsocks like this:

CPPFLAGS=-DCONFIG_LOG=0 make

which disables the logging. this is then hardcoded into the binary though. you could compile one with logging on and one with logging off and give them different names, e.g. microsocks-silent for the one with logging off.

TheDcoder commented 2 years ago

@rofl0r Any chance we could make this configurable at runtime? IMO hardcoding config shouldn't be the default because then we would have to deviate from the distributor's version.

Also I'd like an option to just disable the connection logging while keeping everything else.