diff --git a/docs/osx_zt_sdk.md b/docs/osx_zt_sdk.md index 10970c9..dd02acf 100644 --- a/docs/osx_zt_sdk.md +++ b/docs/osx_zt_sdk.md @@ -46,24 +46,12 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), { }); ``` -**Step 5: Pick a shim for your app** - -This integration allows for the following shim combinations: -- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would. -- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy. Use stream. -- `Changeling of BSD-like sockets`: Call `start_changeling()` and then use BSD-like sockets as you normally would. -- `Direct Call`: Consult [SDK-iOS-Bridging-Header.h](netcon/iOS/Netcon-iOS/Netcon-iOS-Bridging-Header.h). - -If functional interposition isn't available for the API or library you've chosen to use, ZeroTier offers a SOCKS5 proxy server which can allow connectivity to your virtual network as long as your client API supports the SOCKS5 protocol. This proxy service will run alongside the tap service and can be turned on by compiling with the `-DUSE_SOCKS_PROXY` flag in *Build Settings->Other C Flags*. By default, the proxy service is available at `0.0.0.0:1337`. +**Step 5: Pick an [API](# API) to use** **Step 6: Join a network!** - -Simply call `zt_join_network("XXXXXXXXXXXXXXXX")` + - Simply call `zt_join_network("XXXXXXXXXXXXXXXX")` *** - - - ## Linking into an application on Mac OSX Example: @@ -93,12 +81,21 @@ Run application **Step 3: Add its path to your *Build Settings -> Framework Search Paths***: - For example: `$(PROJECT_DIR)/../../../build/OSX_app_framework/Release` -**Step 4: Pick [API](## API)** +**Step 4: Pick an [API](# API) to use** + +**Step 5: Join a network!** + - Simply call `zt_join_network("XXXXXXXXXXXXXXXX")` *** - ## API +This integration allows for the following shim combinations: +- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would. +- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy. Use stream. +- `Changeling of BSD-like sockets`: Call `start_changeling()` and then use BSD-like sockets as you normally would. +- `Direct Call`: Consult [SDK-iOS-Bridging-Header.h](netcon/iOS/Netcon-iOS/Netcon-iOS-Bridging-Header.h). + +If functional interposition isn't available for the API or library you've chosen to use, ZeroTier offers a SOCKS5 proxy server which can allow connectivity to your virtual network as long as your client API supports the SOCKS5 protocol. This proxy service will run alongside the tap service and can be turned on by compiling with the `-DUSE_SOCKS_PROXY` flag in *Build Settings->Other C Flags*. By default, the proxy service is available at `0.0.0.0:1337`. #### NSStream and SOCKS Proxy diff --git a/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.pbxproj b/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.pbxproj index c60eaaa..98a6af0 100644 --- a/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.pbxproj +++ b/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ /* Begin PBXFileReference section */ 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = ../../../build/OSX_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = ""; }; + 7CA571081D1B1DCB00720883 /* ZeroTierSDK_OSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZeroTierSDK_OSX.h; path = ../../ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h; sourceTree = ""; }; 7CFCB42D1D1AFEE800D3E66C /* Example_OSX_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_OSX_App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7CFCB4301D1AFEE800D3E66C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7CFCB4321D1AFEE800D3E66C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -73,6 +74,7 @@ 7CFCB42F1D1AFEE800D3E66C /* Example_OSX_App */ = { isa = PBXGroup; children = ( + 7CA571081D1B1DCB00720883 /* ZeroTierSDK_OSX.h */, 7CFCB4301D1AFEE800D3E66C /* AppDelegate.swift */, 7CFCB4321D1AFEE800D3E66C /* ViewController.swift */, 7CFCB4341D1AFEE800D3E66C /* Assets.xcassets */, diff --git a/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate b/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate index 4e6e6fb..3167082 100644 Binary files a/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate and b/integrations/Apple/Example_OSX_App/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/integrations/Apple/Example_OSX_App/Example_OSX_App/ViewController.swift b/integrations/Apple/Example_OSX_App/Example_OSX_App/ViewController.swift index 9268d00..edb4991 100644 --- a/integrations/Apple/Example_OSX_App/Example_OSX_App/ViewController.swift +++ b/integrations/Apple/Example_OSX_App/Example_OSX_App/ViewController.swift @@ -7,15 +7,32 @@ // import Cocoa +i class ViewController: NSViewController { + + var service_thread : NSThread! + func ztnc_start_service() { + let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true) + print("start_service()\n") + // e5cd7a9e1c3511dd + start_service(path[0]) + } + + override func viewDidLoad() { super.viewDidLoad() + // ZeroTier Service thread + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), { + self.service_thread = NSThread(target:self, selector:"ztnc_start_service", object:nil) + self.service_thread.start() + }); // Do any additional setup after loading the view. } + override var representedObject: AnyObject? { didSet { // Update the view, if already loaded. diff --git a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate index bc557ff..ac30b5d 100644 Binary files a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate and b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h index 8325739..ce3efcf 100644 --- a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h +++ b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h @@ -15,5 +15,5 @@ FOUNDATION_EXPORT double ZeroTierSDK_OSXVersionNumber; FOUNDATION_EXPORT const unsigned char ZeroTierSDK_OSXVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import - +#import diff --git a/integrations/README.md b/integrations/README.md index f4a3a95..e81fde4 100644 --- a/integrations/README.md +++ b/integrations/README.md @@ -16,22 +16,22 @@ For more support on these integrations, or if you'd like help creating a new int ### Apple ##### iOS - - [Embedding within an app](../docs/ios_zt_sdk.md) - - [Unity3D plugin](../docs/unity3d_ios_zt_sdk.md) + - [Embedding within an app](../docs/ios_zt_sdk.md) `make ios_app_framework` + - [Unity3D plugin](../docs/unity3d_ios_zt_sdk.md) `make ios_unity3d_bundle` ##### OSX - - [Embedding within an app](../docs/osx_zt_sdk.md) - - [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) - - [Unity3D plugin](../docs/unity3d_osx_zt_sdk.md) + - [Embedding within an app](../docs/osx_zt_sdk.md) `make osx_app_framework` + - [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make ` + - [Unity3D plugin](../docs/unity3d_osx_zt_sdk.md) `make osx_unity3d_bundle` *** ### Linux - - [Dynamic-linking into an app/service at runtime](../docs/linux_zt_sdk.md) - - [Using the SDK with Docker](../docs/docker_linux_zt_sdk.md) + - [Dynamic-linking into an app/service at runtime](../docs/linux_zt_sdk.md) `make linux_shared_lib` + - [Using the SDK with Docker](../docs/docker_linux_zt_sdk.md) `make linux_shared_lib` ### Android - - [Embedding within an app](../docs/android_zt_sdk.md) - - [Unity 3D plugin](../docs/unity3d_android_zt_sdk.md) + - [Embedding within an app](../docs/android_zt_sdk.md) `make android_jni_lib` + - [Unity 3D plugin](../docs/unity3d_android_zt_sdk.md) `make android_unity3d_plugin` *** ### Windows diff --git a/make-mac.mk b/make-mac.mk index 8d327e0..42b9e54 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -79,21 +79,21 @@ all: # TODO: CHECK if XCODE TOOLS are installed # Build frameworks for application development -OSX_app_framework: +osx_app_framework: cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_OSX build SYMROOT="../../../build/OSX_app_framework" -iOS_app_framework: +ios_app_framework: cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_iOS build SYMROOT="../../../build/iOS_app_framework" # Build bundles for Unity integrations -OSX_unity3d_bundle: +osx_unity3d_bundle: cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_Unity3D_OSX build SYMROOT="../../../build/OSX_unity3d_bundle" -iOS_unity3d_bundle: +ios_unity3d_bundle: cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_Unity3D_iOS build SYMROOT="../../../build/iOS_unity3d_bundle" # TODO: CHECK if ANDROID/GRADLE TOOLS are installed # Build JNI library for Android app integration -Android_JNI_library: +android_jni_library: cd integrations/Android/proj; ./gradlew assembleDebug # Build library for Android Unity integrations