updated docs

This commit is contained in:
Joseph Henry
2016-07-18 18:13:53 -07:00
parent 6f8d3d0af5
commit c82ec9155b
5 changed files with 48 additions and 18 deletions

View File

@@ -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() { new Thread(new Runnable() {
public void run() { public void run() {
ZeroTierSDK wrapper = new ZeroTierSDK(); // Calls to JNI code
wrapper.startOneService(); // Calls to JNI code zt.startOneService(homeDir);
} }
}).start(); }).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** **Step 4: App permissions**
@@ -58,7 +75,7 @@ new Thread(new Runnable() {
**Step 6: Join a network!** **Step 6: Join a network!**
- Simply call `wrapper.joinNetwork("XXXXXXXXXXXXXXXX")` - Simply call `zt.joinNetwork("XXXXXXXXXXXXXXXX")`

View File

@@ -50,7 +50,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
This integration allows for the following shim combinations: This integration allows for the following shim combinations:
- `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).
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`. 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`.

View File

@@ -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() { new Thread(new Runnable() {
public void run() { public void run() {
ZeroTierSDK wrapper = new ZeroTierSDK(); // Calls to JNI code
wrapper.startOneService(); // Calls to JNI code zt.startOneService(homeDir);
} }
}).start(); }).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** **Step 4: App permissions**
@@ -58,7 +75,7 @@ new Thread(new Runnable() {
**Step 6: Join a network!** **Step 6: Join a network!**
- Simply call `wrapper.joinNetwork("XXXXXXXXXXXXXXXX")` - Simply call `zt.joinNetwork("XXXXXXXXXXXXXXXX")`

View File

@@ -29,15 +29,11 @@ public class MainActivity extends AppCompatActivity {
} }
}).start(); }).start();
Log.d("SDK", "Starting service...\n");
while(!zt.isRunning()) { } while(!zt.isRunning()) { }
Log.d("SDK","Joining network...\n");
zt.joinNetwork("XXXXXXXXXXXXXXXX"); zt.joinNetwork("XXXXXXXXXXXXXXXX");
// Create ZeroTier socket // Create ZeroTier socket
Log.d("","ztjniSocket()\n");
int sock = zt.ztjniSocket(zt.AF_INET, zt.SOCK_STREAM, 0); int sock = zt.ztjniSocket(zt.AF_INET, zt.SOCK_STREAM, 0);
Log.d("", "ztjniSocket() = " + sock + "\n");
try { try {
Thread.sleep(10000); Thread.sleep(10000);

View File

@@ -50,7 +50,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
This integration allows for the following shim combinations: This integration allows for the following shim combinations:
- `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).
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`. 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`.