[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] Orbot changes for new verison of IPtProxy that dynamically picks ports
commit 4f8982e039b30b0dcae1ed6ee03aa17d5bd92cb7
Author: bim <dsnake@xxxxxxxxxxxxxx>
Date: Mon May 24 19:43:37 2021 -0400
Orbot changes for new verison of IPtProxy that dynamically picks ports
---
.../android/ui/onboarding/MoatActivity.java | 6 ++--
.../torproject/android/service/OrbotService.java | 33 +++++++++-------------
2 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java b/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java
index 165b1a63..f34fdaa6 100644
--- a/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java
@@ -188,9 +188,9 @@ public class MoatActivity extends AppCompatActivity implements View.OnClickListe
IPtProxy.startObfs4Proxy("DEBUG", false, false);
- ProxiedHurlStack phs = new ProxiedHurlStack("127.0.0.1", (int) IPtProxy.MeekSocksPort,
- "url=" + OrbotService.getCdnFront(this,"moat-url")
- + ";front=" + OrbotService.getCdnFront(this,"moat-front"), "\0");
+ ProxiedHurlStack phs = new ProxiedHurlStack("127.0.0.1", (int) IPtProxy.meekPort(),
+ "url=" + OrbotService.getCdnFront("moat-url")
+ + ";front=" + OrbotService.getCdnFront("moat-front"), "\0");
mQueue = Volley.newRequestQueue(this, phs);
diff --git a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
index ed463752..020f4ef6 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
@@ -340,24 +340,19 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
private static HashMap<String,String> mFronts;
- public static void loadCdnFronts (Context context)
- {
-
- if (mFronts == null)
- {
+ public static void loadCdnFronts (Context context) {
+ if (mFronts == null) {
mFronts = new HashMap<>();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(context.getAssets().open("fronts")));
- String line = null;
- while ((line = reader.readLine())!=null)
- {
+ String line;
+ while ((line = reader.readLine())!=null) {
String[] front = line.split(" ");
//add some code to test the connection here
mFronts.put(front[0],front[1]);
-
}
} catch (IOException e) {
e.printStackTrace();
@@ -365,18 +360,16 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
}
}
- public static String getCdnFront (Context context, String service)
- {
-
+ public static String getCdnFront(String service) {
return mFronts.get(service);
}
private void startSnowflakeClient() {
//this is using the current, default Tor snowflake infrastructure
- String target = getCdnFront(this, "snowflake-target");
- String front = getCdnFront(this,"snowflake-front");
- String stunServer = getCdnFront(this, "snowflake-stun");
+ String target = getCdnFront("snowflake-target");
+ String front = getCdnFront("snowflake-front");
+ String stunServer = getCdnFront("snowflake-stun");
IPtProxy.startSnowflake(stunServer, target, front,
null, true, false, true, 3);
@@ -529,6 +522,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
File fileCacheDir = new File(getCacheDir(), "pt");
if (!fileCacheDir.exists())
+ //noinspection ResultOfMethodCallIgnored
fileCacheDir.mkdir();
IPtProxy.setStateLocation(fileCacheDir.getAbsolutePath());
String fileTestState = IPtProxy.getStateLocation();
@@ -1121,20 +1115,21 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
//check if any PT bridges are needed
if (bridgeList.contains("obfs")) {
- extraLines.append("ClientTransportPlugin obfs3 socks5 127.0.0.1:" + IPtProxy.Obfs3SocksPort).append('\n');
- extraLines.append("ClientTransportPlugin obfs4 socks5 127.0.0.1:" + IPtProxy.Obfs4SocksPort).append('\n');
+
+ extraLines.append("ClientTransportPlugin obfs3 socks5 127.0.0.1:" + IPtProxy.obfs3Port()).append('\n');
+ extraLines.append("ClientTransportPlugin obfs4 socks5 127.0.0.1:" + IPtProxy.obfs4Port()).append('\n');
if (bridgeList.equals("obfs4"))
builtInBridgeType = "obfs4";
}
if (bridgeList.equals("meek")) {
- extraLines.append("ClientTransportPlugin meek_lite socks5 127.0.0.1:" + IPtProxy.MeekSocksPort).append('\n');
+ extraLines.append("ClientTransportPlugin meek_lite socks5 127.0.0.1:" + IPtProxy.meekPort()).append('\n');
builtInBridgeType = "meek_lite";
}
if (bridgeList.equals("snowflake")) {
- extraLines.append("ClientTransportPlugin snowflake socks5 127.0.0.1:" + IPtProxy.SnowflakeSocksPort).append('\n');
+ extraLines.append("ClientTransportPlugin snowflake socks5 127.0.0.1:" + IPtProxy.snowflakePort()).append('\n');
builtInBridgeType = "snowflake";
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits