diff --git a/neko-obfs.cabal b/neko-obfs.cabal
--- a/neko-obfs.cabal
+++ b/neko-obfs.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                neko-obfs
-version:             0.1.0.2
+version:             0.1.0.4
 synopsis:            a TCP tunnel with packet length obfuscation
 description:         Just another tool that helps accessing the internet
 license:             Apache-2.0
@@ -25,8 +25,9 @@
                      , Parser
                      , Type
                      , Unsafe
+                     , NetworkHelper
   -- other-extensions:    
-  build-depends:       base >=4.9 && <4.11
+  build-depends:       base >=4.11 && <7
                      , async
                      , attoparsec
                      , binary
diff --git a/src/Helper.hs b/src/Helper.hs
--- a/src/Helper.hs
+++ b/src/Helper.hs
@@ -32,4 +32,3 @@
 log :: MonadIO m => Text -> m ()
 log x = sync - T.putStrLn x
 
-
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -29,8 +29,9 @@
 import           Pipes.Safe
 import           System.Random (randomIO)
 import           Options.Generic
-import System.IO (hSetBuffering, stdin, stdout, BufferMode(LineBuffering))
+import           System.IO (hSetBuffering, stdin, stdout, BufferMode(LineBuffering))
 
+import           NetworkHelper (setSocketCommon)
 import           Options (toConfig)
 import           Parser
 import           Type
@@ -130,11 +131,11 @@
   localThread <- pure -
     runSafeT . runEffect - serve (Host _localHost) _localPort - \(localSock, localSockAddr) -> do
       log - "local accepted: " <> view packed (show localSockAddr)
-      NS.setSocketOption localSock NS.NoDelay 1
+      setSocketCommon localSock
 
       runSafeT . runEffect -
         connect _remoteHost _remotePort - \(remoteSock, remoteSockAddr) -> do
-          liftIO - NS.setSocketOption remoteSock NS.NoDelay 1
+          liftIO - setSocketCommon remoteSock
 
           let
               localPull = _fromSocket localSock _mtu
@@ -159,14 +160,14 @@
   remoteThread <- pure -
     runSafeT . runEffect - serve (Host _remoteHost) _remotePort - \(remoteSock, remoteSockAddr) -> do
       log - "remote accepted: " <> view packed (show remoteSockAddr)
-      NS.setSocketOption remoteSock NS.NoDelay 1
+      setSocketCommon remoteSock
 
       let _forwardHost = config ^. forwardHost . re packed
           _forwardPort = show - config ^. forwardPort
 
       runSafeT . runEffect -
         connect _forwardHost _forwardPort - \(forwardSock, forwardSockAddr) -> do
-          liftIO - NS.setSocketOption forwardSock NS.NoDelay 1
+          liftIO - setSocketCommon forwardSock
 
           let
               remotePull = _fromSocket remoteSock _mtu
diff --git a/src/NetworkHelper.hs b/src/NetworkHelper.hs
new file mode 100644
--- /dev/null
+++ b/src/NetworkHelper.hs
@@ -0,0 +1,10 @@
+-- |
+
+module NetworkHelper where
+
+import qualified Network.Socket as NS
+
+setSocketCommon :: NS.Socket -> IO ()
+setSocketCommon socket = do
+  NS.setSocketOption socket NS.NoDelay 1
+  NS.setSocketOption socket NS.KeepAlive 1
