However in the network panel I see that while the DNS Proxy is enabled it is not running, there is a yellow dot. It is enabled but not running.
Yeah, something seems wrong here.
Regarding:
When I try to attach to the process in Xcode using its bundleID it sticks in waiting for attachment. Is there a trick to debugging this?
On macOS when I run tests with NEDNSProxyProvider
I build from Xcode, and then install the Development signed build in the /Applications
folder. From there I use the $ log stream
command to checkout everything being logged from the container app and the provider. For example I will usually have a setup like the following:
// Container App
class ViewController: NSViewController {
let log = OSLog(subsystem: "com.example.apple-samplecode.DNSTestBed", category: "app")
private func configureProxy() {
os_log(.info, log: self.log, "will load configurations")
manager?.loadFromPreferences { [weak self] error in
precondition(Thread.isMainThread)
os_log(.info, log: self.log, "logs indication the state of loading preferences")
}
}
}
// Provider
class DNSProxyProvider: NEDNSProxyProvider {
static let log = OSLog(subsystem: "com.example.apple-samplecode.DNSTestBed.DNSExtension", category: "provider")
private let log: OSLog
override init() {
self.log = Self.log
os_log(.debug, log: self.log, "init")
super.init()
}
override func handleNewUDPFlow(_ flow: NEAppProxyUDPFlow, initialRemoteEndpoint remoteEndpoint: NWEndpoint) -> Bool {
let initialRemote = remoteEndpoint.debugDescription
let flowEndpoint = flow.localEndpoint.debugDescription
os_log(.debug, log: self.log, "provider handleNewUDPFlow: initialEndpoint %{public}@ - localEndpoint: %{public}@", initialRemote, flowEndpoint)
return true
}
}
Then, in the Terminal I can use the following commands to try and log out logs from both the provider and container app.
# Container
$ log stream --level debug --predicate 'subsystem == "com.example.apple-samplecode.DNSTestBed"'
# Provider
log stream --level debug --predicate 'subsystem == "com.example.apple-samplecode.DNSTestBed.DNSExtension"'
Regarding:
This is, as I said, a Mac OS X app. Our iOS app seems to work with largely the same code.
Since it sounds like you are porting an Network App Extension over from iOS and not creating a Network System Extension on macOS, you may want to take a look at the Console.app too for more logs when you run this.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com