[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 47/69: Orfox: Centralized proxy applied to AbstractCommunicator and BaseResources.



This is an automated email from the git hooks/post-receive script.

richard pushed a commit to annotated tag FIREFOX_91_9_0esr_BUILD1
in repository tor-browser.

commit ab75a8d65afe56fee289b952be7df4589307aff5
Author: Amogh Pradeep <amoghbl1@xxxxxxxxx>
AuthorDate: Fri Jun 12 02:07:45 2015 -0400

    Orfox: Centralized proxy applied to AbstractCommunicator and BaseResources.
    
    See Bug 1357997 for partial uplift.
    
    Also:
    Bug 28051 - Use our Orbot for proxying our connections
    
    Bug 31144 - ESR68 Network Code Review
---
 .../java/org/mozilla/gecko/util/ProxySelector.java | 25 +++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
index dbd07a069de1f..800c7cf96de8b 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
@@ -29,6 +29,10 @@ import java.net.URLConnection;
 import java.util.List;
 
 public class ProxySelector {
+    private static final String TOR_PROXY_ADDRESS = "127.0.0.1";
+    private static final int TOR_SOCKS_PROXY_PORT = 9150;
+    private static final int TOR_HTTP_PROXY_PORT = 8218;
+
     public static URLConnection openConnectionWithProxy(final URI uri) throws IOException {
         final java.net.ProxySelector ps = java.net.ProxySelector.getDefault();
         Proxy proxy = Proxy.NO_PROXY;
@@ -39,7 +43,26 @@ public class ProxySelector {
             }
         }
 
-        return uri.toURL().openConnection(proxy);
+        /* Ignore the proxy we found from the VM, only use Tor. We can probably
+         * safely use the logic in this class in the future. */
+        return uri.toURL().openConnection(getProxy());
+    }
+
+    public static Proxy getProxy() {
+        // TODO make configurable
+        return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(TOR_PROXY_ADDRESS, TOR_SOCKS_PROXY_PORT));
+    }
+
+    public static String getProxyHostAddress() {
+        return TOR_PROXY_ADDRESS;
+    }
+
+    public static int getSocksProxyPort() {
+        return TOR_SOCKS_PROXY_PORT;
+    }
+
+    public static int getHttpProxyPort() {
+        return TOR_HTTP_PROXY_PORT;
     }
 
     public ProxySelector() {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits