Clarify App Groups usage in Demo

This commit is contained in:
Davide De Rosa 2019-04-13 11:04:46 +02:00
parent 07b69f2a34
commit 4f8a669967
3 changed files with 13 additions and 6 deletions

View File

@ -78,7 +78,7 @@ YDQ8z9v+DMO6iwyIDRiU
extension ViewController {
private static let appGroup = "group.com.algoritmico.ios.demo.BasicTunnel"
private static let bundleIdentifier = "com.algoritmico.ios.demo.BasicTunnel.BasicTunnelExtension"
private static let tunnelIdentifier = "com.algoritmico.ios.demo.BasicTunnel.BasicTunnelExtension"
private func makeProtocol() -> NETunnelProviderProtocol {
let server = textServer.text!
@ -105,7 +105,7 @@ extension ViewController {
let configuration = builder.build()
return try! configuration.generatedTunnelProtocol(
withBundleIdentifier: ViewController.bundleIdentifier,
withBundleIdentifier: ViewController.tunnelIdentifier,
appGroup: ViewController.appGroup,
credentials: credentials
)
@ -263,7 +263,7 @@ class ViewController: UIViewController, URLSessionDataDelegate {
for m in managers! {
if let p = m.protocolConfiguration as? NETunnelProviderProtocol {
if (p.providerBundleIdentifier == ViewController.bundleIdentifier) {
if (p.providerBundleIdentifier == ViewController.tunnelIdentifier) {
manager = m
break
}

View File

@ -78,7 +78,7 @@ YDQ8z9v+DMO6iwyIDRiU
extension ViewController {
private static let appGroup = "DTDYD63ZX9.group.com.algoritmico.macos.demo.BasicTunnel"
private static let bundleIdentifier = "com.algoritmico.macos.demo.BasicTunnel.BasicTunnelExtension"
private static let tunnelIdentifier = "com.algoritmico.macos.demo.BasicTunnel.BasicTunnelExtension"
private func makeProtocol() -> NETunnelProviderProtocol {
let server = textServer.stringValue
@ -106,7 +106,7 @@ extension ViewController {
let configuration = builder.build()
return try! configuration.generatedTunnelProtocol(
withBundleIdentifier: ViewController.bundleIdentifier,
withBundleIdentifier: ViewController.tunnelIdentifier,
appGroup: ViewController.appGroup,
credentials: credentials
)
@ -239,7 +239,7 @@ class ViewController: NSViewController {
for m in managers! {
if let p = m.protocolConfiguration as? NETunnelProviderProtocol {
if (p.providerBundleIdentifier == ViewController.bundleIdentifier) {
if (p.providerBundleIdentifier == ViewController.tunnelIdentifier) {
manager = m
break
}

View File

@ -119,6 +119,13 @@ Example:
-----END CERTIFICATE-----
""")
Make sure to also update the following constants in the same files, according to your developer account and your target bundle identifiers:
public static let appGroup
public static let tunnelIdentifier
Remember that the App Group on macOS requires a team ID prefix.
## Documentation
The library is split into two modules, in order to decouple the low-level protocol implementation from the platform-specific bridging, namely the [NetworkExtension][ne-home] VPN framework.