Use default-extensions in cabal

Former-commit-id: bc12a795326740f2f7504c77e6efdd4a633d6a8e
Former-commit-id: 206c1715e5164d8485423905848e545eecb2a220 [formerly 5ef346e51622358e3e9d4c6e94e348758fac361f [formerly 5ef346e51622358e3e9d4c6e94e348758fac361f [formerly 5ef346e51622358e3e9d4c6e94e348758fac361f [formerly 3d9f6a38a164185f31d5610b045744b79190087b]]]]
Former-commit-id: 73593f34778fd5c5be7436189d48b72fc8699a0e
Former-commit-id: b82bb6c8a4286f6c8b37331cecdd3de699771e90
Former-commit-id: fa5ef7ed8fb050a4fb24f18a5101faa10b72e4a2
Former-commit-id: 11138952c09bf43fccc5dc2dc8625c83b4d3dbdb [formerly 382271cf86238cf125c05867c60c53fef176955a]
Former-commit-id: e452e246198248849d76ee37f0e20a6ce507a855
This commit is contained in:
Erèbe 2016-10-09 20:54:08 +02:00
parent 7195336f6b
commit cde2afd264
8 changed files with 13 additions and 24 deletions

View file

@ -1,12 +1,13 @@
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-cse #-} {-# OPTIONS_GHC -fno-cse #-}
module Main where module Main where
import ClassyPrelude hiding (getArgs, head)
import ClassyPrelude (ByteString, guard, readMay)
import qualified Data.ByteString.Char8 as BC import qualified Data.ByteString.Char8 as BC
import Data.List (head, (!!))
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import System.Console.CmdArgs import System.Console.CmdArgs
import System.Environment (getArgs, withArgs) import System.Environment (getArgs, withArgs)
@ -71,7 +72,7 @@ cmdLine = WsTunnel
toPort :: String -> Int toPort :: String -> Int
toPort str = case readMay str of toPort str = case readMay str of
Just por -> por Just por -> por
Nothing -> error $ "Invalid port number `" ++ str ++ "`" Nothing -> error $ "Invalid port number `" ++ str ++ "`"
parseServerInfo :: WsServerInfo -> String -> WsServerInfo parseServerInfo :: WsServerInfo -> String -> WsServerInfo
parseServerInfo server [] = server parseServerInfo server [] = server
@ -131,7 +132,7 @@ main = do
if serverMode cfg 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) >> runServer (Main.useTls serverInfo) (Main.host serverInfo, fromIntegral $ Main.port serverInfo) (parseRestrictTo $ restrictTo cfg)
else if not $ null (localToRemote cfg) else if not $ null (localToRemote cfg)
then let (TunnelInfo lHost lPort rHost rPort) = parseTunnelInfo (localToRemote cfg) then let (TunnelInfo lHost lPort rHost rPort) = parseTunnelInfo (localToRemote cfg)

View file

@ -1,4 +1,3 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Credentials where module Credentials where

View file

@ -1,5 +1,3 @@
{-# LANGUAGE NoImplicitPrelude #-}
module Logger where module Logger where
import ClassyPrelude import ClassyPrelude
@ -11,9 +9,9 @@ data Verbosity = QUIET | VERBOSE | NORMAL
init :: Verbosity -> IO () init :: Verbosity -> IO ()
init lvl = LOG.updateGlobalLogger "wstunnel" $ case lvl of init lvl = LOG.updateGlobalLogger "wstunnel" $ case lvl of
QUIET -> LOG.setLevel LOG.ERROR QUIET -> LOG.setLevel LOG.ERROR
VERBOSE -> LOG.setLevel LOG.DEBUG VERBOSE -> LOG.setLevel LOG.DEBUG
NORMAL -> LOG.setLevel LOG.INFO NORMAL -> LOG.setLevel LOG.INFO
toStr :: (HostName, PortNumber) -> String toStr :: (HostName, PortNumber) -> String
toStr (host, port) = fromString host <> ":" <> show port toStr (host, port) = fromString host <> ":" <> show port

View file

@ -1,8 +1,5 @@
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Protocols where module Protocols where

View file

@ -2,11 +2,8 @@
{-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
module Socks5 where module Socks5 where

View file

@ -1,9 +1,5 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Tunnel module Tunnel
@ -279,5 +275,3 @@ propagateWrites :: Connection -> Connection -> IO ()
propagateWrites hTunnel hOther = do propagateWrites hTunnel hOther = do
payload <- fromJust <$> read hOther payload <- fromJust <$> read hOther
unless (null payload) (write hTunnel payload >> propagateWrites hTunnel hOther) unless (null payload) (write hTunnel payload >> propagateWrites hTunnel hOther)

View file

@ -1,7 +1,5 @@
{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneDeriving #-}

View file

@ -16,6 +16,7 @@ cabal-version: >=1.10
library library
hs-source-dirs: src hs-source-dirs: src
exposed-modules: Tunnel, Protocols, Types, Logger, Socks5, Credentials exposed-modules: Tunnel, Protocols, Types, Logger, Socks5, Credentials
default-extensions: NoImplicitPrelude, ScopedTypeVariables, BangPatterns, RecordWildCards
build-depends: async build-depends: async
, base , base
, base64-bytestring >= 1.0 , base64-bytestring >= 1.0
@ -37,7 +38,11 @@ library
executable wstunnel executable wstunnel
hs-source-dirs: app hs-source-dirs: app
main-is: Main.hs 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 build-depends: base
, bytestring , bytestring
, classy-prelude , classy-prelude