remotedaemon: git change detection over tor hidden service
This commit is contained in:
parent
f7687e0876
commit
2c907fff51
8 changed files with 116 additions and 46 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue