I am a novice Swift developer.
Referring to the Apple developer documentation and various blogs, I have written example code for DNS Proxy in Network Extension.
I inherited NEDNSProxyProvider to create a DNSProxyProvider class in the Extension. Using NEDNSProxyManager and NEDNSSettingsManager, I created a simple app that calls saveToPreferences(...) after loadFromPreferences(...).
When saveToPreferences(...) is called, I can confirm that the "DNS Proxy" item is added to the "System Preferences" in the "Enabled" state. However, upon further inspection using console logs, it seems that the init() constructor and startProxy(...) function of DNSProxyProvider are not being called.
Additionally, upon checking the console logs:
NESMDNSProxySession[Primary Tunnel:MyMyService:{GUID}:(null)] in state NESMVPNSessionStateStarting:
plugin NEDNSProxyPlugin(xxxxx.xxxxxx.MyMyService[inactive]) started with PID 0 error Error Domain=NEAgentErrorDomain Code=2 "(null)"
These logs are present. Could they be related to the issue?
I tried to refer to the link below that seems like a similar issue, but I couldn't find a clear solution or hint.
https://forums.developer.apple.com/forums/thread/130063
https://developer.apple.com/forums/thread/680905
https://developer.apple.com/forums/thread/675304
https://developers.apple.com/forums/thread/652708
https://developer.apple.com/forums/thread/678399
I earnestly seek your assistance.
Thank you.
Post
Replies
Boosts
Views
Activity
I encountered a problem while implementing DNS Proxy for Network Extension.
It consists of MyMyExt, a System Extension that implements DNS Proxy, and MyMyService, a container.
The system extension consists of classes that inherit the NEDNSProxyProvider.
Class has overrided "override init(), override func startProxy(...), override func stopProxy(...) override func handleNewFlow(...)"
Since the manager.loadFromPreferences(...) and manager.saveToPreferences(...) calls, system extensions and DNS Proxy have been added.
However, contrary to expectations, init(), startProxy(...), etc. are not being called.
(In System Settings → Network → Filter, DNS Proxy has been added, but is displayed as "Activated" and a yellow circle)
Here is the information that appears on the console.
... Omitted ...
MyMyService.MyMyExt [Info] DNSProxyManager.swift: 51 [-] DNSProxy: saved
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Adding a connection for client mDNSResponder[167]
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: handleNetworkDetectionNotification <MyMyService.MyMyExt>
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Received a restart command from nesessionmanager[1011]
nesessionmanager Registering session NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Resetting VPN On Demand
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)] in state NESMVPNSessionStateIdle: update configuration
nesessionmanager <NESMServer: 0x13ae0ac90>: <MyMyService.MyMyExt> Register DNS Proxy Session: NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Successfully registered
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: status changed to connecting
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)] in state NESMVPNSessionStateIdle: received start message
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Leaving state NESMVPNSessionStateIdle
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Entering state NESMVPNSessionStatePreparingNetwork
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Cannot create agent for plugin type MyMyService.MyMyExt, missing designated requirement
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Failed to create an NEAgent
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Leaving state NESMVPNSessionStatePreparingNetwork
nesessionmanager NESMDNSProxySession[Primary Tunnel:MyMyService.MyMyExt:<GUID>:(null)]: Entering state NESMVPNSessionStateStopping, timeout 20 seconds
... Omitted ...
Perhaps the key is the "Cannot create agent for plugin type MyMyService.MyMyExt, missing designated requirement" recorded in the log.
But I can't find out what this message is about or how to resolve it.
and, here is my code, more info at my previous post.
I ask for your help.
Thank you, for your attention.