Refactor to modularize more
Former-commit-id: 1d5ae90a514e575706d5a4ed333cb7bcea613fed Former-commit-id: 9cfc1936086198e0c437346608794694e0e95b90 [formerly 33e7bbb44e5903ddb90b3fe2c0e5555dbc546bd5 [formerly 33e7bbb44e5903ddb90b3fe2c0e5555dbc546bd5 [formerly 33e7bbb44e5903ddb90b3fe2c0e5555dbc546bd5 [formerly c66b2faff45e0b65779d7fed4d3355d859ae8e34]]]] Former-commit-id: 4d38d80a6e1bd03be92f0939f269803676094da4 Former-commit-id: ad7ee33491764b8111037c046f64b5c288cfe420 Former-commit-id: 7089db6838c542c2a278992e492a421303b20707 Former-commit-id: 00f00a4f5296725498aeb0daa8b21cfa4568627e [formerly fd688a2c91cc9c927fd8fa32f7e62dc432286d86] Former-commit-id: 991bfe5b8f959fad26e326877e92f168127f0803
This commit is contained in:
parent
4a704f0bd3
commit
1f923c4943
7 changed files with 218 additions and 196 deletions
app
12
app/Main.hs
12
app/Main.hs
|
@ -4,7 +4,6 @@
|
|||
|
||||
module Main where
|
||||
|
||||
import Tunnel
|
||||
|
||||
import ClassyPrelude (ByteString, guard, readMay)
|
||||
import qualified Data.ByteString.Char8 as BC
|
||||
|
@ -13,6 +12,9 @@ import System.Console.CmdArgs
|
|||
import System.Environment (getArgs, withArgs)
|
||||
import qualified System.Log.Logger as LOG
|
||||
|
||||
import Tunnel
|
||||
import Types
|
||||
|
||||
data WsTunnel = WsTunnel
|
||||
{ localToRemote :: String
|
||||
-- , remoteToLocal :: String
|
||||
|
@ -135,12 +137,12 @@ main = do
|
|||
else if not $ null (localToRemote cfg)
|
||||
then let (TunnelInfo lHost lPort rHost rPort) = parseTunnelInfo (localToRemote cfg)
|
||||
in runClient TunnelSettings { localBind = lHost
|
||||
, Tunnel.localPort = fromIntegral lPort
|
||||
, Types.localPort = fromIntegral lPort
|
||||
, serverHost = Main.host serverInfo
|
||||
, serverPort = fromIntegral $ Main.port serverInfo
|
||||
, destHost = rHost
|
||||
, destPort = fromIntegral rPort
|
||||
, Tunnel.useTls = Main.useTls serverInfo
|
||||
, Types.useTls = Main.useTls serverInfo
|
||||
, protocol = if udpMode cfg then UDP else TCP
|
||||
, proxySetting = parseProxyInfo (proxy cfg)
|
||||
, useSocks = False
|
||||
|
@ -148,12 +150,12 @@ main = do
|
|||
else if not $ null (dynamicToRemote cfg)
|
||||
then let (TunnelInfo lHost lPort _ _) = parseTunnelInfo $ (dynamicToRemote cfg) ++ ":127.0.0.1:1212"
|
||||
in runClient TunnelSettings { localBind = lHost
|
||||
, Tunnel.localPort = fromIntegral lPort
|
||||
, Types.localPort = fromIntegral lPort
|
||||
, serverHost = Main.host serverInfo
|
||||
, serverPort = fromIntegral $ Main.port serverInfo
|
||||
, destHost = ""
|
||||
, destPort = 0
|
||||
, Tunnel.useTls = Main.useTls serverInfo
|
||||
, Types.useTls = Main.useTls serverInfo
|
||||
, protocol = SOCKS5
|
||||
, proxySetting = parseProxyInfo (proxy cfg)
|
||||
, useSocks = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue