diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java index dfdfbdd5..bf030a0f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java +++ b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/ObfsvpnClient.java @@ -13,7 +13,7 @@ import se.leap.bitmaskclient.pluggableTransports.models.KcpConfig; import se.leap.bitmaskclient.pluggableTransports.models.Obfs4Options; import se.leap.bitmaskclient.pluggableTransports.models.ObfsvpnConfig; -public class ObfsvpnClient { +public class ObfsvpnClient implements EventLogger { public static final int PORT = 8080; public static final String IP = "127.0.0.1"; @@ -40,31 +40,22 @@ public class ObfsvpnClient { try { Log.d(TAG, obfsvpnConfig.toString()); client = Client.newFFIClient(obfsvpnConfig.toString()); + client.setEventLogger(this); } catch (Exception e) { throw new IllegalStateException(e); } } public int start() { + synchronized (LOCK) { new Thread(() -> { try { - client.setEventLogger(new EventLogger() { - @Override - public void error(String s) { - VpnStatus.logError("[obfs4-client] " + s); - } - - @Override - public void log(String state, String message) { - VpnStatus.logDebug("[obfs4-client] " + state + ": " + message); - } - }); client.start(); } catch (Exception e) { e.printStackTrace(); } - }); + }).start(); return PORT; } } @@ -84,4 +75,15 @@ public class ObfsvpnClient { public boolean isStarted() { return client.isStarted(); } + + @Override + public void error(String s) { + VpnStatus.logError("[obfs4-client] " + s); + + } + + @Override + public void log(String state, String message) { + VpnStatus.logDebug("[obfs4-client] " + state + ": " + message); + } } |