network-anonymous-tor-0.11.0: Haskell API for Tor anonymous networking

Safe HaskellNone
LanguageHaskell2010

Network.Anonymous.Tor.Protocol

Description

Protocol description

Defines functions that handle the advancing of the Tor control protocol.

Warning: This function is used internally by Tor and using these functions directly is unsupported. The interface of these functions might change at any time without prior notice.

Synopsis

Documentation

data Availability Source

Represents the availability status of Tor for a specific port.

Constructors

Available

There is a Tor control service listening at the port

ConnectionRefused

There is no service listening at the port

IncorrectPort

There is a non-Tor control service listening at the port

isAvailable Source

Arguments

:: MonadIO m 
=> Integer

The ports we wish to probe

-> m Availability

The status of all the ports

Probes a port to see if there is a service at the remote that behaves like the Tor controller daemon. Will return the status of the probed port.

socksPort :: MonadIO m => Socket -> m Integer Source

Returns the configured SOCKS proxy port

connect Source

Arguments

:: MonadIO m 
=> Integer

Port our tor SOCKS server listens at.

-> SocksAddress

Address we wish to connect to

-> (Socket -> IO a)

Computation to execute once connection has been establised

-> m a 

Connect through a remote using the Tor SOCKS proxy. The remote might me a a normal host/ip or a hidden service address. When you provide a FQDN to resolve, it will be resolved by the Tor service, and as such is secure.

This function is provided as a convenience, since it doesn't actually use the Tor control protocol, and can be used to talk with any Socks5 compatible proxy server.

connect' Source

Arguments

:: MonadIO m 
=> Socket

Our connection with the Tor control port

-> SocksAddress

Address we wish to connect to

-> (Socket -> IO a)

Computation to execute once connection has been establised

-> m a 

protocolInfo :: MonadIO m => Socket -> m ProtocolInfo Source

Requests protocol version information from Tor. This can be used while still unauthenticated and authentication methods can be derived from this information.

authenticate :: MonadIO m => Socket -> m () Source

Authenticates with the Tor control server, based on the authentication information returned by PROTOCOLINFO.

mapOnion Source

Arguments

:: MonadIO m 
=> Socket

Connection with tor Control port

-> Integer

Remote point of hidden service to listen at

-> Integer

Local port to map onion service to

-> Bool

Wether to detach the hidden service from the current session

-> Maybe ByteString

Optional private key to use to set up the hidden service

-> m Base32String

The address/service id of the Onion without the .onion part

Creates a new hidden service and maps a public port to a local port. Useful for bridging a local service (e.g. a webserver or irc daemon) as a Tor hidden service. If a private key is supplied, it is used to instantiate the service.