fix tests
Former-commit-id: 3c1a21d65244abf3246e613894e87b8003cf0b0d Former-commit-id: 7bc826fe1639e801bed796b98b335a17a895534a [formerly d60d7601d0bc507981a324ab9409c714da95704d] [formerly 867e778fb88d3613ca9f15664a220dcef968b916 [formerly ebdd8bd6976374edc4b90380c6ab0170767365e4 [formerly ebdd8bd6976374edc4b90380c6ab0170767365e4 [formerly 8857bded398e0483a2c05a7151ee10bc6a924090]] [formerly ebdd8bd6976374edc4b90380c6ab0170767365e4 [formerly 8857bded398e0483a2c05a7151ee10bc6a924090] [formerly 8857bded398e0483a2c05a7151ee10bc6a924090 [formerly e10ed5b7830b0d92e6a02fc2b014911391c069a8]]]]] Former-commit-id: 8ce3d6efb0bd0a736ab8b26863500c97ae74b326 [formerly ffb58efa8e318ec077393824e3b78fa584122323] Former-commit-id: f35c65a8dc1a03257ac808f9db49ec637256432b Former-commit-id: c6b92d91ee088509fe4c04bfd8b3cb120fbdee7d Former-commit-id: a320429f1e660d218c87a570202337c1648f2645 Former-commit-id: c69b9ac920eb12fc7545017c085c0f15994448ca [formerly 6a5abade9fd1f7250558a9bc653e2e9a151ab173] Former-commit-id: 080d2f5fa42ded6e2fa74ae5325ee62025773c64
This commit is contained in:
parent
798a57d81b
commit
395411a4b7
3 changed files with 14 additions and 6 deletions
|
@ -200,8 +200,9 @@ runTlsTunnelingServer (tlsCert, tlsKey) endPoint@(bindTo, portNumber) isAllowed
|
|||
where
|
||||
runApp :: N.AppData -> WS.ConnectionOptions -> WS.ServerApp -> IO ()
|
||||
runApp appData opts app = do
|
||||
let socket = fromJust $ N.appRawSocket appData
|
||||
stream <- WS.makeStream (N.recv socket defaultRecvBufferSize <&> \payload -> if payload == mempty then Nothing else Just payload) (NL.sendAll socket . fromJust)
|
||||
stream <- WS.makeStream (N.appRead appData <&> \payload -> if payload == mempty then Nothing else Just payload) (N.appWrite appData . toStrict . fromJust)
|
||||
--let socket = fromJust $ N.appRawSocket appData
|
||||
--stream <- WS.makeStream (N.recv socket defaultRecvBufferSize <&> \payload -> if payload == mempty then Nothing else Just payload) (NL.sendAll socket . fromJust)
|
||||
bracket (WS.makePendingConnectionFromStream stream opts)
|
||||
(\conn -> catch (WS.close $ WS.pendingStream conn) (\(_ :: SomeException) -> return ()))
|
||||
app
|
||||
|
|
13
test/Spec.hs
13
test/Spec.hs
|
@ -21,6 +21,7 @@ import Data.Binary (decode, encode)
|
|||
import Tunnel
|
||||
import Types
|
||||
import Protocols
|
||||
import Credentials
|
||||
import qualified Socks5 as Socks5
|
||||
|
||||
testTCPLocalToRemote :: Bool -> IO ()
|
||||
|
@ -33,7 +34,8 @@ testTCPLocalToRemote useTLS = do
|
|||
|
||||
-- SERVER
|
||||
let serverPort = 8080
|
||||
let serverWithoutTLS = runServer useTLS ("0.0.0.0", serverPort) (const True)
|
||||
let tls = if useTLS then Just (Credentials.certificate, Credentials.key) else Nothing
|
||||
let serverWithoutTLS = runServer tls ("0.0.0.0", serverPort) (const True)
|
||||
|
||||
-- CLIENT
|
||||
let tunnelSetting = TunnelSettings {
|
||||
|
@ -54,6 +56,7 @@ testTCPLocalToRemote useTLS = do
|
|||
, tlsSNI = "toto.com"
|
||||
, websocketPingFrequencySec = 30
|
||||
, customHeaders = [(CI.mk "toto", "tata"), (CI.mk "titi", "tutu")]
|
||||
, tlsVerifyCertificate = False
|
||||
}
|
||||
let client = runClient tunnelSetting
|
||||
|
||||
|
@ -95,7 +98,8 @@ testUDPLocalToRemote useTLS = do
|
|||
|
||||
-- SERVER
|
||||
let serverPort = 8080
|
||||
let serverWithoutTLS = runServer useTLS ("0.0.0.0", serverPort) (const True)
|
||||
let tls = if useTLS then Just (Credentials.certificate, Credentials.key) else Nothing
|
||||
let serverWithoutTLS = runServer tls ("0.0.0.0", serverPort) (const True)
|
||||
|
||||
-- CLIENT
|
||||
let tunnelSetting = TunnelSettings {
|
||||
|
@ -116,6 +120,7 @@ testUDPLocalToRemote useTLS = do
|
|||
, tlsSNI = "toto.com"
|
||||
, websocketPingFrequencySec = 30
|
||||
, customHeaders = [(CI.mk "toto", "tata"), (CI.mk "titi", "tutu")]
|
||||
, tlsVerifyCertificate = False
|
||||
}
|
||||
let client = runClient tunnelSetting
|
||||
|
||||
|
@ -156,7 +161,8 @@ testSocks5Tunneling useTLS = do
|
|||
|
||||
-- SERVER
|
||||
let serverPort = 8080
|
||||
let serverWithoutTLS = runServer useTLS ("0.0.0.0", serverPort) (const True)
|
||||
let tls = if useTLS then Just (Credentials.certificate, Credentials.key) else Nothing
|
||||
let serverWithoutTLS = runServer tls ("0.0.0.0", serverPort) (const True)
|
||||
|
||||
-- CLIENT
|
||||
let tunnelSetting = TunnelSettings {
|
||||
|
@ -177,6 +183,7 @@ testSocks5Tunneling useTLS = do
|
|||
, tlsSNI = "toto.com"
|
||||
, websocketPingFrequencySec = 30
|
||||
, customHeaders = [(CI.mk "toto", "tata"), (CI.mk "titi", "tutu")]
|
||||
, tlsVerifyCertificate = False
|
||||
}
|
||||
let client = runClient tunnelSetting
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: wstunnel
|
||||
version: 0.5.0.0
|
||||
version: 0.5.1.0
|
||||
synopsis: Tunneling program over websocket protocol
|
||||
description: For more information regarding wstunnel, please refer to README.md
|
||||
homepage: https://github.com/githubuser/wstunnel#readme
|
||||
|
|
Loading…
Reference in a new issue