Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

removed UDP

Sourav Kalaledfc10e150a2
diff --git a/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeApp.swift b/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeApp.swift
index 11be1fe..8528b54 100644
--- a/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeApp.swift
+++ b/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeApp.swift
@@ -24,25 +24,30 @@ class ProxyBridgeApp: NSObject {
print("ProxyBridge CLI - Starting")
+ signal(SIGINT, SIG_IGN)
+ signal(SIGTERM, SIG_IGN)
+
let sigintSource = DispatchSource.makeSignalSource(signal: SIGINT, queue: .main)
sigintSource.setEventHandler {
print("\nShutting down...")
+ fflush(stdout)
app.shouldKeepRunning = false
app.shutdown()
CFRunLoopStop(app.runLoop)
+ exit(0)
}
sigintSource.resume()
- signal(SIGINT, SIG_IGN)
let sigtermSource = DispatchSource.makeSignalSource(signal: SIGTERM, queue: .main)
sigtermSource.setEventHandler {
print("\nTerminating...")
+ fflush(stdout)
app.shouldKeepRunning = false
app.shutdown()
CFRunLoopStop(app.runLoop)
+ exit(0)
}
sigtermSource.resume()
- signal(SIGTERM, SIG_IGN)
app.installExtension()
diff --git a/MacOS/ProxyBridge/extension/AppProxyProvider.swift b/MacOS/ProxyBridge/extension/AppProxyProvider.swift
index 6860597..947919a 100644
--- a/MacOS/ProxyBridge/extension/AppProxyProvider.swift
+++ b/MacOS/ProxyBridge/extension/AppProxyProvider.swift
@@ -83,9 +83,8 @@ class AppProxyProvider: NETransparentProxyProvider {
override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {
if let tcpFlow = flow as? NEAppProxyTCPFlow {
logTCPConnection(tcpFlow)
- } else if let udpFlow = flow as? NEAppProxyUDPFlow {
- logUDPConnection(udpFlow)
}
+ // Let all traffic pass through directly
return false
}
@@ -110,27 +109,6 @@ class AppProxyProvider: NETransparentProxyProvider {
sendLogToApp(protocol: "TCP", process: processName, destination: destination, port: port)
}
- private func logUDPConnection(_ flow: NEAppProxyUDPFlow) {
- var destination = ""
- var port = ""
-
- if let localEndpoint = flow.localEndpoint,
- let localHost = localEndpoint as? NWHostEndpoint {
- destination = localHost.hostname
- port = localHost.port
- } else {
- destination = "unknown"
- port = "unknown"
- }
-
- var processName = "unknown"
- if let metaData = flow.metaData as? NEFlowMetaData {
- processName = metaData.sourceAppSigningIdentifier
- }
-
- sendLogToApp(protocol: "UDP", process: processName, destination: destination, port: port)
- }
-
private func sendLogToApp(protocol: String, process: String, destination: String, port: String) {
let logData: [String: String] = [
"type": "connection",