Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

FedericoCeratto/nim-tor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tor helper for Nim

badge tags License

Features

  • Wrap sockets to use the SOCKS proxy provided by Tor

  • Wrap sockets to connect to Onion Services

  • Authenticates against a local Tor daemon to create / list / delete traditional and ephemeral Onion Services

  • Tested on Linux

  • Basic functional tests

Usage

Install the library:

nimble install tor
Usage:
import tor

# connect over Tor
var s = newProxySocket()
s.connect("1.1.1.1", 80.Port)
s.send("GET / HTTP/1.1\nHost: facebook.com\n\n")
discard s.recvLine(timeout=9000)
echo s.recv(200)

# connet to Onion Service
s = newProxySocket()
s.connect("facebookcorewwwi.onion", 80.Port)
s.send("GET / HTTP/1.1\nHost: facebook.com\n\n")
echo s.recvLine(timeout=9000)

See the tests/ dir for more usage examples.

See tests/serve_file_demo.nim for a HTTP-based onion service demo

To enable authentication with the Controller, install the libsodium wrapper and pass -d:usesodium

Contributing

Testing and PRs are welcome.