Why is the local ip and port obtained through localEndpoint 0.0.0.0:0 when handlenewflow (outbound flow), the remote ip and port are normal, and the local/remote ip and port for the inbound flow are normal.
override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}
os_log("Got a new flow with local endpoint %@, remote endpoint %@", localEndpoint, remoteEndpoint)
let flowInfo = [
FlowInfoKey.localPort.rawValue: localEndpoint.port,
FlowInfoKey.remoteAddress.rawValue: remoteEndpoint.hostname
]
let flowInfo2 = [
FlowInfoKey2.localAddress.rawValue: localEndpoint.hostname,
FlowInfoKey2.remotePort.rawValue: remoteEndpoint.port
]
……………………
}