diff --git a/app/Main.hs b/app/Main.hs index 5bc48a2..324ab53 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,12 +1,13 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-cse #-} module Main where - -import ClassyPrelude (ByteString, guard, readMay) +import ClassyPrelude hiding (getArgs, head) import qualified Data.ByteString.Char8 as BC +import Data.List (head, (!!)) import Data.Maybe (fromMaybe) import System.Console.CmdArgs import System.Environment (getArgs, withArgs) @@ -71,7 +72,7 @@ cmdLine = WsTunnel toPort :: String -> Int toPort str = case readMay str of Just por -> por - Nothing -> error $ "Invalid port number `" ++ str ++ "`" + Nothing -> error $ "Invalid port number `" ++ str ++ "`" parseServerInfo :: WsServerInfo -> String -> WsServerInfo parseServerInfo server [] = server @@ -131,7 +132,7 @@ main = do if serverMode cfg - then putStrLn ("Starting server with opts " ++ show serverInfo ) + then putStrLn ("Starting server with opts " <> tshow serverInfo ) >> runServer (Main.useTls serverInfo) (Main.host serverInfo, fromIntegral $ Main.port serverInfo) (parseRestrictTo $ restrictTo cfg) else if not $ null (localToRemote cfg) then let (TunnelInfo lHost lPort rHost rPort) = parseTunnelInfo (localToRemote cfg) diff --git a/src/Credentials.hs b/src/Credentials.hs index d5ba8fe..fc12027 100644 --- a/src/Credentials.hs +++ b/src/Credentials.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} module Credentials where diff --git a/src/Logger.hs b/src/Logger.hs index c5b53a5..89a08c0 100644 --- a/src/Logger.hs +++ b/src/Logger.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE NoImplicitPrelude #-} - module Logger where import ClassyPrelude @@ -11,9 +9,9 @@ data Verbosity = QUIET | VERBOSE | NORMAL init :: Verbosity -> IO () init lvl = LOG.updateGlobalLogger "wstunnel" $ case lvl of - QUIET -> LOG.setLevel LOG.ERROR + QUIET -> LOG.setLevel LOG.ERROR VERBOSE -> LOG.setLevel LOG.DEBUG - NORMAL -> LOG.setLevel LOG.INFO + NORMAL -> LOG.setLevel LOG.INFO toStr :: (HostName, PortNumber) -> String toStr (host, port) = fromString host <> ":" <> show port diff --git a/src/Protocols.hs b/src/Protocols.hs index 72464dc..d9f1dbe 100644 --- a/src/Protocols.hs +++ b/src/Protocols.hs @@ -1,8 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ScopedTypeVariables #-} module Protocols where diff --git a/src/Socks5.hs b/src/Socks5.hs index c9d5ae3..21cd282 100644 --- a/src/Socks5.hs +++ b/src/Socks5.hs @@ -2,11 +2,8 @@ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StrictData #-} module Socks5 where diff --git a/src/Tunnel.hs b/src/Tunnel.hs index d4f58a2..3e71f61 100644 --- a/src/Tunnel.hs +++ b/src/Tunnel.hs @@ -1,9 +1,5 @@ -{-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ScopedTypeVariables #-} module Tunnel @@ -279,5 +275,3 @@ propagateWrites :: Connection -> Connection -> IO () propagateWrites hTunnel hOther = do payload <- fromJust <$> read hOther unless (null payload) (write hTunnel payload >> propagateWrites hTunnel hOther) - - diff --git a/src/Types.hs b/src/Types.hs index 19b83e9..debb4cc 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -1,7 +1,5 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StandaloneDeriving #-} diff --git a/wstunnel.cabal b/wstunnel.cabal index 8f43db9..75d470f 100644 --- a/wstunnel.cabal +++ b/wstunnel.cabal @@ -16,6 +16,7 @@ cabal-version: >=1.10 library hs-source-dirs: src exposed-modules: Tunnel, Protocols, Types, Logger, Socks5, Credentials + default-extensions: NoImplicitPrelude, ScopedTypeVariables, BangPatterns, RecordWildCards build-depends: async , base , base64-bytestring >= 1.0 @@ -37,7 +38,11 @@ library executable wstunnel hs-source-dirs: app main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N + default-extensions: NoImplicitPrelude, ScopedTypeVariables, BangPatterns, RecordWildCards + ghc-options: -threaded + -rtsopts + "-with-rtsopts=-N" + -g build-depends: base , bytestring , classy-prelude