From c532deba4a8020a8e777eaa6e205133c8c169c4a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 30 Dec 2016 12:31:17 -0400 Subject: refactor --- P2P/Annex.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'P2P') diff --git a/P2P/Annex.hs b/P2P/Annex.hs index 9971762f5..b7372fd4d 100644 --- a/P2P/Annex.hs +++ b/P2P/Annex.hs @@ -5,25 +5,32 @@ - Licensed under the GNU GPL version 3 or higher. -} -{-# LANGUAGE RankNTypes, FlexibleContexts #-} +{-# LANGUAGE RankNTypes, FlexibleContexts, CPP #-} module P2P.Annex ( RunMode(..) , P2PConnection(..) , runFullProto + , torSocketFile ) where import Annex.Common import Annex.Content import Annex.Transfer import Annex.ChangedRefs +import P2P.Address import P2P.Protocol import P2P.IO import Logs.Location import Types.NumCopies import Utility.Metered +import Utility.Tor +import Annex.UUID import Control.Monad.Free +#ifndef mingw32_HOST_OS +import System.Posix.User +#endif data RunMode = Serving UUID (Maybe ChangedRefsHandle) @@ -152,3 +159,10 @@ runLocal runmode runner a = case a of liftIO $ hSeek h AbsoluteSeek o b <- liftIO $ hGetContentsMetered h p' runner (sender b) + +torSocketFile :: Annex (Maybe FilePath) +torSocketFile = do + u <- getUUID + uid <- liftIO getRealUserID + let ident = fromUUID u + liftIO $ getHiddenServiceSocketFile torAppName uid ident -- cgit v1.2.3