Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit 1cf2ddf

Browse files
committed
update get_started documentation
1 parent 5d06765 commit 1cf2ddf

1 file changed

Lines changed: 69 additions & 13 deletions

File tree

docs/get_started.md

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,97 @@
11
Get Started
22
===
33

4-
## Implementation (topl-service)
5-
- In your App Module's `build.gradle` file, add the following to the `dependencies` block"
4+
## Implementation - Step 1: Assets/Binaries
5+
- **GeoIP files**:
6+
- Your application will need geoip and geoip6 files. Due to
7+
<a href="https://lists.torproject.org/pipermail/tor-dev/2020-January/014117.html" target="_blank">this issue</a>
8+
they currently cannot be provided via a dependency that can be easily updated.
9+
Until then, you'll have to provide them.
10+
- Steps:
11+
- Download `geoip` and `geoip6` files from https://github.com/torproject/tor/tree/master/src/config
12+
- If you prefer the non-mirror repository, you can also obtain them from
13+
https://gitweb.torproject.org/tor.git/tree/src/config
14+
- In your Application module's `src/main` directory, create a new `Directory` named `assets`
15+
- Copy `geoip` and `geoip6` files into the `assets` directory (or a subdirectory within
16+
`assets`, such as `assets/common/`. File extensions not necessary).
17+
- **torrc file**:
18+
- Not needed
19+
- Your application's `torrc` file gets created for you based on what you have stored in
20+
[TorServicePrefs](./topl-service/io.matthewnelson.topl_service.prefs/-tor-service-prefs/index.md).
21+
If nothing is in `TorServicePrefs` for that particular setting, then it will fall back on
22+
your static/default [TorSettings](./topl-core-base/io.matthewnelson.topl_core_base/-tor-settings/index.md)
23+
that you supply upon initialization of `TorServiceController.Builder`.
24+
- **Tor Binaries**:
25+
- I use The GuardianProject's <a href="https://github.com/guardianproject/tor-android" target="_blank">tor-android</a>
26+
project to build binaries, and provided them
27+
<a href="https://github.com/05nelsonm/TOPL-Android-TorBinary" target="_blank">here</a>. The
28+
difference is in how they are packaged as a dependency, and the contents of what you are
29+
importing as a dependency. I package them in the `jniLibs` directory so that the Android OS
30+
will automatically install them into your application's `/data/app/...` directory, and include
31+
no unnecessary classes or resources; just the binaries. Android API 29+ no longer supports
32+
execution of executable files from your application's `/data/data/` directory, and must now be
33+
installed in the `context.applicationInfo.nativeLibraryDir` directory (aka, `/data/app/...`)
34+
to execute.
35+
- Nothing more is needed in terms of configuring initialization via the
36+
`TorServiceController.Builder`, as files will be installed in the correct directory, and
37+
named to match what `topl-service` looks for.
38+
- If you wish to use GuardianProject's binaries, see
39+
<a href="https://github.com/guardianproject/tor-android" target="_blank">tor-android</a>.
40+
- You'll need to use their `NativeResouceInstaller` to install the binaries.
41+
- You'll need to also implement `TorServiceController.Builder.useCustomTorConfigFiles`
42+
method when initializing `topl-service` and provide it with your own
43+
[TorConfigFiles](./topl-core-base/io.matthewnelson.topl_core_base/-tor-config-files/index.md).
44+
- See the sample provided in the
45+
[TorConfigFiles.Builder](./topl-core-base/io.matthewnelson.topl_core_base/-tor-config-files/-builder/index.md)
46+
documentation.
47+
- **Transport Plugin Binaries**:
48+
- Currently unsupported. Working on it!!!
49+
50+
51+
!!! Info
52+
Tor Binaries are ~8MB for each ABI (will be less after compression), so it's advised that builds
53+
are split to keep apk sizes down. For example, the `sampleapp`'s universalApk size (all ABIs)
54+
is ~16MB, where splits are ~7MB. See the `sampleapp`'s `build.gradle` file for more details.
55+
<a href="https://github.com/05nelsonm/TorOnionProxyLibrary-Android/blob/master/sampleapp/build.gradle" target="_blank">here</a>
56+
57+
## Implementation - Step 2: topl-service
58+
- In your Application module's `build.gradle` file, add the following to the `dependencies` block:
659
```groovy
760
def topl_android_version = "{{ topl_android.release }}"
8-
implementation 'io.matthewnelson.topl-android:topl-core-base:$topl_android_version'
9-
implementation 'io.matthewnelson.topl-android:topl-service:$topl_android_version'
61+
implementation "io.matthewnelson.topl-android:topl-core-base:$topl_android_version"
62+
implementation "io.matthewnelson.topl-android:topl-service:$topl_android_version"
1063
```
11-
12-
- TODO: geoip files and binaries
1364
1465
- Create a new class which extends [TorSettings](./topl-core-base/io.matthewnelson.topl_core_base/-tor-settings/index.md)
1566
and apply your own default settings.
67+
- See the SampleApp's
68+
<a href="https://github.com/05nelsonm/TorOnionProxyLibrary-Android/blob/master/sampleapp/src/main/java/io/matthewnelson/sampleapp/MyTorSettings.kt">MyTorSettings</a>
69+
class for help.
70+
- Also checkout the documentation in the `TorSettings` class for more of a breakdown and help.
1671
1772
- In your Application class' `onCreate` implement, and customize as desired, the
1873
[TorServiceController.Builder](./topl-service/io.matthewnelson.topl_service/-tor-service-controller/-builder/index.md)
1974
2075
- Call APIs provided from
2176
[TorServiceController.Companion](./topl-service/io.matthewnelson.topl_service/-tor-service-controller/index.md)
2277
23-
## Using the SNAPSHOT version
78+
### Using the SNAPSHOT version of topl-service
2479
25-
- In your Project's `build.gradle` file, add the following to the `repositories` block:
80+
- In your Application module's `build.gradle` file, add the following (*outside* the `android` block):
2681
```groovy
27-
mavenCentral()
28-
maven {
29-
url 'https://oss.sonatype.org/content/repositories/snapshots/'
82+
repositories {
83+
maven {
84+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
85+
}
3086
}
3187
```
3288
33-
- In your App module's `build.gradle` file, add (or modify) the following in the `dependencies` block:
89+
- In your Application module's `build.gradle` file, add (or modify) the following in the `dependencies` block:
3490
```groovy
3591
def topl_android_version = "{{ topl_android.next_release }}-SNAPSHOT"
3692
implementation 'io.matthewnelson.topl-android:topl-core-base:$topl_android_version'
3793
implementation 'io.matthewnelson.topl-android:topl-service:$topl_android_version'
3894
```
3995
40-
!!! Warning
96+
!!! Warning
4197
SNAPSHOT versions are ever changing and may contain not yet fully fleshed out features. Do **not** ship a release.

0 commit comments

Comments
 (0)