NWHostEndpoint to filter all the traffic

struggling to set NEFilterRule for NEFilterDataProvider in order to filter (or for that matter allow) all the traffic.
have tried following :
[NWHostEndpoint endpointWithHostname:@"0.0.0.0" port:@"0"]
[NWHostEndpoint endpointWithHostname:@"" port:@"0"]
[NWHostEndpoint endpointWithHostname:@"0.0.0.0/0, " port:@"0"]
[NWHostEndpoint endpointWithHostname:@"0.0.0.0/0, ::/0" port:@"0"]

nothing of the above works .

how to construct the NWHostEndpoint in order to handle all the traffic .
thank you .

Did you manage to do this? I also want to specify all ports but cant figure out how to do it
I would start off with something very general and then try dialing it in to your needs. Something like this would work for capturing all TCP and UDP traffic:

Code Block objc
/* TCP Traffic */
NENetworkRule *anyTCPRule = [[NENetworkRule alloc] initWithRemoteNetwork: nil
remotePrefix: 0
localNetwork: nil
localPrefix: 0
protocol: NENetworkRuleProtocolTCP
direction: NETrafficDirectionAny];
/* UDP Traffic */
NENetworkRule *anyUDPRule = [[NENetworkRule alloc] initWithRemoteNetwork: nil
remotePrefix: 0
localNetwork: nil
localPrefix: 0
protocol: NENetworkRuleProtocolUDP
direction: NETrafficDirectionAny];
NEFilterRule *tcpFilterRule = [[NEFilterRule alloc] initWithNetworkRule: anyTCPRule action: NEFilterActionFilterData];
NEFilterRule *udpFilterRule = [[NEFilterRule alloc] initWithNetworkRule: anyUDPRule action: NEFilterActionFilterData];
NEFilterSettings *filterSettings = [[NEFilterSettings alloc] initWithRules:@[tcpFilterRule, udpFilterRule] defaultAction: NEFilterActionAllow];



Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
NWHostEndpoint to filter all the traffic
 
 
Q