No description
Find a file
Federico Ceratto f3e20d2c71 Add demo
2020-10-11 18:19:21 +01:00
tests Add demo 2020-10-11 18:19:21 +01:00
CONTRIBUTORS Cleanup 2020-08-24 21:43:38 +01:00
LICENSE Update license 2020-01-08 23:17:39 +00:00
README.adoc Add demo 2020-10-11 18:19:21 +01:00
tor.nim Cleanup 2020-08-24 21:43:38 +01:00
tor.nimble Lower required Nim version 2020-08-24 21:37:28 +01:00

== Tor helper for Nim

image:https://img.shields.io/badge/status-alpha-orange.svg[badge]
image:https://img.shields.io/github/tag/FedericoCeratto/nim-tor.svg[tags]
image:https://img.shields.io/badge/License-MPL%20v2.0-blue.svg[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:

[source,bash]
----
nimble install tor
----

.Usage:
[source,nim]
----
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.