Propellor.Property.Tor: remove duplicate code
Signed-off-by: Félix Sipma <felix.sipma@no-log.org>
This commit is contained in:
parent
6fe4b0cd91
commit
b7a9655a69
|
@ -103,13 +103,8 @@ bandwidthRate' s divby = case readSize dataUnits s of
|
||||||
Nothing -> property ("unable to parse " ++ s) noChange
|
Nothing -> property ("unable to parse " ++ s) noChange
|
||||||
|
|
||||||
hiddenServiceAvailable :: HiddenServiceName -> Int -> Property NoInfo
|
hiddenServiceAvailable :: HiddenServiceName -> Int -> Property NoInfo
|
||||||
hiddenServiceAvailable hn port = hiddenServiceHostName prop
|
hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port
|
||||||
where
|
where
|
||||||
prop = configured
|
|
||||||
[ ("HiddenServiceDir", varLib </> hn)
|
|
||||||
, ("HiddenServicePort", unwords [show port, "127.0.0.1:" ++ show port])
|
|
||||||
]
|
|
||||||
`describe` "hidden service available"
|
|
||||||
hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do
|
hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do
|
||||||
r <- satisfy
|
r <- satisfy
|
||||||
h <- liftIO $ readFile (varLib </> hn </> "hostname")
|
h <- liftIO $ readFile (varLib </> hn </> "hostname")
|
||||||
|
@ -164,7 +159,7 @@ type NickName = String
|
||||||
|
|
||||||
-- | Convert String to a valid tor NickName.
|
-- | Convert String to a valid tor NickName.
|
||||||
saneNickname :: String -> NickName
|
saneNickname :: String -> NickName
|
||||||
saneNickname s
|
saneNickname s
|
||||||
| null n = "unnamed"
|
| null n = "unnamed"
|
||||||
| otherwise = n
|
| otherwise = n
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in New Issue