summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Tor.hs
diff options
context:
space:
mode:
authorJoey Hess2016-09-01 10:36:22 -0400
committerJoey Hess2016-09-01 10:36:22 -0400
commite350175be425e966bd81153580644c741a09eafb (patch)
treef03f72ea78569c23a639a51394dd9d54c9909244 /src/Propellor/Property/Tor.hs
parent4c90e41829d3c2565df200373b6e822bc244a998 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Tor.hs')
-rw-r--r--src/Propellor/Property/Tor.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs
index fb756f56..951084b4 100644
--- a/src/Propellor/Property/Tor.hs
+++ b/src/Propellor/Property/Tor.hs
@@ -119,15 +119,7 @@ bandwidthRate' s divby = case readSize dataUnits s of
`describe` ("tor BandwidthRate " ++ v)
Nothing -> property ("unable to parse " ++ s) noChange
-hiddenServiceAvailable :: HiddenServiceName -> Port -> Property DebianLike
-hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port
- where
- hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do
- r <- satisfy
- h <- liftIO $ readFile (varLib </> hn </> "hostname")
- warningMessage $ unwords ["hidden service hostname:", h]
- return r
-
+-- | Enables a hidden service for a given port.
hiddenService :: HiddenServiceName -> Port -> Property DebianLike
hiddenService hn (Port port) = ConfFile.adjustSection
(unwords ["hidden service", hn, "available on port", show port])
@@ -141,6 +133,18 @@ hiddenService hn (Port port) = ConfFile.adjustSection
oniondir = unwords ["HiddenServiceDir", varLib </> hn]
onionport = unwords ["HiddenServicePort", show port, "127.0.0.1:" ++ show port]
+-- | Same as `hiddenService` but also causes propellor to display
+-- the onion address of the hidden service.
+hiddenServiceAvailable :: HiddenServiceName -> Port -> Property DebianLike
+hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port
+ where
+ hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do
+ r <- satisfy
+ h <- liftIO $ readFile (varLib </> hn </> "hostname")
+ warningMessage $ unwords ["hidden service hostname:", h]
+ return r
+
+-- |
hiddenServiceData :: IsContext c => HiddenServiceName -> c -> Property (HasInfo + DebianLike)
hiddenServiceData hn context = combineProperties desc $ props
& installonion "hostname"