Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Addresses within Tor. TODO/FIXME: Fix everything about this module.
- data TorAddress
- putTorAddress :: TorAddress -> Put
- getTorAddress :: Get TorAddress
- unTorAddress :: TorAddress -> String
- torAddressByteString :: TorAddress -> ByteString
- ip4ToString :: ByteString -> String
- ip6ToString :: ByteString -> String
- putIP4String :: String -> Put
- putIP6String :: String -> Put
Documentation
data TorAddress Source
An abstract data type representing either an address or an address processing error, used in a variety of Tor protocols.
Hostname String | A hostname, as usual. |
IP4 String | An IP4 address, as 'a.b.c.d', in decimal |
IP6 String | An IP6 adddress, as '[...]', in usual hex form |
TransientError String | A transient error occurred when performing some action. Try again. |
NontransientError String | A non-transient error occurred when performing some action. Do not try again, or you will annoy the dragon. |
putTorAddress :: TorAddress -> Put Source
A putter for TorAddresses.
getTorAddress :: Get TorAddress Source
Parse a TorAddress off the wire.
unTorAddress :: TorAddress -> String Source
Turn a TorAddress into a string. Will result in an error for either of the error options.
torAddressByteString :: TorAddress -> ByteString Source
Translate a TorAddress into a ByteString.
ip4ToString :: ByteString -> String Source
Turn a 32-bit ByteString containing an IP4 address into the normal String version of that IP4 address.
ip6ToString :: ByteString -> String Source
Turn a normal 128-bit ByteString containing an IP6 address into the normal String version of that IP6 address. Recall that for Tor, the normal String version is wrapped in square braces ([0000:11111:...]).
putIP4String :: String -> Put Source
Given a normally-formatted IP4 String (a.b.c.d), turn that into a 32-bit ByteString containing that IP address.
putIP6String :: String -> Put Source
Given a normally-formatted IP6 String ([aaaa:bbbb:...]), turn that into a 128-bit ByteString containing that IP address. Note that this function does not support IP6 address compression ([aaaa::bbbbb]), so this must be a fully-expanded address.