summaryrefslogtreecommitdiff
path: root/P2P
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-06 12:19:47 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-06 12:27:58 -0400
commit43db49626e57214820e29341aed0024dd681e7bd (patch)
tree9e73165cf61a0f5e6766b7b12368ecba38306b6a /P2P
parent26a3156541e655ca6a32bbccff79326b045fb531 (diff)
stub Remote.P2P
Similar to GCrypt remotes, P2P remotes have an url, so Remote.Git has to separate them out and handle them, passing off to Remote.P2P. This commit was sponsored by Ignacio on Patreon.
Diffstat (limited to 'P2P')
-rw-r--r--P2P/Address.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/P2P/Address.hs b/P2P/Address.hs
index 19ff82a89..09ffc7973 100644
--- a/P2P/Address.hs
+++ b/P2P/Address.hs
@@ -10,6 +10,7 @@ module P2P.Address where
import qualified Annex
import Annex.Common
import Git
+import Git.Types
import Creds
import Utility.AuthToken
import Utility.Tor
@@ -54,6 +55,10 @@ instance FormatP2PAddress P2PAddressAuth where
authtoken <- toAuthToken (T.pack $ reverse ra)
return (P2PAddressAuth addr authtoken)
+repoP2PAddress :: Repo -> Maybe P2PAddress
+repoP2PAddress (Repo { location = Url url }) = unformatP2PAddress (show url)
+repoP2PAddress _ = Nothing
+
-- | Load known P2P addresses for this repository.
loadP2PAddresses :: Annex [P2PAddress]
loadP2PAddresses = mapMaybe unformatP2PAddress . maybe [] lines