summaryrefslogtreecommitdiff
path: root/P2P/Address.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-09 16:02:43 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-09 16:02:43 -0400
commit46f3063131f7711208c1134b31caf999e375306d (patch)
tree47ab66581b0d2de95865b0f7948db041f6589935 /P2P/Address.hs
parent1eeae43d88c924dfac7c004ff7aeb67e17c52a13 (diff)
remotedaemon: git change detection over tor hidden service
Diffstat (limited to 'P2P/Address.hs')
-rw-r--r--P2P/Address.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/P2P/Address.hs b/P2P/Address.hs
index 09ffc7973..1b1f66059 100644
--- a/P2P/Address.hs
+++ b/P2P/Address.hs
@@ -37,15 +37,18 @@ class FormatP2PAddress a where
instance FormatP2PAddress P2PAddress where
formatP2PAddress (TorAnnex (OnionAddress onionaddr) onionport) =
- "tor-annex::" ++ onionaddr ++ ":" ++ show onionport
+ torAnnexScheme ++ ":" ++ onionaddr ++ ":" ++ show onionport
unformatP2PAddress s
- | "tor-annex::" `isPrefixOf` s = do
+ | (torAnnexScheme ++ ":") `isPrefixOf` s = do
let s' = dropWhile (== ':') $ dropWhile (/= ':') s
let (onionaddr, ps) = separate (== ':') s'
onionport <- readish ps
return (TorAnnex (OnionAddress onionaddr) onionport)
| otherwise = Nothing
+torAnnexScheme :: String
+torAnnexScheme = "tor-annex:"
+
instance FormatP2PAddress P2PAddressAuth where
formatP2PAddress (P2PAddressAuth addr authtoken) =
formatP2PAddress addr ++ ":" ++ T.unpack (fromAuthToken authtoken)