I'm implementing an NEFilterDataProvider
subclass on iOS, and am trying to make outbound network connections from it. Is this supposed to work?
URLSession
doesn't do it (the connection is never established); perhaps that's by design, considering NEProvider
offers createTCPConnection(to:enableTLS:tlsParameters:delegate:)
which seems to be designed for the job. However, calling this method doesn't work either; the connection never completes, and alternates between connecting
and waiting
state while the logging things like this:
nw_endpoint_handler_start [C8 Hostname#2169586f:443 initial path ((null))]
nw_endpoint_handler_reset_mode [C8 Hostname#2169586f:443 waiting path (unsatisfied (Path was denied by NECP policy), interface: en0, ipv4, dns)] reset
nw_connection_report_state_with_handler_on_nw_queue [C8] reporting state waiting
And on the first waiting
state, the NWTCPConnection
's error
shows:
The operation couldn’t be completed. (kNWErrorDomainDNS error -65563 - DNS Error: ServiceNotRunning)
which seems a bit strange because I'm connecting to an IP address (no DNS lookup required).
Am I overlooking something? Or is an NEFilterProvider
prohibited from actually making its own outbound connections?
thanks, -ben