I have been working on this problem for weeks but just can't seem to get it... I've been trying to write a Haskell program that connects to a socks5 proxy (namely tor), so that way I can access onion sites from within the program, but it's not working.
To give you the layout, I have tor running on localhost@9050 and it certainly works because I can configure my browser to work with it through socks5. Privoxy is not running.
The source code is:
import Network
import Network.Socket
import Network.Socks5
getonion :: IO ()
getonion = do
putStrLn "Connecting..."
sock <- socksConnectWith (defaultSocksConf "localhost" (PortNum 9050)) "exampleonion.onion" (PortNumber 80)
putStrLn "Connected!"
Every time I run getonion, it always results in:
Connecting...
*** Exception: connect: does not exist (Connection refused)
I've tried connecting to localhost using all sorts of ways, namely the other functions referenced here and here, but socksConnectWith seemed the most straightforward.
If anyone could help me figure this out it would be much appreciated. I could even post the wireshark packets that come from my program to localhost. Thank you.