From 1c57a692843218179d421f2473789ad3c9efe977 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 19 Oct 2019 01:31:45 +0200 Subject: introduce error types in VpnStatus to distinguish between Shapeshifter based errors and others --- app/src/main/java/de/blinkt/openvpn/core/LogItem.java | 10 ++++++++++ app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java | 9 +++++++++ 2 files changed, 19 insertions(+) (limited to 'app/src/main') diff --git a/app/src/main/java/de/blinkt/openvpn/core/LogItem.java b/app/src/main/java/de/blinkt/openvpn/core/LogItem.java index 178906c3..8a0a528a 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/LogItem.java +++ b/app/src/main/java/de/blinkt/openvpn/core/LogItem.java @@ -39,6 +39,7 @@ public class LogItem implements Parcelable { private int mRessourceId; // Default log priority VpnStatus.LogLevel mLevel = VpnStatus.LogLevel.INFO; + private VpnStatus.ErrorType errorType = VpnStatus.ErrorType.UNKNOWN; private long logtime = System.currentTimeMillis(); private int mVerbosityLevel = -1; @@ -246,6 +247,11 @@ public class LogItem implements Parcelable { mLevel = loglevel; } + public LogItem(VpnStatus.ErrorType errorType) { + mLevel = VpnStatus.LogLevel.ERROR; + this.errorType = errorType; + } + public String getString(Context c) { try { if (mMessage != null) { @@ -306,6 +312,10 @@ public class LogItem implements Parcelable { return mLevel; } + public VpnStatus.ErrorType getErrorType() { + return errorType; + } + @Override public String toString() { diff --git a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java index c362e299..737b8b42 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java +++ b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java @@ -216,6 +216,11 @@ public class VpnStatus { } } + public enum ErrorType { + UNKNOWN, + SHAPESHIFTER + } + // keytool -printcert -jarfile de.blinkt.openvpn_85.apk static final byte[] officalkey = {-58, -42, -44, -106, 90, -88, -87, -88, -52, -124, 84, 117, 66, 79, -112, -111, -46, 86, -37, 109}; static final byte[] officaldebugkey = {-99, -69, 45, 71, 114, -116, 82, 66, -99, -122, 50, -70, -56, -111, 98, -35, -65, 105, 82, 43}; @@ -502,6 +507,10 @@ public class VpnStatus { newLogItem(new LogItem(LogLevel.ERROR, resourceId, args)); } + public static void logError(ErrorType errorType) { + newLogItem(new LogItem(errorType)); + } + public static void logMessageOpenVPN(LogLevel level, int ovpnlevel, String message) { newLogItem(new LogItem(level, ovpnlevel, message)); -- cgit v1.2.3