Last active
February 25, 2021 13:48
-
-
Save fancellu/7103aabaef2660a3110e268707da1767 to your computer and use it in GitHub Desktop.
Tiny App to show how to talk via Tor Socks Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
Congratulations. This browser is configured to use Tor. | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run up Tor Browser first for it it kick off Tor Proxy) | |
import java.net.{InetSocketAddress, URL} | |
import java.net.Proxy | |
object TryTorSocks extends App { | |
val sockAddr = new InetSocketAddress("localhost", 9150) | |
val proxy = new Proxy(Proxy.Type.SOCKS, sockAddr) | |
val url = new URL("https://check.torproject.org/") | |
val is=url.openConnection(proxy).getInputStream | |
val string=scala.io.Source.fromInputStream(is).mkString | |
is.close() | |
println(string) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment