diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-09-01 10:36:22 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-09-01 10:36:22 -0400 |
| commit | e350175be425e966bd81153580644c741a09eafb (patch) | |
| tree | f03f72ea78569c23a639a51394dd9d54c9909244 /src | |
| parent | 4c90e41829d3c2565df200373b6e822bc244a998 (diff) | |
propellor spin
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Tor.hs | 22 |
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" |
