Fixed typos, misspellings, abbreviations, Markdown linting, etc.

This commit is contained in:
conc3rned
2024-09-17 16:12:39 +03:00
parent b15ca040df
commit 03312cbb67
41 changed files with 437 additions and 425 deletions

View File

@@ -6,7 +6,7 @@
int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmo_p, const sigset_t *sigmask)
{
// macos does not implement ppoll
// macOS does not implement ppoll
// this is a hacky ppoll shim. only for tpws which does not require sigmask
if (sigmask)
{

View File

@@ -212,7 +212,7 @@ bool get_dest_addr(int sockfd, const struct sockaddr *accept_sa, struct sockaddr
}
#endif
if (saconvmapped(orig_dst))
DBGPRINT("Original destination : converted ipv6 mapped address to ipv4\n");
DBGPRINT("Original destination : converted IPv6 mapped address to IPv4\n");
if (params.debug)
{

View File

@@ -181,7 +181,7 @@ bool resolver_init(int threads, int fd_signal_pipe)
resolver.bInit = true;
#ifdef __APPLE__
// MacOS does not support unnamed semaphores
// macOS does not support unnamed semaphores
char sn[64];
snprintf(sn, sizeof(sn), "%s_%d", sem_name, getpid());

View File

@@ -58,7 +58,7 @@ void tamper_out(t_ctrack *ctrack, uint8_t *segment, size_t segment_buffer_size,
(*size)--;
if (pp == (p - 1))
{
// probably end of http headers
// probably end of HTTP headers
VPRINT("Found double EOL at pos %td. Stop replacing.\n", pp - segment);
break;
}
@@ -360,7 +360,7 @@ void tamper_in(t_ctrack *ctrack, uint8_t *segment, size_t segment_buffer_size, s
}
else
{
// received not http reply. do not monitor this connection anymore
// received not HTTP reply. do not monitor this connection anymore
VPRINT("incoming unknown HTTP data detected for hostname %s\n", ctrack->hostname);
}
if (bFail)

View File

@@ -129,9 +129,9 @@ static void exithelp(void)
{
printf(
" --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n"
" --bind-iface4=<interface_name>\t\t; bind to the first ipv4 addr of interface\n"
" --bind-iface6=<interface_name>\t\t; bind to the first ipv6 addr of interface\n"
" --bind-linklocal=no|unwanted|prefer|force ; prohibit, accept, prefer or force ipv6 link local bind\n"
" --bind-iface4=<interface_name>\t\t; bind to the first IPv4 addr of interface\n"
" --bind-iface6=<interface_name>\t\t; bind to the first IPv6 addr of interface\n"
" --bind-linklocal=no|unwanted|prefer|force ; prohibit, accept, prefer or force IPv6 link local bind\n"
" --bind-wait-ifup=<sec>\t\t\t; wait for interface to appear and up\n"
" --bind-wait-ip=<sec>\t\t\t; after ifup wait for ip address to appear up to N seconds\n"
" --bind-wait-ip-linklocal=<sec>\t\t; (prefer) accept only LL first N seconds then any (unwanted) accept only globals first N seconds then LL\n"
@@ -140,7 +140,7 @@ static void exithelp(void)
" --connect-bind-addr=<v4_addr>|<v6_addr> ; address for outbound connections. for v6 link locals append %%interface_name\n"
" --port=<port>\t\t\t\t; only one port number for all binds is supported\n"
" --socks\t\t\t\t; implement socks4/5 proxy instead of transparent proxy\n"
" --no-resolve\t\t\t\t; disable socks5 remote dns ability\n"
" --no-resolve\t\t\t\t; disable socks5 remote DNS ability\n"
" --resolver-threads=<int>\t\t; number of resolver worker threads\n"
" --local-rcvbuf=<bytes>\n"
" --local-sndbuf=<bytes>\n"
@@ -163,8 +163,8 @@ static void exithelp(void)
" --max-orphan-time=<sec>\t\t; if local leg sends something and closes and remote leg is still connecting then cancel connection attempt after N seconds\n"
" --daemon\t\t\t\t; daemonize\n"
" --pidfile=<filename>\t\t\t; write pid to file\n"
" --user=<username>\t\t\t; drop root privs\n"
" --uid=uid[:gid]\t\t\t; drop root privs\n"
" --user=<username>\t\t\t; drop root privileges\n"
" --uid=uid[:gid]\t\t\t; drop root privileges\n"
#if defined(__FreeBSD__)
" --enable-pf\t\t\t\t; enable PF redirector support. required in FreeBSD when used with PF firewall.\n"
#endif
@@ -175,13 +175,13 @@ static void exithelp(void)
" --hostlist-exclude=<filename>\t\t; do not act on hosts in the list (one host per line, subdomains auto apply, gzip supported, multiple hostlists allowed)\n"
" --hostlist-auto=<filename>\t\t; detect DPI blocks and build hostlist automatically\n"
" --hostlist-auto-fail-threshold=<int>\t; how many failed attempts cause hostname to be added to auto hostlist (default : %d)\n"
" --hostlist-auto-fail-time=<int>\t; all failed attemps must be within these seconds (default : %d)\n"
" --hostlist-auto-fail-time=<int>\t; all failed attempts must be within these seconds (default : %d)\n"
" --hostlist-auto-debug=<logfile>\t; debug auto hostlist positives\n"
"\nTAMPER:\n"
" --split-http-req=method|host\t\t; split at specified logical part of plain http request\n"
" --split-http-req=method|host\t\t; split at specified logical part of plain HTTP request\n"
" --split-tls=sni|sniext\t\t\t; split at specified logical part of TLS ClientHello\n"
" --split-pos=<numeric_offset>\t\t; split at specified pos. split-http-req or split-tls take precedence for http.\n"
" --split-any-protocol\t\t\t; split not only http and https\n"
" --split-pos=<numeric_offset>\t\t; split at specified pos. split-http-req or split-tls take precedence for HTTP.\n"
" --split-any-protocol\t\t\t; split not only HTTP and HTTPS\n"
#if defined(BSD) && !defined(__APPLE__)
" --disorder[=http|tls]\t\t\t; when splitting simulate sending second fragment first (BSD sends entire message instead of first fragment, this is not good)\n"
#else
@@ -303,7 +303,7 @@ void parse_params(int argc, char *argv[])
LIST_INIT(&params.hostlist_exclude_files);
#if defined(__OpenBSD__) || defined(__APPLE__)
params.pf_enable = true; // OpenBSD and MacOS have no other choice
params.pf_enable = true; // OpenBSD and macOS have no other choice
#endif
if (can_drop_root())
{
@@ -898,7 +898,7 @@ void parse_params(int argc, char *argv[])
#if defined(__linux__)
case 58: /* mss */
// this option does not work in any BSD and MacOS. OS may accept but it changes nothing
// this option does not work in any BSD and macOS. OS may accept but it changes nothing
params.mss = atoi(optarg);
if (params.mss < 88 || params.mss > 32767)
{
@@ -966,7 +966,7 @@ static bool find_listen_addr(struct sockaddr_storage *salisten, const char *bind
if (getifaddrs(&addrs) < 0)
return false;
// for ipv6 preference order
// for IPv6 preference order
// bind-linklocal-1 : link-local,any
// bind-linklocal=0 : private,global,link-local
for (int pass = 0; pass < 3; pass++)
@@ -1312,7 +1312,7 @@ int main(int argc, char *argv[])
goto exiterr;
if (!params.local_rcvbuf)
{
// HACK : dont know why but if dont set RCVBUF explicitly RCVBUF of accept()-ed socket can be very large. may be linux bug ?
// HACK : don't know why but if don't set RCVBUF explicitly RCVBUF of accept()-ed socket can be very large. may be Linux bug ?
int v;
socklen_t sz = sizeof(int);
if (!getsockopt(listen_fd[i], SOL_SOCKET, SO_RCVBUF, &v, &sz))
@@ -1326,7 +1326,7 @@ int main(int argc, char *argv[])
{
if (bind(listen_fd[i], (struct sockaddr *)&list[i].salisten, list[i].salisten_len) == -1)
{
// in linux strange behaviour was observed
// in Linux strange behaviour was observed
// just after ifup and address assignment there's short window when bind() can't bind to addresses got from getifaddrs()
// it does not happen to transparent sockets because they can bind to any non-existend ip
// also only IPv6 seem to be buggy this way

View File

@@ -514,7 +514,7 @@ static tproxy_conn_t *new_conn(int fd, bool remote)
conn->remote = remote;
#ifdef SPLICE_PRESENT
// if dont tamper - both legs are spliced, create 2 pipes
// if don't tamper - both legs are spliced, create 2 pipes
// otherwise create pipe only in local leg
if (!params.nosplice && (!remote || !params.tamper || params.tamper_start || params.tamper_cutoff) && pipe2(conn->splice_pipe, O_NONBLOCK) != 0)
{
@@ -817,14 +817,14 @@ bool proxy_mode_connect_remote(const struct sockaddr *sa, tproxy_conn_t *conn, s
if ((remote_fd = connect_remote(sa, bConnFooling)) < 0)
{
DLOG_ERR("socks failed to connect (1) errno=%d\n", errno);
DLOG_ERR("SOCKS failed to connect (1) errno=%d\n", errno);
socks_send_rep_errno(conn->socks_ver, conn->fd, errno);
return false;
}
if (!(conn->partner = new_conn(remote_fd, true)))
{
close(remote_fd);
DLOG_ERR("socks out-of-memory (1)\n");
DLOG_ERR("SOCKS out-of-memory (1)\n");
socks_send_rep(conn->socks_ver, conn->fd, S5_REP_GENERAL_FAILURE);
return false;
}
@@ -832,7 +832,7 @@ bool proxy_mode_connect_remote(const struct sockaddr *sa, tproxy_conn_t *conn, s
conn->partner->efd = conn->efd;
if (!epoll_set(conn->partner, EPOLLOUT))
{
DLOG_ERR("socks epoll_set error %d\n", errno);
DLOG_ERR("SOCKS epoll_set error %d\n", errno);
free_conn(conn->partner);
conn->partner = NULL;
socks_send_rep(conn->socks_ver, conn->fd, S5_REP_GENERAL_FAILURE);
@@ -848,7 +848,7 @@ bool proxy_mode_connect_remote(const struct sockaddr *sa, tproxy_conn_t *conn, s
static bool handle_proxy_mode(tproxy_conn_t *conn, struct tailhead *conn_list)
{
// To simplify things I dont care about buffering. If message splits, I just hang up
// To simplify things I don't care about buffering. If message splits, I just hang up
// in proxy mode messages are short. they can be split only intentionally. all normal programs send them in one packet
ssize_t rd, wr;
@@ -1175,7 +1175,7 @@ static bool handle_epoll(tproxy_conn_t *conn, struct tailhead *conn_list, uint32
{
// incoming data from remote leg we splice without touching
// pipe is in the local leg, so its in conn->partner->splice_pipe
// if we dont tamper - splice both legs
// if we don't tamper - splice both legs
rd = splice(conn->fd, NULL, conn->partner->splice_pipe[1], NULL, SPLICE_LEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
DBGPRINT("splice fd=%d remote=%d len=%d rd=%zd err=%d\n", conn->fd, conn->remote, SPLICE_LEN, rd, errno);