Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module for maintaining an up-to-date list of Tor nodes in the Tor network.
- data RouterDB
- data RouterRestriction
- newRouterDatabase :: TorNetworkStack ls s -> DirectoryDB -> (String -> IO ()) -> IO RouterDB
- findRouter :: RouterDB -> [ExtendSpec] -> IO (Maybe RouterDesc)
- getRouter :: RouterDB -> [RouterRestriction] -> TorRNG -> IO (TorRNG, RouterDesc)
- meetsRestrictions :: RouterDesc -> [RouterRestriction] -> Bool
- allowsExit :: [ExitRule] -> TorAddress -> Word16 -> Bool
Documentation
data RouterRestriction Source
Restrictions to apply when searching for a router or set of routers.
IsStable | Marked with the Stable flag |
NotRouter RouterDesc | Is not the given router |
NotTorAddr TorAddress | Is not the given address |
ExitNode | Is an exit node of some kind |
ExitNodeAllowing TorAddress Word16 | Is an exit node that allows traffic to the given address and port. |
newRouterDatabase :: TorNetworkStack ls s -> DirectoryDB -> (String -> IO ()) -> IO RouterDB Source
Build a new router database. This database will return before it is fully initialized, in order to make general start-up faster. This may mean that some queries of the database will take longer upon initial loading, or when the database is being refreshed periodicatly.
findRouter :: RouterDB -> [ExtendSpec] -> IO (Maybe RouterDesc) Source
Find a router given its fingerprint.
getRouter :: RouterDB -> [RouterRestriction] -> TorRNG -> IO (TorRNG, RouterDesc) Source
Fetch a router matching the given restrictions. The restrictions list should be thought of an AND with a default of True given the empty list. This routine may take awhile to find a suitable entry if the restrictions are cumbersome or if the database is being reloaded.
meetsRestrictions :: RouterDesc -> [RouterRestriction] -> Bool Source
Returns true iff the given router meets all the given restrictions. (If no restrictions are provided, then the router meets all of them.)
allowsExit :: [ExitRule] -> TorAddress -> Word16 -> Bool Source
Returns true iff the given exit rules allow traffic to the given address / port pair.