1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
-- |
-- Module : Network.Socks5.Conf
-- License : BSD-style
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
-- Stability : experimental
-- Portability : unknown
--
-- typical SOCKS configuration
module Network.Socks5.Conf
( SocksConf(..)
, socksHost
, defaultSocksConf
, defaultSocksConfFromSockAddr
) where
import Network.Socket
import Network.Socks5.Types (SocksVersion(..))
-- | SOCKS identification and configuration structure.
--
-- this structure will be extended in future to support authentification.
-- use defaultSocksConf to create new record.
data SocksConf = SocksConf
{ socksServer :: SockAddr -- ^ Address of server
, socksVersion :: SocksVersion -- ^ SOCKS version to use
}
-- | SOCKS Host
socksHost :: SocksConf -> SockAddr
socksHost conf = socksServer conf
-- | defaultSocksConf create a new record, making sure
-- API remains compatible when the record is extended.
defaultSocksConf :: SockAddr -> SocksConf
defaultSocksConf host = SocksConf host SocksVer5
-- | same as defaultSocksConf.
--
-- soft deprecation: use 'defaultSocksConf"
defaultSocksConfFromSockAddr = defaultSocksConf
|