mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
periodically restarts tor daemon when it fails to get a response from itself, rate limits restarts
This commit is contained in:
committed by
Aiden McClelland
parent
5fbf34a84e
commit
ebd74cca3c
@@ -3,11 +3,22 @@ module Lib.Tor where
|
||||
import Startlude
|
||||
|
||||
import qualified Data.Text as T
|
||||
import Network.HTTP.Client
|
||||
import Network.Connection
|
||||
|
||||
import Lib.SystemPaths
|
||||
import Network.HTTP.Client.TLS ( mkManagerSettings
|
||||
, newTlsManagerWith
|
||||
)
|
||||
import Data.Default
|
||||
|
||||
getAgentHiddenServiceUrl :: (HasFilesystemBase sig m, MonadIO m) => m Text
|
||||
getAgentHiddenServiceUrl = T.strip <$> readSystemPath' agentTorHiddenServiceHostnamePath
|
||||
|
||||
getAgentHiddenServiceUrlMaybe :: (HasFilesystemBase sig m, MonadIO m) => m (Maybe Text)
|
||||
getAgentHiddenServiceUrlMaybe = fmap T.strip <$> readSystemPath agentTorHiddenServiceHostnamePath
|
||||
|
||||
-- | 'newTorManager' currently assumes the tor client lives on the localhost. The port comes in over an argument.
|
||||
-- If this is insufficient in the future, feel free to parameterize the host.
|
||||
newTorManager :: Word16 -> IO Manager
|
||||
newTorManager = newTlsManagerWith . mkManagerSettings def . Just . SockSettingsSimple "127.0.0.1" . fromIntegral
|
||||
|
||||
Reference in New Issue
Block a user