mirror of
https://github.com/FedericoCeratto/nim-tor
synced 2026-01-14 01:21:48 +00:00
No description
| tests | ||
| CONTRIBUTORS | ||
| LICENSE | ||
| README.adoc | ||
| tor.nim | ||
| tor.nimble | ||
== 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.