updated docs
This commit is contained in:
@@ -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
|
||||
// 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")`
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -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
|
||||
// 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")`
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user