git-annex/RemoteDaemon/Transport.hs
Joey Hess f1781d01d8
remotedaemon support for generic P2P transports
RemoteDaemon.Transport.Tor was refactored into this, and most of the
code is reused between them.

getSocketFile does not yet deal with repositories on crippled
filesystems that don't support sockets. Annex.Ssh detects that and
allows the user to set an environment variable, and something similar
could be done here.

And it does not deal with a situation where there is no path to the
socket file that is not too long. In that situation it would crash out
I suppose. Probably though, remotedaemon is ran from the top of the
repo, and in that case the path is just ".git/annex/p2p/<md5>" so nice
and short.

This seems to mostly work. But I don't yet have a working git-annex-p2p-
command to test it with.

And with my not quite working git-annex-p2p-foo test script, running
remotedaemon results in an ever-growing number of zombie processes
that it's not waiting on.
2025-07-31 14:45:32 -04:00

35 lines
1,018 B
Haskell

{- git-remote-daemon transports
-
- Copyright 2014-2025 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
module RemoteDaemon.Transport where
import RemoteDaemon.Types
import qualified RemoteDaemon.Transport.Ssh
import qualified RemoteDaemon.Transport.GCrypt
import qualified RemoteDaemon.Transport.Tor
import qualified RemoteDaemon.Transport.P2PGeneric
import qualified Git.GCrypt
import P2P.Address (torAnnexScheme, p2pAnnexScheme)
import qualified Data.Map as M
-- Corresponds to uriScheme
type TransportScheme = String
remoteTransports :: M.Map TransportScheme Transport
remoteTransports = M.fromList
[ ("ssh:", RemoteDaemon.Transport.Ssh.transport)
, (Git.GCrypt.urlScheme, RemoteDaemon.Transport.GCrypt.transport)
, (torAnnexScheme, RemoteDaemon.Transport.Tor.transport)
, (p2pAnnexScheme, RemoteDaemon.Transport.P2PGeneric.transport)
]
remoteServers :: [Server]
remoteServers =
[ RemoteDaemon.Transport.Tor.server
, RemoteDaemon.Transport.P2PGeneric.server
]