Added git-remote-tor-annex, which allows git pull and push to the tor hidden service.
Almost working, but there's a bug in the relaying. Also, made tor hidden service setup pick a random port, to make it harder to port scan. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
parent
9cf9ee73f5
commit
070fb9e624
17 changed files with 254 additions and 61 deletions
34
Remote/Helper/Tor.hs
Normal file
34
Remote/Helper/Tor.hs
Normal file
|
@ -0,0 +1,34 @@
|
|||
{- Helpers for tor remotes.
|
||||
-
|
||||
- Copyright 2016 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Remote.Helper.Tor where
|
||||
|
||||
import Annex.Common
|
||||
import Remote.Helper.P2P (mkAuthToken, AuthToken)
|
||||
import Creds
|
||||
import Utility.Tor
|
||||
import Utility.Env
|
||||
|
||||
import Network.Socket
|
||||
|
||||
getTorAuthToken :: OnionAddress -> Annex (Maybe AuthToken)
|
||||
getTorAuthToken (OnionAddress onionaddress) =
|
||||
maybe Nothing mkAuthToken <$> getM id
|
||||
[ liftIO $ getEnv torAuthTokenEnv
|
||||
, readCacheCreds onionaddress
|
||||
]
|
||||
|
||||
torAuthTokenEnv :: String
|
||||
torAuthTokenEnv = "GIT_ANNEX_TOR_AUTHTOKEN"
|
||||
|
||||
torHandle :: Socket -> IO Handle
|
||||
torHandle s = do
|
||||
h <- socketToHandle s ReadWriteMode
|
||||
hSetBuffering h LineBuffering
|
||||
hSetBinaryMode h False
|
||||
fileEncoding h
|
||||
return h
|
Loading…
Add table
Add a link
Reference in a new issue