Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic
C ccybersecurityhttp3httpproxylinuxlinux-proxymacosmacos-appmacos-proxyproxifierproxifier-alternativeproxyclienttcpthick-clientudpwindivertwindows
feat(macos): per-proxy "Let proxy resolve DNS (send hostname)" setting
AnoF-Cyber01fdd5896895
diff --git a/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeViewModel.swift b/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeViewModel.swiftindex 7888b97..e503838 100644--- a/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeViewModel.swift+++ b/MacOS/ProxyBridge/ProxyBridge/ProxyBridgeViewModel.swift@@ -37,6 +37,9 @@ class ProxyBridgeViewModel: NSObject, ObservableObject {let port: Intlet username: String?let password: String?+ // same as the windows app: true = the proxy gets the host name the app resolved+ // (socks5h / CONNECT host:port), false = it gets the ip. per proxy, on by default+ var sendDomain: Bool// name is optional, show type and host:port either wayvar displayName: String {@@ -44,7 +47,8 @@ class ProxyBridgeViewModel: NSObject, ObservableObject {return name.isEmpty ? server : "\(name) = \(server)"}- init(id: String = UUID().uuidString, name: String = "", type: String, host: String, port: Int, username: String?, password: String?) {+ init(id: String = UUID().uuidString, name: String = "", type: String, host: String, port: Int, username: String?, password: String?, sendDomain: Bool = true) {+ self.sendDomain = sendDomainself.id = idself.name = nameself.type = type@@ -63,6 +67,8 @@ class ProxyBridgeViewModel: NSObject, ObservableObject {self.port = try c.decode(Int.self, forKey: .port)self.username = try c.decodeIfPresent(String.self, forKey: .username)self.password = try c.decodeIfPresent(String.self, forKey: .password)+ // proxies saved before this option existed behave like the windows default+ self.sendDomain = try c.decodeIfPresent(Bool.self, forKey: .sendDomain) ?? true}}@@ -674,7 +680,8 @@ class ProxyBridgeViewModel: NSObject, ObservableObject {"id": config.id,"proxyType": config.type,"proxyHost": config.host,- "proxyPort": config.port+ "proxyPort": config.port,+ "sendDomainToProxy": config.sendDomain]if let u = config.username { dict["proxyUsername"] = u }if let p = config.password { dict["proxyPassword"] = p }diff --git a/MacOS/ProxyBridge/ProxyBridge/ProxySettingsView.swift b/MacOS/ProxyBridge/ProxyBridge/ProxySettingsView.swiftindex 92b5e64..bf74b89 100644--- a/MacOS/ProxyBridge/ProxyBridge/ProxySettingsView.swift+++ b/MacOS/ProxyBridge/ProxyBridge/ProxySettingsView.swift@@ -180,6 +180,7 @@ struct ProxyConfigEditorView: View {@State private var proxyPort = ""@State private var username = ""@State private var password = ""+ @State private var sendDomain = true@State private var validationError = ""private let proxyTypes = ["http", "socks5"]@@ -230,6 +231,14 @@ struct ProxyConfigEditorView: View {}.padding(.vertical, 8)+ VStack(alignment: .leading, spacing: 4) {+ Toggle("Let proxy resolve DNS (send hostname)", isOn: $sendDomain)+ Text("On: the proxy gets the host name the app looked up. Off: it gets the IP address. Turn it off for a proxy that can't resolve the names your Mac can.")+ .font(.caption)+ .foregroundColor(.secondary)+ }+ .padding(.vertical, 8)+if !validationError.isEmpty {HStack {Image(systemName: "exclamationmark.triangle.fill").foregroundColor(.red)@@ -254,7 +263,7 @@ struct ProxyConfigEditorView: View {.padding().background(Color(NSColor.controlBackgroundColor))}- .frame(width: 500, height: 520)+ .frame(width: 500, height: 610).onAppear {if let e = existing {configName = e.name@@ -263,6 +272,7 @@ struct ProxyConfigEditorView: View {proxyPort = String(e.port)username = e.username ?? ""password = e.password ?? ""+ sendDomain = e.sendDomain}validateInputs()}@@ -316,7 +326,8 @@ struct ProxyConfigEditorView: View {host: proxyHost,port: port,username: username.isEmpty ? nil : username,- password: password.isEmpty ? nil : password+ password: password.isEmpty ? nil : password,+ sendDomain: sendDomain)if existing != nil {viewModel.updateProxyConfig(config)