blob: 8d9dd6f0aabc13599a3d1cc8f8d15590953cbc4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
{- git-annex command
-
- Copyright 2016 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.EnableTor where
import Command
import Utility.Tor
cmd :: Command
cmd = noCommit $ dontCheck repoExists $
command "enable-tor" SectionPlumbing ""
paramNumber (withParams seek)
seek :: CmdParams -> CommandSeek
seek = withWords start
start :: CmdParams -> CommandStart
start (localport:[]) = case readish localport of
Nothing -> error "Bad localport"
Just lp -> do
(onionaddr, onionport) <- liftIO $ addHiddenService lp
liftIO $ putStrLn (onionaddr ++ ":" ++ show onionport)
stop
start _ = error "Need 1 localport parameter"
|