How to use NEDNSProxyprovider?

I want to add network extension for my Mac OS application. When I add it it create entitlement file with default DNSProxyProvider class as I have selected category as DNS proxy. But I don't know how to use it. my requirement is I want to route all the traffic except some local domains that client will provide. local domains should resolve by default DNS which device has, and all the remaining public domains should be resolved by client server. This seems completely new to me in Mac OS development.

What you’re describing, split DNS, is probably possible but be aware that implementing a DNS proxy provider is a non-trivial amount of work. There are two core problems:

  • Packaging

  • Handling flows


On the packaging front, a quick trip to TN3134 Network Extension provider deployment [1] confirms that a DNS proxy provider on the Mac must be packaged as a system extension. In Xcode you can start that off by choosing File > New > Target and then selecting the System Extension > Network Extension template.

IMPORTANT Don’t accidentally select Application > Network Extension. It is not the droid you’re looking for.

Hmmm, you tagged your thread with Swift Playgrounds. Are you trying to do this in Swift Playgrounds? If so, that won’t work. You need Xcode.


Once you have the system extension build and loading, the main challenge is handling your flows. I posted some advice on that front here.

Note that, to do the split DNS thing, you’ll need to get the system DNS settings, available via the systemDNSSettings property.

Share and Enjoy

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

[1] I’m glad that Past Quinn™ wrote this because Current Quinn™ references it all the time (-:

Thanks for valuable response, let me try out above thing then will get back to you.

Thanks for clearing confusion that not to use application > network extension.

How to use NEDNSProxyprovider?
 
 
Q