[Q] In the method:
- (NEFilterDataVerdict *)handleInboundDataFromFlow:(NEFilterFlow *)flow readBytesStartOffset:(NSUInteger)offset readBytes:(NSData *)readBytes;
of a NEFilterDataProvider subclass, if flow is a _NEFilterSocketFlow *, is it possible for the remoteEndpoint property of the socket flow to be something else than a NWHostEndpoint *?
Can the remoteEndpoint of a
NEFilterSocketFlow
be something else than aNWHostEndpoint
?
No.
There are only two subclasses of NWEndpoint
, NWHostEndpoint
and NWBonjourServiceEndpoint
, and I think it’s safe to assume you won’t be getting the latter (-:
Having said that, I think it’s wise to code defensively here. That is, don’t trap if you get something weird. Rather, if you try to cast the remote endpoint to an NWHostEndpoint
and that fails, return an appropriated verdict from that method. For most filters that means denying the flow.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"