removed references to shim
This commit is contained in:
@@ -5,10 +5,11 @@ Welcome!
|
|||||||
|
|
||||||
Imagine a flat, encrypted, no-configuration LAN for all of the instances of your Android app. This short tutorial will show you how to enable ZeroTier functionality for your Android app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works. In this example we aim to set up a minimal [Android Studio](https://developer.android.com/studio/index.html) project which contains all of the components necessary to enable ZeroTier for your app.
|
Imagine a flat, encrypted, no-configuration LAN for all of the instances of your Android app. This short tutorial will show you how to enable ZeroTier functionality for your Android app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works. In this example we aim to set up a minimal [Android Studio](https://developer.android.com/studio/index.html) project which contains all of the components necessary to enable ZeroTier for your app.
|
||||||
|
|
||||||
If you want to skip these steps and just take a look at the project, go [here](example_app).
|
|
||||||
|
|
||||||
*NOTE: For Android JNI libraries to build you'll need to install [Android Studio](https://developer.android.com/studio/index.html) the [Android NDK](https://developer.android.com/ndk/index.html). Currently only Android NDK r10e is supported and can be found [here for OSX](http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip) and [here for Linux](http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip). You'll need to tell our project where you put it by putting the path in [this file](android/proj/local.properties), you'll need to install the Android Build-Tools (this can typically be done through the editor the first time you start it up), and finally you should probably upgrade your Gradle plugin if it asks you to. If you don't have these things installed and configured we will detect that and just skip those builds automatically.*
|
*NOTE: For Android JNI libraries to build you'll need to install [Android Studio](https://developer.android.com/studio/index.html) the [Android NDK](https://developer.android.com/ndk/index.html). Currently only Android NDK r10e is supported and can be found [here for OSX](http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip) and [here for Linux](http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip). You'll need to tell our project where you put it by putting the path in [this file](android/proj/local.properties), you'll need to install the Android Build-Tools (this can typically be done through the editor the first time you start it up), and finally you should probably upgrade your Gradle plugin if it asks you to. If you don't have these things installed and configured we will detect that and just skip those builds automatically.*
|
||||||
|
|
||||||
|
If you want to skip these steps and just take a look at the project, go [here](example_app).
|
||||||
|
|
||||||
|
***
|
||||||
**Step 1: Select build targets**
|
**Step 1: Select build targets**
|
||||||
- Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`.
|
- Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`.
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
|||||||
|
|
||||||
**Step 4: Pick an API**
|
**Step 4: Pick an API**
|
||||||
|
|
||||||
This integration allows for the following shim combinations:
|
The following APIs are available for this integration:
|
||||||
- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would.
|
- `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.
|
- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy. Use stream.
|
||||||
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
||||||
|
|||||||
@@ -10,6 +10,4 @@ The virtual TCP/IP stack will respond to *incoming* ICMP ECHO requests, which me
|
|||||||
|
|
||||||
#### Controlling traffic
|
#### Controlling traffic
|
||||||
|
|
||||||
**Network Containers are currently all or nothing.** If engaged, the intercept library intercepts all network I/O calls and redirects them through the new path. A network-containerized application cannot communicate over the regular network connection of its host or container or with anything else except other hosts on its ZeroTier virtual LAN. Support for optional "fall-through" to the host IP stack for outgoing connections outside the virtual network and for gateway routes within the virtual network is planned. (It will be optional since in some cases total network isolation might be considered a nice security feature.)
|
**Network Containers are currently all or nothing.** If engaged, the intercept library intercepts all network I/O calls and redirects them through the new path. A network-containerized application cannot communicate over the regular network connection of its host or container or with anything else except other hosts on its ZeroTier virtual LAN. Support for optional "fall-through" to the host IP stack for outgoing connections outside the virtual network and for gateway routes within the virtual network is planned. (It will be optional since in some cases total network isolation might be considered a nice security feature.)
|
||||||
|
|
||||||
The exception to this rule is if you use a network library in your application that supports the use of a SOCKS5 proxy and if you configure your network library to use the proxy service provided by the ZeroTier service you can disable all other shims and only talk to ZeroTier virtual networks via the proxied connections you specifically set up.
|
|
||||||
@@ -65,7 +65,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
|||||||
|
|
||||||
**Step 4: Pick an API**
|
**Step 4: Pick an API**
|
||||||
|
|
||||||
This integration allows for the following shim combinations:
|
The following APIs are available for this integration:
|
||||||
- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would.
|
- `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.
|
- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy. Use stream.
|
||||||
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
True P2P injected right into your app with little to no code changes! A ZeroTier-enabled app.
|
True P2P injected right into your app with little to no code changes! A ZeroTier-enabled app.
|
||||||
(formerly known as Network Containers)
|
(formerly known as Network Containers)
|
||||||
|
|
||||||
The SDK couples the ZeroTier core Ethernet virtualization engine with a user-space TCP/IP stack and a carefully-crafted "shim" which intercepts and re-directs network API calls to our service. This allows servers and applications to be used without modification or recompilation. It can be used to run services on virtual networks without elevated privileges, special configuration of the physical host, kernel support, or any other application specific configuration. It's ideal for [containerized applications](../integrations/docker), [games](../integrations/Unity3D), and [desktop/mobile apps](../integrations).
|
The SDK couples the ZeroTier core Ethernet virtualization engine with a user-space TCP/IP stack and a carefully-crafted API which intercepts and re-directs network API calls to our service. This allows servers and applications to be used without modification or recompilation. It can be used to run services on virtual networks without elevated privileges, special configuration of the physical host, kernel support, or any other application specific configuration. It's ideal for [containerized applications](../integrations/docker), [games](../integrations/Unity3D), and [desktop/mobile apps](../integrations).
|
||||||
|
|
||||||
Your only responsibility is to pick a shim appropriate for your app's design. Accessing resources (potentially other instances of your app) on the virtual network will work exactly as it would on a real LAN. The service supports both TCP and UDP. The ZeroTier SDK now works on both *x64* and *ARM* architectures. We've tested a beta version for *iOS*, *Android*, *Linux*, and *Mac OS*
|
Your only responsibility is to pick an API appropriate for your app's design. Accessing resources (potentially other instances of your app) on the virtual network will work exactly as it would on a real LAN. The service supports both TCP and UDP. The ZeroTier SDK now works on both *x64* and *ARM* architectures. We've tested a beta version for *iOS*, *Android*, *Linux*, and *Mac OS*
|
||||||
|
|
||||||
The general idea is this:
|
The general idea is this:
|
||||||
1) Your application starts.
|
1) Your application starts.
|
||||||
2) The shim and ZeroTier service initializes inside a separate thread of your app.
|
2) The API and ZeroTier service initializes inside a separate thread of your app.
|
||||||
3) Your app can now reach anything on your virtual network via normal network calls.
|
3) Your app can now reach anything on your virtual network via normal network calls.
|
||||||
|
|
||||||
It's as simple as that!
|
It's as simple as that!
|
||||||
@@ -31,10 +31,10 @@ Suppose you write an application that uses sockets to make a connection to some
|
|||||||
|
|
||||||
As you can see, your app's logic somehow interacts with a networking layer, the calls then would go to the system and eventually interact with the kernel's network stack.
|
As you can see, your app's logic somehow interacts with a networking layer, the calls then would go to the system and eventually interact with the kernel's network stack.
|
||||||
|
|
||||||
Now suppose you've added a ZeroTier shim to your app, since our shim will intercept the network calls we can actually define new behaviour for them. Here's an example of how network flow would be handled for a ZeroTier-enabled app:
|
Now suppose you've linked ZeroTier into your app, since our API will intercept the network calls we can actually define new behaviour for them. Here's an example of how network flow would be handled for a ZeroTier-enabled app:
|
||||||

|

|
||||||
|
|
||||||
For instance, after you've added one of our shims to your app, when your applcation attempts to establish a connection over a socket the following happens:
|
When your applcation attempts to establish a connection over a socket the following happens:
|
||||||
|
|
||||||
- application calls `socket()`
|
- application calls `socket()`
|
||||||
- our library's `zt_socket()` is executed instead
|
- our library's `zt_socket()` is executed instead
|
||||||
@@ -52,12 +52,12 @@ From your application's perspective nothing out of the ordinary has happened. It
|
|||||||
- 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`.
|
- 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/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(),
|
||||||
zt_getsockname()`. Each shim 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.
|
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
|
## Embedded Applications / IoT
|
||||||

|

|
||||||
|
|
||||||
We foresee the largest application of the ZeroTier SDK to be embedded devices that require lightweight, efficient and reliable networking layers that are also secure and effortless to provision. We've specifically engineered the core service and the shims to be as lightweight and portable as possible. We'd like to see people retake control of their data and security by skipping the the "cloud" without adding complexity.
|
We foresee the largest application of the ZeroTier SDK to be embedded devices that require lightweight, efficient and reliable networking layers that are also secure and effortless to provision. We've specifically engineered the core service and the API library to be as lightweight and portable as possible. We'd like to see people retake control of their data and security by skipping the the "cloud" without adding complexity.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ Welcome!
|
|||||||
|
|
||||||
Imagine a flat, encrypted, no-configuration LAN for all of the instances of your Android app. This short tutorial will show you how to enable ZeroTier functionality for your Android app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works. In this example we aim to set up a minimal [Android Studio](https://developer.android.com/studio/index.html) project which contains all of the components necessary to enable ZeroTier for your app.
|
Imagine a flat, encrypted, no-configuration LAN for all of the instances of your Android app. This short tutorial will show you how to enable ZeroTier functionality for your Android app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works. In this example we aim to set up a minimal [Android Studio](https://developer.android.com/studio/index.html) project which contains all of the components necessary to enable ZeroTier for your app.
|
||||||
|
|
||||||
If you want to skip these steps and just take a look at the project, go [here](example_app).
|
|
||||||
|
|
||||||
*NOTE: For Android JNI libraries to build you'll need to install [Android Studio](https://developer.android.com/studio/index.html) the [Android NDK](https://developer.android.com/ndk/index.html). Currently only Android NDK r10e is supported and can be found [here for OSX](http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip) and [here for Linux](http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip). You'll need to tell our project where you put it by putting the path in [this file](android/proj/local.properties), you'll need to install the Android Build-Tools (this can typically be done through the editor the first time you start it up), and finally you should probably upgrade your Gradle plugin if it asks you to. If you don't have these things installed and configured we will detect that and just skip those builds automatically.*
|
*NOTE: For Android JNI libraries to build you'll need to install [Android Studio](https://developer.android.com/studio/index.html) the [Android NDK](https://developer.android.com/ndk/index.html). Currently only Android NDK r10e is supported and can be found [here for OSX](http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip) and [here for Linux](http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip). You'll need to tell our project where you put it by putting the path in [this file](android/proj/local.properties), you'll need to install the Android Build-Tools (this can typically be done through the editor the first time you start it up), and finally you should probably upgrade your Gradle plugin if it asks you to. If you don't have these things installed and configured we will detect that and just skip those builds automatically.*
|
||||||
|
|
||||||
|
If you want to skip these steps and just take a look at the project, go [here](example_app).
|
||||||
|
|
||||||
|
***
|
||||||
**Step 1: Select build targets**
|
**Step 1: Select build targets**
|
||||||
- Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`.
|
- Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`.
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
|||||||
|
|
||||||
**Step 4: Pick an API**
|
**Step 4: Pick an API**
|
||||||
|
|
||||||
This integration allows for the following shim combinations:
|
The following APIs are available for this integration:
|
||||||
- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would.
|
- `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.
|
- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy. Use stream.
|
||||||
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
|||||||
|
|
||||||
**Step 4: Pick an API**
|
**Step 4: Pick an API**
|
||||||
|
|
||||||
This integration allows for the following shim combinations:
|
The following APIs are available for this integration:
|
||||||
- `Hook of BSD-like sockets`: Use BSD-like sockets as you normally would.
|
- `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.
|
- `Proxy of NSStream`: Create NSStream. Configure stream for SOCKS5 Proxy. Use stream.
|
||||||
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
- `Direct Call`: Consult [src/SDK_Apple-Bridging-Header.h](../../../../src/SDK_Apple-Bridging-Header.h).
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ char *api_netpath;
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// ------------------------------- Intercept Setup ------------------------------
|
// ------------------------------- Intercept Setup ------------------------------
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Return whether 'intercept' shim is enabled for this thread
|
// Return whether 'intercept' API is enabled for this thread
|
||||||
|
|
||||||
bool check_intercept_enabled() {
|
bool check_intercept_enabled() {
|
||||||
dwr(MSG_DEBUG_EXTRA, "check_intercept_enabled()\n");
|
dwr(MSG_DEBUG_EXTRA, "check_intercept_enabled()\n");
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void zt_init_rpc(const char * path, const char * nwid);
|
|||||||
if(!ZeroTier::OSUtils::writeFile(confFile.c_str(), "")) {
|
if(!ZeroTier::OSUtils::writeFile(confFile.c_str(), "")) {
|
||||||
LOGV("unable to write network conf file: %s\n", confFile.c_str());
|
LOGV("unable to write network conf file: %s\n", confFile.c_str());
|
||||||
}
|
}
|
||||||
// This provides the shim API with the RPC information
|
// This provides the API with the RPC information
|
||||||
zt_init_rpc(homeDir.c_str(), nwid);
|
zt_init_rpc(homeDir.c_str(), nwid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user