unit test fixes, warning fixes, slight documentation updates

This commit is contained in:
Joseph Henry
2016-11-15 16:18:26 -08:00
parent 295445afe0
commit 634d11d532
24 changed files with 360 additions and 160 deletions

View File

@@ -12,7 +12,7 @@ If you want to skip the following steps and just take a look at the project, go
***
**Step 1: App Code Modifications**
- In your project, create a new package called `ZeroTier` and class file within called `ZTSDK.java` and copy contents from `src/SDK_JavaWrapper.java`
- In your project, create a new package called `ZeroTier` and class file within called `ZTSDK.java` and copy contents from `src/wrappers/java/JavaWrapper.java`
- Start the service

View File

@@ -19,6 +19,6 @@ ZTSDK API Options
The following APIs are available for this integration:
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
- `Direct Call`: Consult [src/wrappers/swift/Apple-Bridging-Header.h](../../../../src/wrappers/swift/Apple-Bridging-Header.h).
- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would.
- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy (127.0.0.1:PORT). Start Proxy. Use stream. An example of how to use the proxy can be found in the example iOS/OSX projects.

View File

@@ -12,20 +12,20 @@ Below are the specific instructions for each integration requiring *little to no
For more support on these integrations, or if you'd like help creating a new integration, stop by our [community section](https://www.zerotier.com/community/)!
***
## Important Build flags
## Important Build Flags
- `SDK_IPV4=1` - Enable IPv4 support in whatever stack you have selected
- `SDK_IPV6=1` - Enable IPv6 support in whatever stack you have selected
- `SDK_IPV4=1` - Enable IPv4 support
- `SDK_IPV6=1` - Enable IPv6 support
- `SDK_LWIP=1` - Enable the use of `lwIP`
- `SDK_PICOTCP=1` - Enable the use of `picoTCP`
- `SDK_DEBUG=1` - Enables SDK debugging
- `SDK_DEBUG=1` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h`
- `SDK_LWIP_DEBUG=1` - Turns on debug output for the `lwIP` library.
- `SDK_BUNDLED=1` - Builds the SDK as a single bundled target including a the RPC mechanism, the `lwIP` library, and the ZeroTier service.
- `SDK_PICOTCP=1` - Enable the use of `picoTCP` (recommended)
- `SDK_PICO_DEBUG=1` - Enables debug output for the `picoTCP` network stack
- `SDK_LWIP=1` - Enable the use of `lwIP` (deprecated)
- `SDK_LWIP_DEBUG=1` - Enables debug output for the `lwIP` library.
***
## Current Integrations
### Apple
- For everything: `make apple`
@@ -40,11 +40,13 @@ For more support on these integrations, or if you'd like help creating a new int
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_service_and_intercept` -> { `build/zerotier-sdk-service` + `build/libztintercept.so` }
- [Intercept library](../docs/osx_zt_sdk.md) `make osx_sdk_service` -> `build/zerotier-sdk-service`
- [SDK Service](../docs/osx_zt_sdk.md) `make osx_intercept` -> `build/libztintercept.so`
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle` ->
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle`
***
### Linux
- For everything: `make linux`
- [Dynamic-linking into an app/service at runtime](../docs/linux_zt_sdk.md) `make linux_shared_lib`
- Service and Intercept `make linux_service_and_intercept` -> { `build/zerotier-sdk-service` + `build/libztintercept.so` }
- [Using the SDK with Docker](docker)
### Android

View File

@@ -19,8 +19,8 @@ This short tutorial will show you how to enable ZeroTier functionality for your
- Add `src` directory to *Build Settings -> Header Search Paths*
- Add `build/ios_app_framework/Release-iphoneos/` to *Build Settings -> Framework Search Paths*
- Add `ZeroTierSDK.frameworkiOS` to *General->Embedded Binaries*
- Add `src/ZTSDK.swift`, `src/SDK_XcodeWrapper.cpp` and `src/SDK_XcodeWrapper.hpp` to your project:
- Set `src/SDK_Apple-Bridging-Header.h` as your bridging-header in *Build Settings -> Objective-C Bridging-header*
- Add `src/wrappers/swift/ZTSDK.swift`, `src/wrappers/swift/XcodeWrapper.cpp` and `src/wrappers/swift/XcodeWrapper.hpp` to your project:
- Set `src/wrappers/swift/Apple-Bridging-Header.h` as your bridging-header in *Build Settings -> Objective-C Bridging-header*
**Step 3: Start the ZeroTier service**

View File

@@ -36,6 +36,11 @@ Run application
./app
## Via `DYLD_LIBRARY_PATH` (Injecting code dynamically at runtime)
As of the release of El Capitan, Apple requires one to turn off System Integrity Protection for code injection from external libraries. This method of intercepting network calls is now deprecated and we are investigating new methods for future releases of the SDK. If you still wish to use this method just `export DYLD_LIBRARY_PATH=./path/to/libztintercept.so:$DYLD_LIBRARY_PATH`. Also set `ZT_NC_NETWORK` appropriately.
## Via App Framework in XCode
***
@@ -50,8 +55,8 @@ Run application
- Add `src` directory to *Build Settings -> Header Search Paths*
- Add `build/osx_app_framework/Release/` to *Build Settings -> Framework Search Paths*
- Add `ZeroTierSDK.frameworkOSX` to *General->Embedded Binaries*
- Add `src/ZTSDK.swift`, `src/SDK_XcodeWrapper.cpp`, and `src/SDK_XcodeWrapper.hpp` to your project:
- Set `src/SDK_Apple-Bridging-Header.h` as your bridging-header in *Build Settings -> Objective-C Bridging-header*
- Add `src/wrappers/swift/ZTSDK.swift`, `src/wrappers/swift/XcodeWrapper.cpp`, and `src/wrappers/swift/XcodeWrapper.hpp` to your project:
- Set `src/wrappers/swift/Apple-Bridging-Header.h` as your bridging-header in *Build Settings -> Objective-C Bridging-header*
**Step 3: Start the ZeroTier service**

View File

@@ -30,5 +30,55 @@ We've designed a background tap service that pairs the ZeroTier protocol with sw
**Direct Call**
- Directly call the `zt_` API specified in [SDK.h](src/SDK.h). For this to work, just use one of the provided headers that specify the interface for your system/architecture and then either dynamically-load our library into your app or compile it right in.
***
## Important Build Flags
- `SDK_IPV4=1` - Enable IPv4 support
- `SDK_IPV6=1` - Enable IPv6 support
- `SDK_DEBUG=1` - Enables SDK debugging
- `SDK_PICOTCP=1` - Enable the use of `picoTCP` (recommended)
- `SDK_PICO_DEBUG=1` - Enables debug output for the `picoTCP` network stack
- `SDK_LWIP=1` - Enable the use of `lwIP` (deprecated)
- `SDK_LWIP_DEBUG=1` - Enables debug output for the `lwIP` library.
***
### Apple
- For everything: `make apple`
##### iOS
- [Embedding within an app](apple/example_app/iOS) `make ios_app_framework` -> `build/ios_app_framework/*`
- Unity3D plugin `make ios_unity3d_bundle` -> `build/ios_unity3d_bundle/*`
##### OSX
- [Linking into an app at compiletime](../docs/osx_zt_sdk.md) `make osx_shared_lib` -> `build/libztosx.so`
- [Embedding within an app with Xcode](apple/example_app/OSX) `make osx_app_framework` -> `build/osx_app_framework/*`
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_service_and_intercept` -> { `build/zerotier-sdk-service` + `build/libztintercept.so` }
- [Intercept library](../docs/osx_zt_sdk.md) `make osx_sdk_service` -> `build/zerotier-sdk-service`
- [SDK Service](../docs/osx_zt_sdk.md) `make osx_intercept` -> `build/libztintercept.so`
- [Unity3D plugin](apple/ZeroTierSDK_Apple) `make osx_unity3d_bundle`
***
### Linux
- For everything: `make linux`
- [Dynamic-linking into an app/service at runtime](../docs/linux_zt_sdk.md) `make linux_shared_lib`
- Service and Intercept `make linux_service_and_intercept` -> { `build/zerotier-sdk-service` + `build/libztintercept.so` }
- [Using the SDK with Docker](docker)
### Android
- For everything: `make android`
- [Embedding within an app](android) `make android_jni_lib` -> `build/android_jni_lib/YOUR_ARCH/libZeroTierOneJNI.so`
- [Unity 3D plugin](../docs/android_unity3d_zt_sdk.md) `make android_unity3d_plugin` -> `build/android_unity3d_plugin/*`
***
### Windows
- Not yet.
***
![Image](docs/img/api_diagram.png)

View File

@@ -51,7 +51,7 @@ From your application's perspective nothing out of the ordinary has happened. It
- **What would happen if you performed a `getsockopt()` for the family/domain of an `AF_INET` socket you requested?**
- You'd expect this should return `AF_LOCAL` since we repurposed the unix-domain socket, right? Nope. We've got a special implementation of `getsockopt()` which will detect whether that socket is handled under the ZeroTier tap service and if it is, it'll lie to you about the socket domain/family and report `AF_INET`.
We've got a [special implementation](../src/SDK_Sockets.c) for most of the socket API functions: `zt_setsockopt(), zt_getsockopt(),zt_socket(),zt_connect(),zt_bind(),zt_accept4(),zt_accept(),zt_listen(),zt_close(),
We've got a [special implementation](../src/sockets.c) for most of the socket API functions: `zt_setsockopt(), zt_getsockopt(),zt_socket(),zt_connect(),zt_bind(),zt_accept4(),zt_accept(),zt_listen(),zt_close(),
zt_getsockname()`. Each type of API is implemented in terms of this set of core functions and has the ability to determine whether the call should be directed to the system or the ZeroTier tap service.
## Embedded Applications / IoT