The most obvious cause for a problem like this is your NETransparentProxyNetworkSettings
, and specifically the value for includedNetworkRules
. How do you set that up?
In my test project I do this:
let includedNetworks = [("0.0.0.0", 0), ("::", 0)]
.map { addr, prefix -> NENetworkRule in
let endpoint = NWHostEndpoint(hostname: addr, port: "12345")
return NENetworkRule(destinationNetwork: endpoint, prefix: prefix, protocol: .any)
}
I tried this out on macOS 15.5 and it seems to work. Specifically:
-
I enabled the transparent proxy.
-
On another Mac, I started a UDP server using nc
:
nc -u -l 12345
-
I connect to it from three clients:
-
nc
, which uses a connected UDP socket
-
QNWTool
, a test tool I wrote that uses NWConnection
-
UDPSocketTest
, a test tool I wrote that uses a non-connected BSD Sockets
In all cases my provider saw the flow:
type: debug
time: 12:57:49.912415+0100
process: com.example.apple-samplecode.QNE2TransparentProxyMac.SysEx
subsystem: com.example.apple-samplecode.QNE2TransparentProxyMac
category: proxy
message: will let system handle flow, old, app: com.apple.nc, type: UDP, remote endpoint: 192.168.1.39:12345
type: debug
time: 12:58:19.749922+0100
process: com.example.apple-samplecode.QNE2TransparentProxyMac.SysEx
subsystem: com.example.apple-samplecode.QNE2TransparentProxyMac
category: proxy
message: will let system handle flow, old, app: QNWTool, type: UDP, remote endpoint: 192.168.1.39:12345
type: debug
time: 12:58:48.658703+0100
process: com.example.apple-samplecode.QNE2TransparentProxyMac.SysEx
subsystem: com.example.apple-samplecode.QNE2TransparentProxyMac
category: proxy
message: will let system handle flow, old, app: UDPSocketTest, type: UDP, remote endpoint: 192.168.1.39:12345
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"