mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
- Previous android java and jni code updated to work, but with much love still needed to make it work nicely, e.g. handling when the VPN is turned off. - DNS handling refactored to allow android to intercept and handle DNS requests as we can't set the system DNS to use a high port (and apparently Chrome ignores system DNS settings anyway) - add packet router structure to allow separate handling of specific intercepted traffic, e.g. UDP traffic to port 53 gets handled by our DNS handler rather than being naively forwarded as exit traffic. - For now, android lokinet is exit-only and hard-coded to use exit.loki as its exit. The exit will be configurable before release, but allowing to not use exit-only mode is more of a challenge. - some old gitignore remnants which were matching to things we don't want them to (and are no longer relevant) removed - some minor changes to CI configuration
40 lines
838 B
Java
40 lines
838 B
Java
package network.loki.lokinet;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
public class LokinetConfig
|
|
{
|
|
static {
|
|
System.loadLibrary("lokinet-android");
|
|
}
|
|
|
|
private static native ByteBuffer Obtain(String dataDir);
|
|
private static native void Free(ByteBuffer buf);
|
|
|
|
/*** load config file from disk */
|
|
public native boolean Load();
|
|
/*** save chages to disk */
|
|
public native boolean Save();
|
|
|
|
|
|
/** override default config value before loading from config file */
|
|
public native void AddDefaultValue(String section, String key, String value);
|
|
|
|
private final ByteBuffer impl;
|
|
|
|
public LokinetConfig(String dataDir)
|
|
{
|
|
impl = Obtain(dataDir);
|
|
if(impl == null)
|
|
throw new RuntimeException("cannot obtain config from "+dataDir);
|
|
}
|
|
|
|
public void finalize()
|
|
{
|
|
if (impl != null)
|
|
{
|
|
Free(impl);
|
|
}
|
|
}
|
|
}
|