handleNewFlow of NEAppProxyProvider subclass isn't called

Hi! I am experimenting with NEAppProxyProvider (I just want to see the differences between this and NETransparentProxyProvider in action). I have subclassed it in my system extension and it seems like it reaches the startProxy point because I see the corresponding logs. I didn't forget to call the completion handler. However, I do not see logs about flow handling. Can you suggest to me why? Posting the extension source code just in case.


import Foundation
import NetworkExtension
import OSLog

class AppProxyProvider: NEAppProxyProvider {
    override func startProxy(options: [String : Any]? = nil, completionHandler: @escaping (Error?) -> Void) {
        Logger.appProxyProviderSystExt.warning("Starting NEAppProxy")
        setTunnelNetworkSettings(configureProxy()) { error in
            if let error {
                Logger.appProxyProviderSystExt.warning("\(#functicompletionHandler(nil)on) Unable to set settings for NEAppProxy syst ext")
                completionHandler(error)
                return
            }
            completionHandler(nil)
        }
    }
    
    override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {
        Logger.appProxyProviderSystExt.warning("Handling flow")
        return false
    }
    
    override func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
        Logger.appProxyProviderSystExt.warning("Stopping NEAppProxy")
        completionHandler()
    }
    
    override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
        completionHandler?(nil)
    }

    private func configureProxy() -> NETunnelNetworkSettings {
        let settings = NETunnelNetworkSettings(tunnelRemoteAddress: "127.0.0.1")        
        return settings
    

Am I missing something in configuration?

Answered by DTS Engineer in 797830022

NEAppProxyProvider can be used in two contexts:

  • In an app proxy provider

  • In a transparent proxy provider, on macOS 10.15, prior to the introduction of NETransparentProxyProvider.

The context is determined by how you save your configuration, using NETunnelProviderManager and NETransparentProxyManager respectively. Which one are you using?

Share and Enjoy

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

NEAppProxyProvider can be used in two contexts:

  • In an app proxy provider

  • In a transparent proxy provider, on macOS 10.15, prior to the introduction of NETransparentProxyProvider.

The context is determined by how you save your configuration, using NETunnelProviderManager and NETransparentProxyManager respectively. Which one are you using?

Share and Enjoy

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

handleNewFlow of NEAppProxyProvider subclass isn't called
 
 
Q