diff --git a/docs/android_zt_sdk.md b/docs/android_zt_sdk.md index de95ebb..cdf0de4 100644 --- a/docs/android_zt_sdk.md +++ b/docs/android_zt_sdk.md @@ -32,15 +32,32 @@ public class ZeroTierSDK { } ``` - - And now, start the service in your app with: + - Start the service ``` +final SDK zt = new SDK(); +final String homeDir = getApplicationContext().getFilesDir() + "/zerotier"; + new Thread(new Runnable() { - public void run() { - ZeroTierSDK wrapper = new ZeroTierSDK(); - wrapper.startOneService(); // Calls to JNI code - } + public void run() { + // Calls to JNI code + zt.startOneService(homeDir); + } }).start(); +``` + + - Perform network call + +``` +while(!zt.isRunning()) { } +zt.joinNetwork("XXXXXXXXXXXXXXXX"); + +// Create ZeroTier socket +int sock = zt.ztjniSocket(zt.AF_INET, zt.SOCK_STREAM, 0); + +// Connect to remote host +Log.d("","ztjniConnect()\n"); +int err = zt.ztjniConnect(sock, "10.9.9.203", 8080); ``` **Step 4: App permissions** @@ -58,7 +75,7 @@ new Thread(new Runnable() { **Step 6: Join a network!** - - Simply call `wrapper.joinNetwork("XXXXXXXXXXXXXXXX")` + - Simply call `zt.joinNetwork("XXXXXXXXXXXXXXXX")` diff --git a/docs/ios_zt_sdk.md b/docs/ios_zt_sdk.md index 03570e0..c0efdcd 100644 --- a/docs/ios_zt_sdk.md +++ b/docs/ios_zt_sdk.md @@ -50,7 +50,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), { 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. -- `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). 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`. diff --git a/integrations/android/README.md b/integrations/android/README.md index de95ebb..cdf0de4 100644 --- a/integrations/android/README.md +++ b/integrations/android/README.md @@ -32,15 +32,32 @@ public class ZeroTierSDK { } ``` - - And now, start the service in your app with: + - Start the service ``` +final SDK zt = new SDK(); +final String homeDir = getApplicationContext().getFilesDir() + "/zerotier"; + new Thread(new Runnable() { - public void run() { - ZeroTierSDK wrapper = new ZeroTierSDK(); - wrapper.startOneService(); // Calls to JNI code - } + public void run() { + // Calls to JNI code + zt.startOneService(homeDir); + } }).start(); +``` + + - Perform network call + +``` +while(!zt.isRunning()) { } +zt.joinNetwork("XXXXXXXXXXXXXXXX"); + +// Create ZeroTier socket +int sock = zt.ztjniSocket(zt.AF_INET, zt.SOCK_STREAM, 0); + +// Connect to remote host +Log.d("","ztjniConnect()\n"); +int err = zt.ztjniConnect(sock, "10.9.9.203", 8080); ``` **Step 4: App permissions** @@ -58,7 +75,7 @@ new Thread(new Runnable() { **Step 6: Join a network!** - - Simply call `wrapper.joinNetwork("XXXXXXXXXXXXXXXX")` + - Simply call `zt.joinNetwork("XXXXXXXXXXXXXXXX")` diff --git a/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java b/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java index e59c8ca..17de8c7 100644 --- a/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java +++ b/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java @@ -29,15 +29,11 @@ public class MainActivity extends AppCompatActivity { } }).start(); - Log.d("SDK", "Starting service...\n"); while(!zt.isRunning()) { } - Log.d("SDK","Joining network...\n"); zt.joinNetwork("XXXXXXXXXXXXXXXX"); // Create ZeroTier socket - Log.d("","ztjniSocket()\n"); int sock = zt.ztjniSocket(zt.AF_INET, zt.SOCK_STREAM, 0); - Log.d("", "ztjniSocket() = " + sock + "\n"); try { Thread.sleep(10000); diff --git a/integrations/apple/example_app/iOS/README.md b/integrations/apple/example_app/iOS/README.md index 03570e0..c0efdcd 100644 --- a/integrations/apple/example_app/iOS/README.md +++ b/integrations/apple/example_app/iOS/README.md @@ -50,7 +50,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), { 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. -- `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). 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`.