mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
Fix protocol change from AWG to WG for Android
This commit is contained in:
+1
-1
Submodule client/3rd-prebuilt updated: fbb5f586b9...c3ca525f92
@@ -595,7 +595,7 @@ public final class Interface {
|
|||||||
if (jc < 0)
|
if (jc < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.JC, Reason.INVALID_VALUE, String.valueOf(jc));
|
Section.INTERFACE, Location.JC, Reason.INVALID_VALUE, String.valueOf(jc));
|
||||||
this.jc = jc == 0 ? Optional.empty() : Optional.of(jc);
|
this.jc = Optional.of(jc);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ public final class Interface {
|
|||||||
if (jmin < 0)
|
if (jmin < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.JMIN, Reason.INVALID_VALUE, String.valueOf(jmin));
|
Section.INTERFACE, Location.JMIN, Reason.INVALID_VALUE, String.valueOf(jmin));
|
||||||
this.jmin = jmin == 0 ? Optional.empty() : Optional.of(jmin);
|
this.jmin = Optional.of(jmin);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ public final class Interface {
|
|||||||
if (jmax < 0)
|
if (jmax < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.JMAX, Reason.INVALID_VALUE, String.valueOf(jmax));
|
Section.INTERFACE, Location.JMAX, Reason.INVALID_VALUE, String.valueOf(jmax));
|
||||||
this.jmax = jmax == 0 ? Optional.empty() : Optional.of(jmax);
|
this.jmax = Optional.of(jmax);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,7 +619,7 @@ public final class Interface {
|
|||||||
if (s1 < 0)
|
if (s1 < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.S1, Reason.INVALID_VALUE, String.valueOf(s1));
|
Section.INTERFACE, Location.S1, Reason.INVALID_VALUE, String.valueOf(s1));
|
||||||
this.s1 = s1 == 0 ? Optional.empty() : Optional.of(s1);
|
this.s1 = Optional.of(s1);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ public final class Interface {
|
|||||||
if (s2 < 0)
|
if (s2 < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.S2, Reason.INVALID_VALUE, String.valueOf(s2));
|
Section.INTERFACE, Location.S2, Reason.INVALID_VALUE, String.valueOf(s2));
|
||||||
this.s2 = s2 == 0 ? Optional.empty() : Optional.of(s2);
|
this.s2 = Optional.of(s2);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,7 +635,7 @@ public final class Interface {
|
|||||||
if (h1 < 0)
|
if (h1 < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.H1, Reason.INVALID_VALUE, String.valueOf(h1));
|
Section.INTERFACE, Location.H1, Reason.INVALID_VALUE, String.valueOf(h1));
|
||||||
this.h1 = h1 == 0 ? Optional.empty() : Optional.of(h1);
|
this.h1 = Optional.of(h1);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,7 +643,7 @@ public final class Interface {
|
|||||||
if (h2 < 0)
|
if (h2 < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.H2, Reason.INVALID_VALUE, String.valueOf(h2));
|
Section.INTERFACE, Location.H2, Reason.INVALID_VALUE, String.valueOf(h2));
|
||||||
this.h2 = h2 == 0 ? Optional.empty() : Optional.of(h2);
|
this.h2 = Optional.of(h2);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,7 +651,7 @@ public final class Interface {
|
|||||||
if (h3 < 0)
|
if (h3 < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.H3, Reason.INVALID_VALUE, String.valueOf(h3));
|
Section.INTERFACE, Location.H3, Reason.INVALID_VALUE, String.valueOf(h3));
|
||||||
this.h3 = h3 == 0 ? Optional.empty() : Optional.of(h3);
|
this.h3 = Optional.of(h3);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ public final class Interface {
|
|||||||
if (h4 < 0)
|
if (h4 < 0)
|
||||||
throw new BadConfigException(
|
throw new BadConfigException(
|
||||||
Section.INTERFACE, Location.H4, Reason.INVALID_VALUE, String.valueOf(h4));
|
Section.INTERFACE, Location.H4, Reason.INVALID_VALUE, String.valueOf(h4));
|
||||||
this.h4 = h4 == 0 ? Optional.empty() : Optional.of(h4);
|
this.h4 = Optional.of(h4);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -615,6 +615,17 @@ class VPNService : BaseVpnService(), LocalDnsService.Interface {
|
|||||||
ifaceBuilder.parseH2(ifaceConfig["H2"])
|
ifaceBuilder.parseH2(ifaceConfig["H2"])
|
||||||
ifaceBuilder.parseH3(ifaceConfig["H3"])
|
ifaceBuilder.parseH3(ifaceConfig["H3"])
|
||||||
ifaceBuilder.parseH4(ifaceConfig["H4"])
|
ifaceBuilder.parseH4(ifaceConfig["H4"])
|
||||||
|
} else {
|
||||||
|
ifaceBuilder.parseJc("0")
|
||||||
|
ifaceBuilder.parseJmin("0")
|
||||||
|
ifaceBuilder.parseJmax("0")
|
||||||
|
ifaceBuilder.parseS1("0")
|
||||||
|
ifaceBuilder.parseS2("0")
|
||||||
|
ifaceBuilder.parseH1("0")
|
||||||
|
ifaceBuilder.parseH2("0")
|
||||||
|
ifaceBuilder.parseH3("0")
|
||||||
|
ifaceBuilder.parseH4("0")
|
||||||
|
|
||||||
}
|
}
|
||||||
/*val jExcludedApplication = obj.getJSONArray("excludedApps")
|
/*val jExcludedApplication = obj.getJSONArray("excludedApps")
|
||||||
(0 until jExcludedApplication.length()).toList().forEach {
|
(0 until jExcludedApplication.length()).toList().forEach {
|
||||||
@@ -745,9 +756,15 @@ class VPNService : BaseVpnService(), LocalDnsService.Interface {
|
|||||||
val builder = Builder()
|
val builder = Builder()
|
||||||
setupBuilder(wireguard_conf, builder)
|
setupBuilder(wireguard_conf, builder)
|
||||||
builder.setSession("Amnezia")
|
builder.setSession("Amnezia")
|
||||||
|
|
||||||
|
|
||||||
builder.establish().use { tun ->
|
builder.establish().use { tun ->
|
||||||
if (tun == null) return
|
if (tun == null) return
|
||||||
currentTunnelHandle = GoBackend.wgTurnOn("Amnezia", tun.detachFd(), wgConfig)
|
if (type == "awg"){
|
||||||
|
currentTunnelHandle = GoBackend.wgTurnOn("awg0", tun.detachFd(), wgConfig)
|
||||||
|
} else {
|
||||||
|
currentTunnelHandle = GoBackend.wgTurnOn("amn0", tun.detachFd(), wgConfig)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (currentTunnelHandle < 0) {
|
if (currentTunnelHandle < 0) {
|
||||||
Log.e(tag, "Activation Error Code -> $currentTunnelHandle")
|
Log.e(tag, "Activation Error Code -> $currentTunnelHandle")
|
||||||
|
|||||||
Reference in New Issue
Block a user