haskell-tor: A Haskell Tor Node

[ bsd3, library, network ] [ Propose Tags ]

An implementation of the Tor anonymity system in Haskell. The core functionality is exported both as an application and as a high-level library exported by the Tor module. Please see that module for common usage scenarios, and dip only into the other files for advanced / unplanned cases.

[Skip to Readme]


[Last Documentation]

  • Tor
    • Tor.Circuit
    • DataFormat
      • Tor.DataFormat.Consensus
      • Tor.DataFormat.DefaultDirectory
      • Tor.DataFormat.DirCertInfo
      • Tor.DataFormat.Helpers
      • Tor.DataFormat.RelayCell
      • Tor.DataFormat.RouterDesc
      • Tor.DataFormat.TorAddress
      • Tor.DataFormat.TorCell
    • Tor.HybridCrypto
    • Tor.Link
      • Tor.Link.CipherSuites
      • Tor.Link.DH
    • Tor.NetworkStack
      • Tor.NetworkStack.Fetch
      • Tor.NetworkStack.Hans
      • Tor.NetworkStack.System
    • Tor.Options
    • Tor.RNG
    • Tor.RouterDesc
      • Tor.RouterDesc.Render
    • State
      • Tor.State.CircuitManager
      • Tor.State.Credentials
      • Tor.State.Directories
      • Tor.State.LinkManager
      • Tor.State.Routers


Automatic Flags

Use the base network library


Use the Haskell Network Stack (HaNS)


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS], 0.1.1, 0.1.2
Dependencies array (>=0.5 && <0.7), asn1-encoding (>=0.9 && <0.10), asn1-types (>=0.3 && <0.4), async (>=2.0.2 && <2.2), attoparsec (>=0.13 && <0.15), base (>=4.7 && <5.0), base64-bytestring (>=1.0 && <1.2), binary (>=0.7.1 && <0.9), bytestring (>=0.10 && <0.11), cereal (>=0.4 && <0.6), containers (>=0.5 && <0.7), cryptonite (>=0.6 && <0.10), fingertree (>=0.1 && <0.3), HALVMCore (>=2.0 && <2.4), hans (>=2.6 && <2.8), haskell-tor (>=0.1 && <0.3), hourglass (>=0.2.9 && <0.4), memory (>=0.7 && <0.11), monadLib (>=3.7 && <3.9), network (>=2.5 && <2.7), pretty-hex (>=1.0 && <1.2), pure-zlib (>=0.4 && <0.5), time (>=1.4 && <1.6), tls (>=1.3.2 && <1.5), x509 (>=1.6 && <1.8), x509-store (>=1.6 && <1.8), XenDevice (>=2.0 && <2.4) [details]
License BSD-3-Clause
Author Adam Wick
Maintainer awick@galois.com
Category Network
Home page http://github.com/GaloisInc/haskell-tor
Source repo head: git clone http://github.com/GaloisInc/haskell-tor
Uploaded by AdamWick at 2015-12-01T04:22:27Z
Executables haskell-tor
Downloads 2004 total (12 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-29 [all 4 reports]

Readme for haskell-tor-0.1.2

[back to package description]

A Tor Implementation in Haskell

This version of haskell-tor is (C) 2015 Galois, Inc., and distributed under
a standard, three-clause BSD license. Please see the file LICENSE,
distributed with this software, for specific terms and conditions.

What is Tor?

Tor is a secure onion routing network for providing anonymized access to both the public Internet as well as a series of Tor-internal hidden services. Much more information about Tor can be found at http://torproject.org.

Many thanks to all the hard work that project has put into developing and evangelizing Tor.

What is in this repository?

This repository contains a Tor implementation in Haskell. It is eventually designed to be a fully-compliant Tor implementation, but at the moment lacks some features:

  • Support for finding or implementing hidden services.
  • Proper flow-control support.
  • Statistics updating.
  • Directory server support.

Using this library as an entrance node (i.e., to create anonymized connections to hosts on the Internet) is fairly well tested and should be functional. Relay and exit node support is implemented but much less well tested. For whichever use case you have, please report any problems you find to the GitHub issue tracker.

Building haskell-tor

This library uses cabal as its build system, and should work for Mac, Unix, and HaLVM-based installations. Windows support may work ... we just haven't tested it.

Understanding Network Stacks

The haskell-tor library is built such that it can use one of two built-in network stacks and/or a third-party network stack that you provide. How you get each of these is governed by two flags that correspond to the two network stacks:

  • network ensures that haskell-tor includes defaults for the standard, sockets-based network stack as described in the Haskell network library.

  • hans ensures that haskell-tor includes defaults for the Haskell Network stack, which is a clean-slate networks stack that runs off raw Ethernet frames.

The defaults are a little complicated. To help try to sort things out, here is a table that describes all the combinations of flags, and what the default is for each platform:

Default Platform network hans Meaning
Normal True True Support for both hans and network
* Normal True False Support only network
Normal False True Support only hans
Normal False False No network stack support (BYONS)
HaLVM True True Support only hans (network ignored)
HaLVM True False No network stack support (see prev.)
* HaLVM False True Support only hans
HaLVM False False No network stack support (BYONS)

Standard Cabal Constraints

If you're building with the HaLVM, please add the constraints --constraint "tls +hans", --constraint "tls -network", and -f-network to your build flags, and if you're using the integer-simple library (for example, to avoid GPL entanglements with unikernels), you should add the constraints --constraint "cryptonite -integer-gmp", --constraint "scientific +integer-simple" and --constraint "scientific <".

In either case, we strongly suggest using sandboxes to keep everything nice and tidy.

Important Note

This is an early implementation of Tor that has not been peer-reviewed. Those with a true, deep need for anonymity should strongly consider using the mainline Tor client until and unless this version receives appropriate extensions, testing, and review.


As with most Haskell packages, this package can either be used as a library or as a binary package. Currently, the executable binary will simply perform an example get from whatismyip.com. Extending this to support a wider range of features is an open issue.