wormhole pairing appid flag day 2021-12-31
Wormhole pairing will start to provide an appid to wormhole on 2021-12-31. An appid can't be provided now because Debian stable is going to ship a older version of git-annex that does not provide an appid. Assumption is that by 2021-12-31, this version of git-annex will be shipped in a Debian stable release. If that turns out to not be the case, this change will need to be cherry-picked into the git-annex in Debian stable, or its wormhole pairing will break. This commit was sponsored by Thomas Hochstein on Patreon.
This commit is contained in:
parent
06f307ad13
commit
3fe9d99f24
4 changed files with 39 additions and 3 deletions
|
@ -20,6 +20,13 @@ git-annex (6.20170102) UNRELEASED; urgency=medium
|
||||||
their contents in memory.
|
their contents in memory.
|
||||||
* unused: Improved memory use significantly when there are a lot
|
* unused: Improved memory use significantly when there are a lot
|
||||||
of differences between branches.
|
of differences between branches.
|
||||||
|
* Wormhole pairing will start to provide an appid to wormhole on
|
||||||
|
2021-12-31. An appid can't be provided now because Debian stable is going
|
||||||
|
to ship a older version of git-annex that does not provide an appid.
|
||||||
|
Assumption is that by 2021-12-31, this version of git-annex will be
|
||||||
|
shipped in a Debian stable release. If that turns out to not be the
|
||||||
|
case, this change will need to be cherry-picked into the git-annex in
|
||||||
|
Debian stable, or its wormhole pairing will break.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 06 Jan 2017 15:22:06 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 06 Jan 2017 15:22:06 -0400
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import qualified Utility.MagicWormhole as Wormhole
|
||||||
|
|
||||||
import Control.Concurrent.Async
|
import Control.Concurrent.Async
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
import Data.Time.Clock.POSIX
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = command "p2p" SectionSetup
|
cmd = command "p2p" SectionSetup
|
||||||
|
@ -224,10 +225,32 @@ wormholePairing remotename ouraddrs ui = do
|
||||||
observer <- liftIO Wormhole.mkCodeObserver
|
observer <- liftIO Wormhole.mkCodeObserver
|
||||||
producer <- liftIO Wormhole.mkCodeProducer
|
producer <- liftIO Wormhole.mkCodeProducer
|
||||||
void $ liftIO $ async $ ui observer producer
|
void $ liftIO $ async $ ui observer producer
|
||||||
|
-- Provide an appid to magic wormhole, to avoid using
|
||||||
|
-- the same channels that other wormhole users use.
|
||||||
|
--
|
||||||
|
-- Since a version of git-annex that did not provide an
|
||||||
|
-- appid is shipping in Debian 9, and having one side
|
||||||
|
-- provide an appid while the other does not will make
|
||||||
|
-- wormhole fail, this is deferred until 2021-12-31.
|
||||||
|
-- After that point, all git-annex's should have been
|
||||||
|
-- upgraded to include this code, and they will start
|
||||||
|
-- providing an appid.
|
||||||
|
--
|
||||||
|
-- This assumes reasonably good client clocks. If the clock
|
||||||
|
-- is completely wrong, it won't use the appid at that
|
||||||
|
-- point, and pairing will fail. On 2021-12-31, minor clock
|
||||||
|
-- skew may also cause transient problems.
|
||||||
|
--
|
||||||
|
-- After 2021-12-31, this can be changed to simply
|
||||||
|
-- always provide the appid.
|
||||||
|
now <- liftIO getPOSIXTime
|
||||||
|
let wormholeparams = if now < 1640950000
|
||||||
|
then []
|
||||||
|
else Wormhole.appId "git-annex.branchable.com/p2p-setup"
|
||||||
(sendres, recvres) <- liftIO $
|
(sendres, recvres) <- liftIO $
|
||||||
Wormhole.sendFile sendf observer []
|
Wormhole.sendFile sendf observer wormholeparams
|
||||||
`concurrently`
|
`concurrently`
|
||||||
Wormhole.receiveFile recvf producer []
|
Wormhole.receiveFile recvf producer wormholeparams
|
||||||
liftIO $ nukeFile sendf
|
liftIO $ nukeFile sendf
|
||||||
if sendres /= True
|
if sendres /= True
|
||||||
then return SendFailed
|
then return SendFailed
|
||||||
|
|
|
@ -18,6 +18,7 @@ module Utility.MagicWormhole (
|
||||||
waitCode,
|
waitCode,
|
||||||
sendCode,
|
sendCode,
|
||||||
WormHoleParams,
|
WormHoleParams,
|
||||||
|
appId,
|
||||||
sendFile,
|
sendFile,
|
||||||
receiveFile,
|
receiveFile,
|
||||||
isInstalled,
|
isInstalled,
|
||||||
|
@ -87,6 +88,11 @@ sendCode (CodeProducer p) = putMVar p
|
||||||
|
|
||||||
type WormHoleParams = [CommandParam]
|
type WormHoleParams = [CommandParam]
|
||||||
|
|
||||||
|
-- | An appid should be provided when using wormhole in an app, to avoid
|
||||||
|
-- using the same channel space as ad-hoc wormhole users.
|
||||||
|
appId :: String -> WormHoleParams
|
||||||
|
appId s = [Param "--appid", Param s]
|
||||||
|
|
||||||
-- | Sends a file. Once the send is underway, and the Code has been
|
-- | Sends a file. Once the send is underway, and the Code has been
|
||||||
-- generated, it will be sent to the CodeObserver. (This may not happen,
|
-- generated, it will be sent to the CodeObserver. (This may not happen,
|
||||||
-- eg if there's a network problem).
|
-- eg if there's a network problem).
|
||||||
|
|
|
@ -21,4 +21,4 @@ I haven't run git-annex's onion setup feature directly, but I'm reading through
|
||||||
|
|
||||||
It looks pretty amazing! Looking forward to using it in a Dropbox-like synchronization context soon.
|
It looks pretty amazing! Looking forward to using it in a Dropbox-like synchronization context soon.
|
||||||
|
|
||||||
|
> I've gone with the 2021-12-31 flag day approach. [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue