dprox 0.4.0 → 0.4.1
raw patch · 4 files changed
+4/−23 lines, 4 filesdep −unix
Dependencies removed: unix
Files
- README.md +1/−3
- dprox.cabal +1/−3
- src/Config.hs +2/−10
- src/Main.hs +0/−7
README.md view
@@ -14,8 +14,7 @@ ### Installation -`dprox` should build and work on all unix-like OS with [ghc](https://www.haskell.org/ghc/) support, but it's only-been tested on Linux and macOS.+`dprox` should build and work on all unix-like OS with [ghc](https://www.haskell.org/ghc/) support, as well as Windows. While `dprox` can be built with [cabal](https://www.haskell.org/cabal/) like any other Hackage packages, for a reliable compilation with pinned dependencies, [stack](https://docs.haskellstack.org/en/stable/README/#how-to-install) is generally recommended.@@ -35,7 +34,6 @@ Here is the list of implemented dnsmasq options (with `server`, `local`, `address` and `bogus-nxdomain` options allowed in configuration file): ```--u, --user=<username> -p, --port=<port> -a, --listen-address=<ipaddr> -C, --conf-file=<file>
dprox.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: dprox-version: 0.4.0+version: 0.4.1 synopsis: a lightweight DNS proxy server, compatible with dnsmasq-china-list description: Please see the README on GitHub at <https://github.com/bjin/dprox#readme> category: DNS@@ -58,7 +58,6 @@ , psqueues >=0.2.3 , streaming-commons >=0.2 , time >=1.8- , unix >=2.7 default-language: Haskell2010 if flag(static) ghc-options: -optl-static@@ -90,7 +89,6 @@ , psqueues >=0.2.3 , streaming-commons >=0.2 , time >=1.8- , unix >=2.7 default-language: Haskell2010 if flag(static) ghc-options: -optl-static
src/Config.hs view
@@ -34,8 +34,7 @@ import Paths_dprox data GlobalConfig = GlobalConfig- { setUser :: Maybe String- , localPort :: Maybe PortNumber+ { localPort :: Maybe PortNumber , listenAddress :: Maybe HostPreference , cacheSize :: Int , cacheTTL :: DNS.TTL@@ -171,8 +170,7 @@ invalidIPAddress = "::" globalOption :: Parser GlobalConfig-globalOption = GlobalConfig <$> userOption- <*> portOption+globalOption = GlobalConfig <$> portOption <*> listenOption <*> cacheOption <*> ttlOption@@ -180,12 +178,6 @@ <*> ipsetMatchOption <*> ipsetServerOption where- userOption = optional $ strOption- ( long "user"- <> short 'u'- <> metavar "<username>"- <> help "Specify the userid to which dprox will change after startup")- portOption = optional $ option auto ( long "port" <> short 'p'
src/Main.hs view
@@ -21,8 +21,6 @@ import Data.Version (showVersion) import Network.DNS qualified as DNS import Network.Socket.ByteString (recvFrom, sendTo)-import System.Posix.User- (UserEntry (..), getUserEntryForName, setUserID) import Config import DomainRoute@@ -161,9 +159,6 @@ return (Right (ttl, v)) return process -setuid :: String -> IO ()-setuid user = getUserEntryForName user >>= setUserID . userID- main :: IO () main = getConfig >>= \(GlobalConfig{..}, conf) -> withLogger (LogStdout 4096) loglevel $ \logger -> do logger INFO $ "dprox " <> toLogStr (showVersion version) <> " started"@@ -214,8 +209,6 @@ logger INFO $ "creating resolver: " <> toLogStr (show $ fst k) <> ":" <> toLogStr (show $ snd k) rs <- DNS.makeResolvSeed v return (k, rs)-- F.mapM_ setuid setUser resolverCache <- makeResolverCache cacheSize cacheTTL ipsetCache <- newCache 4096 maxBound