Browse Source

updated docs

pull/1/head
Joseph Henry 10 years ago
parent
commit
c82ec9155b
  1. 29
      docs/android_zt_sdk.md
  2. 2
      docs/ios_zt_sdk.md
  3. 29
      integrations/android/README.md
  4. 4
      integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java
  5. 2
      integrations/apple/example_app/iOS/README.md

29
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")`

2
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`.

29
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")`

4
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);

2
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`.

Loading…
Cancel
Save