2021-03-04 11:30:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2022-01-23 20:11:11 +00:00
|
|
|
#include <sys/param.h>
|
2022-07-26 16:15:28 +00:00
|
|
|
#include <sys/queue.h>
|
2024-03-23 19:57:05 +00:00
|
|
|
#include <time.h>
|
2024-04-04 08:40:42 +00:00
|
|
|
#include "tpws.h"
|
2023-10-26 12:12:32 +00:00
|
|
|
#include "pools.h"
|
2024-04-26 14:23:03 +00:00
|
|
|
#include "helpers.h"
|
2023-10-26 12:12:32 +00:00
|
|
|
|
2024-03-23 19:57:05 +00:00
|
|
|
#define HOSTLIST_AUTO_FAIL_THRESHOLD_DEFAULT 3
|
2023-10-26 12:12:32 +00:00
|
|
|
#define HOSTLIST_AUTO_FAIL_TIME_DEFAULT 60
|
2021-03-04 11:30:38 +00:00
|
|
|
|
|
|
|
enum splithttpreq { split_none = 0, split_method, split_host };
|
2023-10-12 09:35:06 +00:00
|
|
|
enum tlsrec { tlsrec_none = 0, tlsrec_sni, tlsrec_pos };
|
2021-03-08 19:33:21 +00:00
|
|
|
enum bindll { unwanted=0, no, prefer, force };
|
2021-03-04 11:30:38 +00:00
|
|
|
|
|
|
|
#define MAX_BINDS 32
|
|
|
|
struct bind_s
|
|
|
|
{
|
|
|
|
char bindaddr[64],bindiface[IF_NAMESIZE];
|
|
|
|
bool bind_if6;
|
2021-03-08 19:33:21 +00:00
|
|
|
enum bindll bindll;
|
2021-03-04 11:30:38 +00:00
|
|
|
int bind_wait_ifup,bind_wait_ip,bind_wait_ip_ll;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct params_s
|
|
|
|
{
|
|
|
|
struct bind_s binds[MAX_BINDS];
|
|
|
|
int binds_last;
|
|
|
|
bool bind_wait_only;
|
|
|
|
uint16_t port;
|
|
|
|
|
|
|
|
uint8_t proxy_type;
|
|
|
|
bool no_resolve;
|
|
|
|
bool skip_nodelay;
|
|
|
|
bool droproot;
|
|
|
|
uid_t uid;
|
|
|
|
gid_t gid;
|
|
|
|
bool daemon;
|
2024-04-02 15:14:03 +00:00
|
|
|
int maxconn,resolver_threads,maxfiles,max_orphan_time;
|
2021-03-04 11:30:38 +00:00
|
|
|
int local_rcvbuf,local_sndbuf,remote_rcvbuf,remote_sndbuf;
|
|
|
|
|
|
|
|
bool tamper; // any tamper option is set
|
|
|
|
bool hostcase, hostdot, hosttab, hostnospace, methodspace, methodeol, unixeol, domcase;
|
|
|
|
int hostpad;
|
|
|
|
char hostspell[4];
|
|
|
|
enum splithttpreq split_http_req;
|
2023-10-12 09:35:06 +00:00
|
|
|
enum tlsrec tlsrec;
|
|
|
|
int tlsrec_pos;
|
2021-03-04 11:30:38 +00:00
|
|
|
bool split_any_protocol;
|
|
|
|
int split_pos;
|
2024-03-26 08:38:31 +00:00
|
|
|
bool disorder, disorder_http, disorder_tls;
|
|
|
|
bool oob, oob_http, oob_tls;
|
2024-03-05 11:59:44 +00:00
|
|
|
uint8_t oob_byte;
|
2023-07-03 12:28:42 +00:00
|
|
|
int ttl_default;
|
2022-07-26 16:15:28 +00:00
|
|
|
|
2024-03-27 14:48:37 +00:00
|
|
|
int mss;
|
|
|
|
port_filter mss_pf;
|
|
|
|
|
2021-03-04 11:30:38 +00:00
|
|
|
char pidfile[256];
|
2022-07-26 16:15:28 +00:00
|
|
|
|
|
|
|
strpool *hostlist, *hostlist_exclude;
|
|
|
|
struct str_list_head hostlist_files, hostlist_exclude_files;
|
2023-11-09 09:08:09 +00:00
|
|
|
char hostlist_auto_filename[PATH_MAX], hostlist_auto_debuglog[PATH_MAX];
|
2023-10-26 12:12:32 +00:00
|
|
|
int hostlist_auto_fail_threshold, hostlist_auto_fail_time;
|
2024-03-23 19:57:05 +00:00
|
|
|
time_t hostlist_auto_mod_time;
|
2023-10-26 12:12:32 +00:00
|
|
|
hostfail_pool *hostlist_auto_fail_counters;
|
2021-03-04 11:30:38 +00:00
|
|
|
|
2024-03-09 11:26:07 +00:00
|
|
|
bool tamper_start_n,tamper_cutoff_n;
|
2024-03-05 11:59:44 +00:00
|
|
|
unsigned int tamper_start,tamper_cutoff;
|
|
|
|
|
2021-03-04 11:30:38 +00:00
|
|
|
int debug;
|
2022-01-23 20:11:11 +00:00
|
|
|
|
|
|
|
#if defined(BSD)
|
|
|
|
bool pf_enable;
|
|
|
|
#endif
|
2024-04-04 08:40:42 +00:00
|
|
|
#ifdef SPLICE_PRESENT
|
2024-04-03 19:21:17 +00:00
|
|
|
bool nosplice;
|
|
|
|
#endif
|
2021-03-04 11:30:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct params_s params;
|
|
|
|
|
|
|
|
#define _DBGPRINT(format, level, ...) { if (params.debug>=level) printf(format "\n", ##__VA_ARGS__); }
|
|
|
|
#define VPRINT(format, ...) _DBGPRINT(format,1,##__VA_ARGS__)
|
|
|
|
#define DBGPRINT(format, ...) _DBGPRINT(format,2,##__VA_ARGS__)
|
2023-11-09 09:08:09 +00:00
|
|
|
|
|
|
|
#define LOG_APPEND(filename, format, ...) \
|
|
|
|
{ \
|
|
|
|
FILE *F = fopen(filename,"at"); \
|
|
|
|
if (F) \
|
|
|
|
{ \
|
|
|
|
fprint_localtime(F); \
|
|
|
|
fprintf(F, " : " format "\n", ##__VA_ARGS__); \
|
|
|
|
fclose(F); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
#define HOSTLIST_DEBUGLOG_APPEND(format, ...) if (*params.hostlist_auto_debuglog) LOG_APPEND(params.hostlist_auto_debuglog, format, ##__VA_ARGS__)
|