1 - first here is used NENetworkRule and NEFilterSettings but both of them are available for mac apps, and I couldn't find any alternative for iOS
Code Block let filterRules = ["0.0.0.0", "::"].map { address -> NEFilterRule in let localNetwork = NWHostEndpoint(hostname: address, port: FilterDataProvider.localPort) let inboundNetworkRule = NENetworkRule(remoteNetwork: nil, remotePrefix: 0, localNetwork: localNetwork, localPrefix: 0, protocol: .TCP, direction: .inbound) return NEFilterRule(networkRule: inboundNetworkRule, action: .filterData) } // Allow all flows that do not match the filter rules. let filterSettings = NEFilterSettings(rules: filterRules, defaultAction: .allow) apply(filterSettings) { error in if let applyError = error { os_log("Failed to apply filter settings: %@", applyError.localizedDescription) } completionHandler(error) }
2 - I wanted to configure with NEFilterProviderConfiguration and I realized if I want to config a device as a client base, I must configure with vendorConfiguration ( is it correct??) , but the problem is there isn't any document for it, I just realized I must pass a [String : Any]? dictionary to it, and the value must be NSSecureCoding and I don't know how to make that dictionary?, I guess the key is the host name but I don't know how to fill the value!.
3 - and the third problem is I wanted to configure NEFilterManager with the datafilterprovider's bundle, but it doesn't have any property to set. how can I connect the project to filterprovider target in iOS