Fix stdio support #39

Former-commit-id: 246f55f584386261c60b3fee45e5efad98e790c3
Former-commit-id: bf287dec2a7468f0b253a024cac8b29ee3342bee [formerly 8176e5d0f3ef5144d2d01ba5f4b81d481be22b2f] [formerly e17da24300ea7102d78efa1255e416b8e7b67375 [formerly 1cdc5f6b4861456b79e39623c460c838bd6e7694 [formerly 1cdc5f6b4861456b79e39623c460c838bd6e7694 [formerly 1cdc5f6b4861456b79e39623c460c838bd6e7694 [formerly 4d081fcee59b8792745920c53d40eb1ec7c54ae8]]]]]
Former-commit-id: 90d0d845d9c305199f1e0364dbafcfe6bd81e882 [formerly d155d83a30a656fea2296629fac8d9e30ea99888]
Former-commit-id: 1fbff0cbcafe6e32d72d34f5892fd68641da15c5
Former-commit-id: d3dd64e785bb151d9cd7e76e50b519a74fa19b4b
Former-commit-id: 6532a7f8583cd4461298fa4c8d1277e6ce656160
Former-commit-id: 3039e574018bf5af261f19653509ac399d286f8e [formerly 7d9f3cdd94d34d24efb81ad831432570327bf24c]
Former-commit-id: 3bca307bbaf0cf6e98e4c725076df3c97472b639
This commit is contained in:
Romain GÉRARD 2020-02-24 22:52:42 +01:00
parent 0e51c51cfb
commit 71019e413b

View file

@ -192,7 +192,10 @@ runApp cfg serverInfo
-- -L localToRemote tunnels -- -L localToRemote tunnels
| not . null $ localToRemote cfg = do | not . null $ localToRemote cfg = do
let tunnelInfos = parseTunnelInfo <$> localToRemote cfg let tunnelInfos = parseTunnelInfo <$> localToRemote cfg
let tunnelSettings = tunnelInfos >>= \tunnelInfo -> [toTcpLocalToRemoteTunnelSetting cfg serverInfo tunnelInfo, toUdpLocalToRemoteTunnelSetting cfg serverInfo tunnelInfo] let tunnelSettings = tunnelInfos >>= \tunnelInfo ->
if Main.localPort tunnelInfo == 0 then [toStdioLocalToRemoteTunnelSetting cfg serverInfo tunnelInfo]
else if udpMode cfg then [toUdpLocalToRemoteTunnelSetting cfg serverInfo tunnelInfo]
else [toTcpLocalToRemoteTunnelSetting cfg serverInfo tunnelInfo]
Async.mapConcurrently_ runClient tunnelSettings Async.mapConcurrently_ runClient tunnelSettings
-- -D dynamicToRemote tunnels -- -D dynamicToRemote tunnels
@ -204,6 +207,22 @@ runApp cfg serverInfo
putStrLn "Cannot parse correctly the command line. Please fill an issue" putStrLn "Cannot parse correctly the command line. Please fill an issue"
where where
toStdioLocalToRemoteTunnelSetting cfg serverInfo (TunnelInfo lHost lPort rHost rPort) =
TunnelSettings {
localBind = lHost
, Types.localPort = fromIntegral lPort
, serverHost = Main.host serverInfo
, serverPort = fromIntegral $ Main.port serverInfo
, destHost = rHost
, destPort = fromIntegral rPort
, Types.useTls = Main.useTls serverInfo
, protocol = STDIO
, proxySetting = parseProxyInfo (proxy cfg)
, useSocks = False
, upgradePrefix = pathPrefix cfg
, udpTimeout = Main.udpTimeout cfg
}
toTcpLocalToRemoteTunnelSetting cfg serverInfo (TunnelInfo lHost lPort rHost rPort) = toTcpLocalToRemoteTunnelSetting cfg serverInfo (TunnelInfo lHost lPort rHost rPort) =
TunnelSettings { TunnelSettings {
localBind = lHost localBind = lHost