Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic
C ccybersecurityhttp3httpproxylinuxlinux-proxymacosmacos-appmacos-proxyproxifierproxifier-alternativeproxyclienttcpthick-clientudpwindivertwindows
feat(windows): 'Log Every Connection' setting for the Connections log (#205)
AnoF-Cyber943b576e9229
diff --git a/Windows/README.md b/Windows/README.mdindex c5b38d2..cc43168 100644--- a/Windows/README.md+++ b/Windows/README.md@@ -231,6 +231,13 @@ directly: proxy rules **and block rules** do not apply, and the window title andConnections that were already being proxied keep working until they end. Tick the item again to apply the rulesto new connections. ProxyBridge always starts enabled; the switch is not remembered between runs.+**Connections log - one row per connection or per destination:** by default the Connections log shows a connection+only once for each identical (application, destination IP, destination port, action), which keeps it short: an app+that opens 50 connections to the same server gets one row. Tick **Settings → Log Every Connection** to log **every new+TCP connection** and **every new UDP flow** instead (a UDP flow is one local port talking to one destination; it is+logged again only after 30 seconds of silence, so busy or blocked UDP senders do not flood the log). The setting is+saved per profile. It only changes what is listed: rules are applied to the same connections either way.+**Note:** Adding a rule with action **PROXY** while no proxy is configured will fall back to a direct connection. Configure at least one proxy server before using PROXY rules.### Command Line Interface (CLI)diff --git a/Windows/gui/api/pb_api.h b/Windows/gui/api/pb_api.hindex 6d15471..c18b1b7 100644--- a/Windows/gui/api/pb_api.h+++ b/Windows/gui/api/pb_api.h@@ -37,6 +37,7 @@ typedef void (*PFN_SetLogCallback)(PBLogCallback);typedef void (*PFN_SetConnectionCallback)(PBConnectionCallback);typedef void (*PFN_SetTrafficLoggingEnabled)(BOOL);typedef void (*PFN_SetEnabled)(BOOL);+typedef void (*PFN_SetLogEveryConnection)(BOOL);typedef void (*PFN_ClearConnectionLogs)(void);typedef BOOL (*PFN_Start)(void);typedef BOOL (*PFN_Stop)(void);@@ -60,6 +61,7 @@ typedef struct {PFN_SetConnectionCallback SetConnectionCallback;PFN_SetTrafficLoggingEnabled SetTrafficLoggingEnabled;PFN_SetEnabled SetEnabled;+ PFN_SetLogEveryConnection SetLogEveryConnection;PFN_ClearConnectionLogs ClearConnectionLogs;PFN_Start Start;PFN_Stop Stop;@@ -105,6 +107,7 @@ static BOOL PB_LoadDirect(PBApi* api)PB_BIND(SetConnectionCallback, "SetConnectionCallback");PB_BIND(SetTrafficLoggingEnabled, "SetTrafficLoggingEnabled");PB_BIND(SetEnabled, "SetEnabled");+ PB_BIND(SetLogEveryConnection, "SetLogEveryConnection");PB_BIND(ClearConnectionLogs, "ClearConnectionLogs");PB_BIND(Start, "Start");PB_BIND(Stop, "Stop");diff --git a/Windows/gui/api/pb_ipc.h b/Windows/gui/api/pb_ipc.hindex e327a29..82fca01 100644--- a/Windows/gui/api/pb_ipc.h+++ b/Windows/gui/api/pb_ipc.h@@ -128,6 +128,7 @@ static BOOL IpcMoveRule(UINT32 id, UINT32 pos) { PBIPC_BEGIN(PBOP_MOVE_RULE); Pbstatic UINT32 IpcGetRulePos(UINT32 id) { PBIPC_BEGIN(PBOP_GET_RULE_POS); PbW_U32(&_w, id); PBIPC_END(); }static void IpcSetTrafficLog(BOOL v) { PBIPC_BEGIN(PBOP_SET_TRAFFIC_LOG); PbW_U32(&_w, v != 0); PbIpcCall(_b, _w.len); }static void IpcClearConnLogs(void) { PBIPC_BEGIN(PBOP_CLEAR_CONN_LOGS); PbIpcCall(_b, _w.len); }+static void IpcSetLogAll(BOOL v) { PBIPC_BEGIN(PBOP_SET_LOG_ALL); PbW_U32(&_w, v != 0); PbIpcCall(_b, _w.len); }static void IpcSetEnabled(BOOL v) { PBIPC_BEGIN(PBOP_SET_ENABLED); PbW_U32(&_w, v != 0); PbIpcCall(_b, _w.len); }static void IpcSetLogCallback(PBLogCallback cb) { g_ipcLogCb = cb; }static void IpcSetConnectionCallback(PBConnectionCallback cb) { g_ipcConnCb = cb; }@@ -245,7 +246,7 @@ static int PB_LoadService(PBApi* api)api->MoveRuleToPosition = IpcMoveRule; api->GetRulePosition = IpcGetRulePos;api->SetLogCallback = IpcSetLogCallback;api->SetConnectionCallback = IpcSetConnectionCallback;- api->SetTrafficLoggingEnabled = IpcSetTrafficLog; api->SetEnabled = IpcSetEnabled;+ api->SetTrafficLoggingEnabled = IpcSetTrafficLog; api->SetEnabled = IpcSetEnabled; api->SetLogEveryConnection = IpcSetLogAll;api->ClearConnectionLogs = IpcClearConnLogs; api->Start = IpcStart; api->Stop = IpcStop;return PB_IPC_OK;}diff --git a/Windows/gui/loc/loc.h b/Windows/gui/loc/loc.hindex 77e0262..bff4d79 100644--- a/Windows/gui/loc/loc.h+++ b/Windows/gui/loc/loc.h@@ -30,7 +30,7 @@ enum {S_BTN_CHECK, S_TEST_OK, S_TEST_FAIL, S_TEST_TITLE,S_DLG_CHECKER, S_BTN_RETEST, S_TEST_RUNNING, S_CK_HOST, S_BTN_BROWSE,S_EX_APPS, S_EX_HOSTS, S_EX_PORTS, S_UDP_NOTE, S_EX_LOCALHOST,- S_M_AUTOCLEAR, S_M_RENAME, S_M_LOGFILTERS, S_DLG_RENAME,+ S_M_AUTOCLEAR, S_M_LOGALL, S_M_RENAME, S_M_LOGFILTERS, S_DLG_RENAME,S_DLG_FILTERS, S_DLG_FILTER, S_FL_DESC, S_L_MODE, S_L_PROC, S_L_IP,S_COL_MODE, S_COL_PROC, S_COL_IP, S_INFO_NORENAMEDEFAULT, S_ERR_RUNNING,S_AB_VERSION, S_AB_DESC, S_AB_AUTHOR, S_AB_WEB, S_AB_GITHUB, S_AB_LICENSE,@@ -157,6 +157,7 @@ static const wchar_t* const g_strings[S_COUNT][2] = {/* S_EX_LOCALHOST */ { L"Off: this rule's connections to localhost (127.0.0.1, ::1) stay direct. On: they go through the proxy too (e.g. to intercept local traffic).",L"关闭: 此规则匹配的本地主机连接(127.0.0.1、::1)直连。开启: 同样通过代理(例如拦截本地流量)。" },/* S_M_AUTOCLEAR */ { L"Auto Clear Logs", L"自动清除日志" },+ /* S_M_LOGALL */ { L"Log Every Connection", L"记录每个连接" },/* S_M_RENAME */ { L"Rename Profile", L"重命名配置" },/* S_M_LOGFILTERS */ { L"Log Filters...", L"日志过滤器..." },/* S_DLG_RENAME */ { L"Rename Profile", L"重命名配置" },diff --git a/Windows/gui/main.c b/Windows/gui/main.cindex a31f878..1336675 100644--- a/Windows/gui/main.c+++ b/Windows/gui/main.c@@ -128,6 +128,7 @@ static wchar_t g_activeProfile[PB_NAME_MAX] = L"Default";static BOOL g_trafficLog = TRUE, g_closeToTray = TRUE;static BOOL g_proxyEnabled = TRUE; // main switch; not saved: ProxyBridge always starts enabledstatic BOOL g_startup = FALSE; // "Run at Startup" (schtasks logon task)+static BOOL g_logEvery = FALSE; // log every new connection (no de-duplication); saved per profilestatic BOOL g_autoClear = TRUE; // auto-clear logs past a line threshold to save memory#define AUTO_CLEAR_LINES 500static PBFilter g_flt[PB_MAX_FILTER]; // connection-log filter snapshot (read by native cb)@@ -320,9 +321,11 @@ static void SwitchToProfile(const wchar_t* name)g_trafficLog = g_profile.trafficLogging;g_closeToTray = g_profile.closeToTray;g_autoClear = g_profile.autoClearLogs;+ g_logEvery = g_profile.logEveryConnection != 0;if (g_profile.fontZoom != g_zoom) { g_zoom = g_profile.fontZoom; ApplyZoom(g_hMain); }ApplyFilterSnapshot();g_api.SetTrafficLoggingEnabled(g_trafficLog);+ g_api.SetLogEveryConnection(g_logEvery);ApplyConfigs();ApplyRules();SyncMenuChecks(g_hMain);@@ -381,6 +384,7 @@ static void BuildMainMenu(HWND hwnd)AppendMenuW(settings, MF_STRING, IDM_SET_CLOSETOTRAY, T(S_M_TRAY));AppendMenuW(settings, MF_STRING, IDM_SET_STARTUP, T(S_M_STARTUP));AppendMenuW(settings, MF_STRING, IDM_SET_AUTOCLEAR, T(S_M_AUTOCLEAR));+ AppendMenuW(settings, MF_STRING, IDM_SET_LOGALL, T(S_M_LOGALL));AppendMenuW(settings, MF_SEPARATOR, 0, NULL);AppendMenuW(settings, MF_STRING, IDM_ZOOM_IN, T(S_M_ZOOM_IN));AppendMenuW(settings, MF_STRING, IDM_ZOOM_OUT, T(S_M_ZOOM_OUT));@@ -572,6 +576,7 @@ static void SyncMenuChecks(HWND hwnd)CheckMenuItem(m, IDM_SET_CLOSETOTRAY, MF_BYCOMMAND | (g_closeToTray? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(m, IDM_SET_STARTUP, MF_BYCOMMAND | (g_startup ? MF_CHECKED : MF_UNCHECKED));CheckMenuItem(m, IDM_SET_AUTOCLEAR, MF_BYCOMMAND | (g_autoClear ? MF_CHECKED : MF_UNCHECKED));+ CheckMenuItem(m, IDM_SET_LOGALL, MF_BYCOMMAND | (g_logEvery ? MF_CHECKED : MF_UNCHECKED));int zh = (_wcsicmp(g_profile.language, L"zh") == 0);CheckMenuItem(m, IDM_LANG_EN, MF_BYCOMMAND | (zh ? MF_UNCHECKED : MF_CHECKED));CheckMenuItem(m, IDM_LANG_ZH, MF_BYCOMMAND | (zh ? MF_CHECKED : MF_UNCHECKED));@@ -921,6 +926,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)g_startup = !g_startup; StartupSet(g_startup);g_startup = StartupIsEnabled(); // reflect the real stateSyncMenuChecks(hwnd); return 0;+ case IDM_SET_LOGALL:+ g_logEvery = !g_logEvery; g_profile.logEveryConnection = g_logEvery;+ g_api.SetLogEveryConnection(g_logEvery); SaveActive(); SyncMenuChecks(hwnd); return 0;case IDM_SET_AUTOCLEAR:g_autoClear = !g_autoClear; g_profile.autoClearLogs = g_autoClear;SaveActive(); SyncMenuChecks(hwnd); return 0;@@ -1143,6 +1151,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR cmd, int show)return 1;g_autoClear = g_profile.autoClearLogs;+ g_logEvery = g_profile.logEveryConnection != 0;g_startup = StartupIsEnabled();ApplyFilterSnapshot();@@ -1201,6 +1210,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR cmd, int show)// Wire callbacks + toggles, add configs (before Start so the UDP relay starts), start,// then add rules.g_api.SetTrafficLoggingEnabled(g_trafficLog);+ g_api.SetLogEveryConnection(g_logEvery);g_api.SetEnabled(g_proxyEnabled);g_api.SetLogCallback(PBLogCb);g_api.SetConnectionCallback(PBConnCb);diff --git a/Windows/gui/profile/profile.c b/Windows/gui/profile/profile.cindex 344246f..473fe5f 100644--- a/Windows/gui/profile/profile.c+++ b/Windows/gui/profile/profile.c@@ -280,6 +280,7 @@ void PB_ProfileDefaults(PBProfile* p, const wchar_t* name)ZeroMemory(p, sizeof(*p));p->trafficLogging = 1;p->autoClearLogs = 1;+ p->logEveryConnection = 0;p->closeToTray = 1;p->fontZoom = 100;lstrcpynW(p->language, L"en", 8);@@ -324,6 +325,7 @@ void PB_ProfileLoad(const wchar_t* name, PBProfile* p)int oldGlobalLocalhost = json_bool(root, "LocalhostViaProxy", 0);p->trafficLogging = json_bool(root, "IsTrafficLoggingEnabled", 1);p->autoClearLogs = json_bool(root, "AutoClearConnectionLogs", 1);+ p->logEveryConnection = json_bool(root, "LogEveryConnection", 0);p->closeToTray = json_bool(root, "CloseToTray", 1);p->nextCfgId = (UINT32)json_long(root, "NextProxyConfigId", 0);p->fontZoom = (int)json_long(root, "FontZoom", 100);@@ -417,6 +419,7 @@ BOOL PB_ProfileSave(const wchar_t* name, const PBProfile* p)put_kv_str(&b, " ", "Name", name, ",\n");sb_put(&b, " \"IsTrafficLoggingEnabled\": "); sb_put(&b, p->trafficLogging ? "true" : "false"); sb_put(&b, ",\n");sb_put(&b, " \"AutoClearConnectionLogs\": "); sb_put(&b, p->autoClearLogs ? "true" : "false"); sb_put(&b, ",\n");+ sb_put(&b, " \"LogEveryConnection\": "); sb_put(&b, p->logEveryConnection ? "true" : "false"); sb_put(&b, ",\n");put_kv_str(&b, " ", "Language", p->language, ",\n");sb_put(&b, " \"CloseToTray\": "); sb_put(&b, p->closeToTray ? "true" : "false"); sb_put(&b, ",\n");{ char zb[48]; _snprintf_s(zb, sizeof(zb), _TRUNCATE, " \"FontZoom\": %d,\n", p->fontZoom); sb_put(&b, zb); }diff --git a/Windows/gui/profile/profile.h b/Windows/gui/profile/profile.hindex 2980bf6..a4e4faa 100644--- a/Windows/gui/profile/profile.h+++ b/Windows/gui/profile/profile.h@@ -56,6 +56,7 @@ UINT32 PB_AllocConfigId(PBProfile* p);typedef struct PBProfile {int trafficLogging;int autoClearLogs;+ int logEveryConnection; // 1 = the Connections log shows every new connection, not just the first of identical onesint closeToTray;int fontZoom; // UI/log text zoom in percent (60-300), 100 = DPI defaultUINT32 nextCfgId; // next stable proxy-config id to hand out (persisted; ids are never reused)diff --git a/Windows/gui/res/resource.h b/Windows/gui/res/resource.hindex b663833..211a6c1 100644--- a/Windows/gui/res/resource.h+++ b/Windows/gui/res/resource.h@@ -27,6 +27,7 @@#define IDM_ZOOM_OUT 224#define IDM_ZOOM_RESET 225#define IDM_PROXY_ENABLE 226 // main on/off switch+#define IDM_SET_LOGALL 227 // log every connection (no de-duplication)#define IDM_PROFILE_RENAME 244// Log Filters (list) dialogdiff --git a/Windows/src/ProxyBridge.c b/Windows/src/ProxyBridge.cindex ba202f9..8d5cf3c 100644--- a/Windows/src/ProxyBridge.c+++ b/Windows/src/ProxyBridge.c@@ -292,7 +292,7 @@ DWORD WINAPI packet_processor(LPVOID arg)char pname[MAX_PROCESS_NAME];if (get_process_name_from_pid(pid6u, pname, sizeof(pname))){- if (!is_connection_already_logged(pid6u, v6key, dp, action6u))+ if (connection_log_wanted(pid6u, v6key, dp, sp, TRUE, action6u)){char dstr[64];inet_ntop(AF_INET6, ipv6_header->DstAddr, dstr, sizeof(dstr));@@ -487,7 +487,7 @@ DWORD WINAPI packet_processor(LPVOID arg)char process_name[MAX_PROCESS_NAME];if (get_process_name_from_pid(pid6, process_name, sizeof(process_name))){- if (!is_connection_already_logged(pid6, v6key, dp, action6))+ if (connection_log_wanted(pid6, v6key, dp, sp, FALSE, action6)){char dest_ip_str[64];const UINT8 *d6 = (const UINT8*)ipv6_header->DstAddr;@@ -678,7 +678,7 @@ DWORD WINAPI packet_processor(LPVOID arg)if (pid > 0 && get_process_name_from_pid(pid, process_name, sizeof(process_name))){- if (!is_connection_already_logged(pid, dest_ip, dest_port, action))+ if (connection_log_wanted(pid, dest_ip, dest_port, src_port, TRUE, action)){char dest_ip_str[32];format_ip_address(dest_ip, dest_ip_str, sizeof(dest_ip_str));@@ -928,7 +928,7 @@ DWORD WINAPI packet_processor(LPVOID arg)char process_name[MAX_PROCESS_NAME];if (pid > 0 && get_process_name_from_pid(pid, process_name, sizeof(process_name))){- if (!is_connection_already_logged(pid, orig_dest_ip, orig_dest_port, action))+ if (connection_log_wanted(pid, orig_dest_ip, orig_dest_port, src_port, FALSE, action)){char dest_ip_str[32];snprintf(dest_ip_str, sizeof(dest_ip_str), "%d.%d.%d.%d",@@ -1039,6 +1039,14 @@ DWORD WINAPI packet_processor(LPVOID arg)// Main on/off switch. FALSE pauses ProxyBridge without stopping the capture driver: every NEW connection is// sent directly, and no rule (proxy or block) applies. Connections that are already being proxied keep working// until they end. TRUE (the default) applies the rules again.+// "Log every connection": FALSE (default) shows a connection once per (process, destination, port, action);+// TRUE logs every new TCP connection and every new UDP flow.+PROXYBRIDGE_API void ProxyBridge_SetLogEveryConnection(BOOL enable)+{+ g_log_every_connection = enable ? TRUE : FALSE;+ clear_logged_connections();+}+PROXYBRIDGE_API void ProxyBridge_SetEnabled(BOOL enable){BOOL was = g_proxy_enabled;diff --git a/Windows/src/ProxyBridge.h b/Windows/src/ProxyBridge.hindex a051b51..33f407e 100644--- a/Windows/src/ProxyBridge.h+++ b/Windows/src/ProxyBridge.h@@ -61,6 +61,7 @@ PROXYBRIDGE_API BOOL ProxyBridge_DeleteRule(UINT32 rule_id);PROXYBRIDGE_API BOOL ProxyBridge_EditRule(UINT32 rule_id, const char* process_name, const char* target_hosts, const char* target_ports, const char* target_domains, RuleProtocol protocol, RuleAction action, UINT32 proxy_config_id, BOOL localhost_via_proxy);PROXYBRIDGE_API BOOL ProxyBridge_MoveRuleToPosition(UINT32 rule_id, UINT32 new_position); // Move rule to specific position (1=first, 2=second, etc)PROXYBRIDGE_API UINT32 ProxyBridge_GetRulePosition(UINT32 rule_id); // Get current position of rule in list (1-based)+PROXYBRIDGE_API void ProxyBridge_SetLogEveryConnection(BOOL enable); // FALSE (default): Connections log skips repeats; TRUE: every new connectionPROXYBRIDGE_API void ProxyBridge_SetEnabled(BOOL enable); // main switch: FALSE pauses all rules for new connections (default TRUE)PROXYBRIDGE_API void ProxyBridge_SetLogCallback(LogCallback callback);PROXYBRIDGE_API void ProxyBridge_SetConnectionCallback(ConnectionCallback callback);diff --git a/Windows/src/pb_conntrack.c b/Windows/src/pb_conntrack.cindex 667c61a..18ccb30 100644--- a/Windows/src/pb_conntrack.c+++ b/Windows/src/pb_conntrack.c@@ -496,6 +496,8 @@ BOOL is_connection_already_logged(DWORD pid, UINT32 dest_ip, UINT16 dest_port, Rvoid add_logged_connection(DWORD pid, UINT32 dest_ip, UINT16 dest_port, RuleAction action){+ if (g_log_every_connection) return; // not de-duplicating: nothing to remember+AcquireSRWLockExclusive(&lock);// Use the running counter instead of re-walking the whole list on every add.@@ -554,3 +556,45 @@ void clear_logged_connections(void)ReleaseSRWLockExclusive(&lock);}+// ---- "Log every connection" ----+// Off (default): the Connections log shows a connection once per (process, destination, port, action), see+// is_connection_already_logged(). On: every new TCP connection is logged (the caller asks only on the SYN), and a UDP+// flow - identified by process, local port, destination and action - is logged once, and again only after it has been+// silent for 30 s, so a busy UDP flow or a blocked sender does not flood the log.+volatile BOOL g_log_every_connection = FALSE;++#define UDP_LOGFLOW_SIZE 512+#define UDP_LOGFLOW_QUIET_MS 30000+typedef struct { BOOL used; DWORD pid; UINT32 dkey; UINT16 sport, dport; UINT8 action; ULONGLONG t; } UDP_LOGFLOW;+static UDP_LOGFLOW g_udp_logflow[UDP_LOGFLOW_SIZE];++BOOL connection_log_wanted(DWORD pid, UINT32 dest_key, UINT16 dest_port, UINT16 src_port, BOOL is_udp, RuleAction action)+{+ if (!g_log_every_connection)+ return !is_connection_already_logged(pid, dest_key, dest_port, action);+ if (!is_udp)+ return TRUE;++ ULONGLONG now = GetTickCount64();+ BOOL want = TRUE;+ int slot = -1, oldest = 0;+ AcquireSRWLockExclusive(&lock);+ for (int i = 0; i < UDP_LOGFLOW_SIZE; i++)+ {+ UDP_LOGFLOW *f = &g_udp_logflow[i];+ if (!f->used) { if (slot < 0) slot = i; continue; }+ if (f->pid == pid && f->dkey == dest_key && f->sport == src_port && f->dport == dest_port && f->action == (UINT8)action)+ {+ want = (now - f->t) >= UDP_LOGFLOW_QUIET_MS; // same flow: only after a quiet period+ f->t = now;+ ReleaseSRWLockExclusive(&lock);+ return want;+ }+ if (f->t < g_udp_logflow[oldest].t) oldest = i;+ }+ if (slot < 0) slot = oldest; // table full: recycle the longest-silent flow+ UDP_LOGFLOW *n = &g_udp_logflow[slot];+ n->used = TRUE; n->pid = pid; n->dkey = dest_key; n->sport = src_port; n->dport = dest_port; n->action = (UINT8)action; n->t = now;+ ReleaseSRWLockExclusive(&lock);+ return want;+}diff --git a/Windows/src/pb_internal.h b/Windows/src/pb_internal.hindex d296a52..570ed91 100644--- a/Windows/src/pb_internal.h+++ b/Windows/src/pb_internal.h@@ -197,6 +197,7 @@ extern HANDLE cleanup_thread;extern PID_CACHE_ENTRY *pid_cache[PID_CACHE_SIZE];extern volatile BOOL g_has_active_rules;extern volatile BOOL g_has_domain_rules;+extern volatile BOOL g_log_every_connection; // TRUE: the Connections log is not de-duplicated (every new TCP connection, every new UDP flow)extern volatile BOOL g_proxy_enabled; // FALSE = paused: new connections are neither proxied nor blocked (existing ones carry on)extern SOCKET udp_relay_socket;extern SOCKET udp_relay_socket6;@@ -375,6 +376,9 @@ void remove_connection(UINT16 src_port, BOOL is_udp, BOOL is_ipv6);void cleanup_stale_connections(void);BOOL is_connection_already_logged(DWORD pid, UINT32 dest_ip, UINT16 dest_port, RuleAction action);void add_logged_connection(DWORD pid, UINT32 dest_ip, UINT16 dest_port, RuleAction action);+// Should this connection get a row in the Connections log? Default: only the first of identical (process, destination,+// port, action). With g_log_every_connection: every new TCP connection, and one row per UDP flow (again after 30 s of silence).+BOOL connection_log_wanted(DWORD pid, UINT32 dest_key, UINT16 dest_port, UINT16 src_port, BOOL is_udp, RuleAction action);void clear_logged_connections(void);// ---- pb_relay.c ----diff --git a/Windows/src/service/pb_proto.h b/Windows/src/service/pb_proto.hindex 2795876..b084517 100644--- a/Windows/src/service/pb_proto.h+++ b/Windows/src/service/pb_proto.h@@ -19,7 +19,7 @@#define PB_SERVICE_NAME L"ProxyBridgeSvc"#define PB_PIPE_CTL L"\\\\.\\pipe\\ProxyBridgeCtl"#define PB_PIPE_EVT L"\\\\.\\pipe\\ProxyBridgeEvt"-#define PB_PROTO_VERSION 3 // 3: PBOP_SET_ENABLED (main switch); 2: per-rule localhost flag+#define PB_PROTO_VERSION 4 // 4: PBOP_SET_LOG_ALL; 3: PBOP_SET_ENABLED (main switch); 2: per-rule localhost flag#define PB_MSG_MAX (64u * 1024u)#define PB_STR_MAX (32u * 1024u)#define PB_NULL_STR 0xFFFFFFFFu@@ -41,7 +41,8 @@ enum {PBOP_CLEAR_CONN_LOGS, // () -> 0PBOP_START, // () -> boolPBOP_STOP, // () -> bool- PBOP_SET_ENABLED // bool -> 0 (main switch: 0 pauses all rules for new connections)+ PBOP_SET_ENABLED, // bool -> 0 (main switch: 0 pauses all rules for new connections)+ PBOP_SET_LOG_ALL // bool -> 0 (1 = log every new connection, no de-duplication)};enum {diff --git a/Windows/src/service/pb_service.c b/Windows/src/service/pb_service.cindex 1b2e27f..6b40df2 100644--- a/Windows/src/service/pb_service.c+++ b/Windows/src/service/pb_service.c@@ -171,6 +171,7 @@ static BOOL Dispatch(const BYTE *req, DWORD reqLen, PbW *resp)case PBOP_SET_TRAFFIC_LOG: { UINT32 v = PbR_U32(&r); if (!r.ok) return FALSE; g_api.SetTrafficLoggingEnabled(v != 0); break; }case PBOP_CLEAR_CONN_LOGS: g_api.ClearConnectionLogs(); break;+ case PBOP_SET_LOG_ALL: { UINT32 v = PbR_U32(&r); if (!r.ok) return FALSE; g_api.SetLogEveryConnection(v != 0); break; }case PBOP_SET_ENABLED: { UINT32 v = PbR_U32(&r); if (!r.ok) return FALSE; g_api.SetEnabled(v != 0); break; }case PBOP_START: ret = g_api.Start(); break;case PBOP_STOP: ret = g_api.Stop(); break;