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.
This commit is contained in:
Joey Hess 2016-12-06 12:19:47 -04:00
parent a8c868c2e1
commit b29088b8dc
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
5 changed files with 99 additions and 2 deletions

View file

@ -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