Found the fix for this. The sample testbed project for TransparentProxyProvider has synchronisation issue and is causing 'fatalError()' in 'extension Network.NWEndpoint', which causes crash of network extension.
Fix for this synchronisation is to pass 'SupportFlow' as async argument:
if (supportedFlow != nil) {
self.queue.async { **[supportedFlow] in**
if (shouldBlock == true) {
// TODO with proper handling of flow
os_log(.debug, log: self.log, "TransparentProxy Provider want to block this TCP flow, flow: 0x%zx", flow.osLogID)
let error = NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey : "Connection Refused"])
flow.closeReadWithError(error)
flow.closeWriteWithError(error)
} else {
self.core.handleNewSupportedFlow(supportedFlow!, proxyServer!, proxyPort!)
}
}
os_log(.debug, log: self.log, "Provider did handle new flow, flow: 0x%zx", flow.osLogID)
return true
}
Topic:
Programming Languages
SubTopic:
Swift
Tags: