Skip to content
Browse files

cleaning up comments and sample code

added new license file, in line with Orbot code
  • Loading branch information...
1 parent 65a1492 commit 2bdfe45ac882ecb57f22700dd545658eaf9ca936 @n8fr8 n8fr8 committed Jan 30, 2011
Showing with 82 additions and 6 deletions.
  1. +47 −0 LICENSE
  2. +17 −0 README
  3. +9 −5 src/net/sourceforge/jsocks/socks/UDPRelayServer.java
  4. +9 −1 src/orlib/sample/OrlibMainActivity.java
View
47 LICENSE
@@ -0,0 +1,47 @@
+This file contains the license for Orlib, a free software project to
+provide anonymity on the Internet from a Google Android smartphone.
+
+For more information about Orlib, see https://guardianproject.info/
+
+If you got this file as a part of a larger bundle, there may be other
+license terms that you should be aware of.
+===============================================================================
+Orlib is distributed under this license (aka the 3-clause BSD license)
+
+Copyright (c) 2009-2010, Nathan Freitas, The Guardian Project
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+
+ * Neither the names of the copyright owners nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*****
+Orlib contains a binary distribution of the JSocks library:
+http://code.google.com/p/jsocks-mirror/
+which is licensed under the GNU Lesser General Public License:
+http://www.gnu.org/licenses/lgpl.html
+
+*****
View
17 README
@@ -0,0 +1,17 @@
+
+Once Orbot connects successfully to the Tor network, it offers two proxy servers running
+on localhost that applications can route their traffic through.
+
+HTTP Proxy: localhost:8118
+SOCKS 4/5 Proxy: localhost:9050
+
+src/orlib/sample/OrlibMainActivity.java:
+for the basics of how to use this library to open sockets and make HTTP requests via the
+SOCKS and HTTP proxies available from Orbot
+
+The standard Apache HTTPClient libraries provide calls to setup proxying. This sample code
+demonstrates that.
+
+All applications using the SOCKS proxy should not resolve their DNS locally,
+and instead should pass the hostnames through the SOCKS proxy.
+
View
14 src/net/sourceforge/jsocks/socks/UDPRelayServer.java
@@ -1,10 +1,14 @@
package net.sourceforge.jsocks.socks;
-import net.sourceforge.jsocks.socks.server.*;
-
-import java.net.*;
-import java.io.*;
-
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+import net.sourceforge.jsocks.socks.server.ServerAuthenticator;
import android.util.Log;
/**
View
10 src/orlib/sample/OrlibMainActivity.java
@@ -50,6 +50,7 @@ public void onClick(View v) {
{
public void run()
{
+ //this opens a direct socks socket on port 80
openSocksSocket("check.torproject.org",80);
}
};
@@ -67,6 +68,9 @@ public void onClick(View v) {
//use the local Privoxy->Tor HTTP proxy
checkHTTP("http://check.torproject.org", Proxy.Type.HTTP, "localhost", 8118);
+ //you can also use SOCKS with non HTTPS/S links
+ //checkHTTP("http://check.torproject.org", Proxy.Type.SOCKS, "localhost", 9050);
+
}
});
@@ -77,10 +81,14 @@ public void onClick(View v) {
public void onClick(View v) {
//use the direct SOCKS5 proxy built into Tor itself (more secure)
- //SOCKS with HTTPS not quite working yet, so use HTTP for now
+
+ //SOCKS with HTTP/S not quite working yet (DNS leaks)
//checkHTTP("https://check.torproject.org:443/", Proxy.Type.SOCKS, "localhost", 9050);
+
+ /// so use HTTP proxy for now, it will work just fine!
checkHTTP("https://check.torproject.org/", Proxy.Type.HTTP, "localhost", 8118);
+
}
});

0 comments on commit 2bdfe45

Please sign in to comment.
Something went wrong with that request. Please try again.