How to get socket options from NEAppProxyFlow?

Hello. I'm developing a transparent proxy network extension by extending NETransparentProxyProvider. How can I get the original socket's options, i.e. what the app set using setsockopt() calls, from an NEAppProxyFlow? I'm particularly interested in the value of SO_KEEPALIVE, so I can enable keep-alives on my proxy's outgoing socket if they were enabled on the socket being proxied.

I got as far as -[NEAppProxyFlow setMetadata:] -> nw_parameters_copy_default_protocol_stack(nw_parameters_t) -> nw_protocol_stack_copy_transport_protocol(nw_protocol_stack_t), which returns an object of type nw_protocol_options_t, but there are no accessor functions to retrieve the actual values from it.

I'm particularly interested in the value of SO_KEEPALIVE, so I can enable keep-alives on my proxy's outgoing socket if they were enabled on the socket being proxied.

There is no way to do that, but it seems like a perfectly reasonable enhancement request.

Please post your bug number, just for the record.

I got as far as -[NEAppProxyFlow setMetadata:]

That approach won’t work. It’s only sets the metadata on the parameters, that is, the info need to identify its originator. It leaves all the other parameters unchanged.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

There is no way to do that, but it seems like a perfectly reasonable enhancement request.

Please post your bug number, just for the record.

Thanks for the suggestion! I've filed FB11655901.

How to get socket options from NEAppProxyFlow?
 
 
Q