IP address and Port in NEFilterDataProvider

I am implementing Network Extension - NEFilterDataProvider.
checking whether we get IP address and port for the flow in handleNewFlow ?

how do we fetch the IP address & Port in this type of Network Extension (socket level ) ??

any pointer would help

Accepted Reply

Check to see if you are getting the local or remote endpoints on the NEFilterSocketFlow?

Code Block swift
guard let socketFlow = flow as? NEFilterSocketFlow,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}


Otherwise, check the incoming NEFilterFlow directly in handleNewFlow; There should be a lot of information on here.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Replies

Check to see if you are getting the local or remote endpoints on the NEFilterSocketFlow?

Code Block swift
guard let socketFlow = flow as? NEFilterSocketFlow,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}


Otherwise, check the incoming NEFilterFlow directly in handleNewFlow; There should be a lot of information on here.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
many thanks Matt. that was of great help.
No problem at all. Always glad to help.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com