-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Socks proxy (ver 5) -- -- Socks proxy (version 5) implementation. @package socks @version 0.6.1 module Network.Socks5.Types -- | Socks Version data SocksVersion SocksVer5 :: SocksVersion -- | Command that can be send and receive on the SOCKS protocol data SocksCommand SocksCommandConnect :: SocksCommand SocksCommandBind :: SocksCommand SocksCommandUdpAssociate :: SocksCommand SocksCommandOther :: !Word8 -> SocksCommand -- | Authentication methods available on the SOCKS protocol. -- -- Only SocksMethodNone is effectively implemented, but other value are -- enumerated for completeness. data SocksMethod SocksMethodNone :: SocksMethod SocksMethodGSSAPI :: SocksMethod SocksMethodUsernamePassword :: SocksMethod SocksMethodOther :: !Word8 -> SocksMethod SocksMethodNotAcceptable :: SocksMethod -- | A Host address on the SOCKS protocol. data SocksHostAddress SocksAddrIPV4 :: !HostAddress -> SocksHostAddress SocksAddrDomainName :: !FQDN -> SocksHostAddress SocksAddrIPV6 :: !HostAddress6 -> SocksHostAddress -- | Describe a Socket address on the SOCKS protocol data SocksAddress SocksAddress :: !SocksHostAddress -> !PortNumber -> SocksAddress -- | Type of reply on the SOCKS protocol data SocksReply SocksReplySuccess :: SocksReply SocksReplyError :: SocksError -> SocksReply -- | Exception returned when using a SOCKS version that is not supported. -- -- This package only implement version 5. data SocksVersionNotSupported SocksVersionNotSupported :: SocksVersionNotSupported -- | SOCKS error that can be received or sent data SocksError SocksErrorGeneralServerFailure :: SocksError SocksErrorConnectionNotAllowedByRule :: SocksError SocksErrorNetworkUnreachable :: SocksError SocksErrorHostUnreachable :: SocksError SocksErrorConnectionRefused :: SocksError SocksErrorTTLExpired :: SocksError SocksErrorCommandNotSupported :: SocksError SocksErrorAddrTypeNotSupported :: SocksError SocksErrorOther :: Word8 -> SocksError instance Data.Data.Data Network.Socks5.Types.SocksVersionNotSupported instance GHC.Show.Show Network.Socks5.Types.SocksVersionNotSupported instance Data.Data.Data Network.Socks5.Types.SocksReply instance GHC.Classes.Ord Network.Socks5.Types.SocksReply instance GHC.Classes.Eq Network.Socks5.Types.SocksReply instance GHC.Show.Show Network.Socks5.Types.SocksReply instance Data.Data.Data Network.Socks5.Types.SocksError instance GHC.Classes.Ord Network.Socks5.Types.SocksError instance GHC.Classes.Eq Network.Socks5.Types.SocksError instance GHC.Show.Show Network.Socks5.Types.SocksError instance GHC.Classes.Ord Network.Socks5.Types.SocksAddress instance GHC.Classes.Eq Network.Socks5.Types.SocksAddress instance GHC.Show.Show Network.Socks5.Types.SocksAddress instance GHC.Classes.Ord Network.Socks5.Types.SocksHostAddress instance GHC.Classes.Eq Network.Socks5.Types.SocksHostAddress instance GHC.Classes.Ord Network.Socks5.Types.SocksMethod instance GHC.Classes.Eq Network.Socks5.Types.SocksMethod instance GHC.Show.Show Network.Socks5.Types.SocksMethod instance GHC.Classes.Ord Network.Socks5.Types.SocksCommand instance GHC.Classes.Eq Network.Socks5.Types.SocksCommand instance GHC.Show.Show Network.Socks5.Types.SocksCommand instance GHC.Classes.Ord Network.Socks5.Types.SocksVersion instance GHC.Classes.Eq Network.Socks5.Types.SocksVersion instance GHC.Show.Show Network.Socks5.Types.SocksVersion instance GHC.Exception.Type.Exception Network.Socks5.Types.SocksVersionNotSupported instance GHC.Enum.Enum Network.Socks5.Types.SocksReply instance GHC.Exception.Type.Exception Network.Socks5.Types.SocksError instance GHC.Enum.Enum Network.Socks5.Types.SocksError instance GHC.Show.Show Network.Socks5.Types.SocksHostAddress instance GHC.Enum.Enum Network.Socks5.Types.SocksMethod instance GHC.Enum.Enum Network.Socks5.Types.SocksCommand module Network.Socks5.Lowlevel socksListen :: Socket -> IO SocksRequest -- | Initial message sent by client with the list of authentification -- methods supported data SocksHello SocksHello :: [SocksMethod] -> SocksHello [getSocksHelloMethods] :: SocksHello -> [SocksMethod] -- | Initial message send by server in return from Hello, with the server -- chosen method of authentication data SocksHelloResponse SocksHelloResponse :: SocksMethod -> SocksHelloResponse [getSocksHelloResponseMethod] :: SocksHelloResponse -> SocksMethod -- | Define a SOCKS requests data SocksRequest SocksRequest :: SocksCommand -> SocksHostAddress -> PortNumber -> SocksRequest [requestCommand] :: SocksRequest -> SocksCommand [requestDstAddr] :: SocksRequest -> SocksHostAddress [requestDstPort] :: SocksRequest -> PortNumber -- | Define a SOCKS response data SocksResponse SocksResponse :: SocksReply -> SocksHostAddress -> PortNumber -> SocksResponse [responseReply] :: SocksResponse -> SocksReply [responseBindAddr] :: SocksResponse -> SocksHostAddress [responseBindPort] :: SocksResponse -> PortNumber establish :: SocksVersion -> Socket -> [SocksMethod] -> IO SocksMethod newtype Connect Connect :: SocksAddress -> Connect class Command a toRequest :: Command a => a -> SocksRequest fromRequest :: Command a => SocksRequest -> Maybe a connectIPV4 :: Socket -> HostAddress -> PortNumber -> IO (HostAddress, PortNumber) connectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber) connectDomainName :: Socket -> [Char] -> PortNumber -> IO (SocksHostAddress, PortNumber) rpc :: Command a => Socket -> a -> IO (Either SocksError (SocksHostAddress, PortNumber)) rpc_ :: Command a => Socket -> a -> IO (SocksHostAddress, PortNumber) sendSerialized :: Serialize a => Socket -> a -> IO () waitSerialized :: Serialize a => Socket -> IO a -- | This is an implementation of SOCKS5 as defined in RFC 1928 -- -- In Wikipedia's words: -- -- SOCKet Secure (SOCKS) is an Internet protocol that routes network -- packets between a client and server through a proxy server. SOCKS5 -- additionally provides authentication so only authorized users may -- access a server. Practically, a SOCKS server will proxy TCP -- connections to an arbitrary IP address as well as providing a means -- for UDP packets to be forwarded. -- -- BIND and UDP ASSOCIATE messages are not implemented. However main -- usage of SOCKS is covered in this implementation. module Network.Socks5 -- | Describe a Socket address on the SOCKS protocol data SocksAddress SocksAddress :: !SocksHostAddress -> !PortNumber -> SocksAddress -- | A Host address on the SOCKS protocol. data SocksHostAddress SocksAddrIPV4 :: !HostAddress -> SocksHostAddress SocksAddrDomainName :: !FQDN -> SocksHostAddress SocksAddrIPV6 :: !HostAddress6 -> SocksHostAddress -- | Type of reply on the SOCKS protocol data SocksReply SocksReplySuccess :: SocksReply SocksReplyError :: SocksError -> SocksReply -- | SOCKS error that can be received or sent data SocksError SocksErrorGeneralServerFailure :: SocksError SocksErrorConnectionNotAllowedByRule :: SocksError SocksErrorNetworkUnreachable :: SocksError SocksErrorHostUnreachable :: SocksError SocksErrorConnectionRefused :: SocksError SocksErrorTTLExpired :: SocksError SocksErrorCommandNotSupported :: SocksError SocksErrorAddrTypeNotSupported :: SocksError SocksErrorOther :: Word8 -> SocksError -- | SOCKS identification and configuration structure. -- -- this structure will be extended in future to support authentification. -- use defaultSocksConf to create new record. data SocksConf SocksConf :: SockAddr -> SocksVersion -> SocksConf -- | Address of server [socksServer] :: SocksConf -> SockAddr -- | SOCKS version to use [socksVersion] :: SocksConf -> SocksVersion -- | SOCKS Host socksHost :: SocksConf -> SockAddr -- | defaultSocksConf create a new record, making sure API remains -- compatible when the record is extended. defaultSocksConf :: SockAddr -> SocksConf -- | same as defaultSocksConf. -- -- soft deprecation: use 'defaultSocksConf" defaultSocksConfFromSockAddr :: SockAddr -> SocksConf -- | connect a user specified new socket on the socks server to a -- destination -- -- The socket in parameter needs to be already connected to the socks -- server -- -- -- |socket|-----sockServer----->|server|----destAddr----->|destination| socksConnectWithSocket :: Socket -> SocksConf -> SocksAddress -> IO (SocksHostAddress, PortNumber) -- | connect a new socket to a socks server and connect the stream on the -- server side to the SocksAddress specified. socksConnect :: SocksConf -> SocksAddress -> IO (Socket, (SocksHostAddress, PortNumber)) -- | connect a new socket to the socks server, and connect the stream to a -- FQDN resolved on the server side. -- -- The socket needs to *not* be already connected. -- -- The destination need to be an ASCII string, otherwise unexpected -- behavior will ensue. For unicode destination, punycode encoding should -- be used. socksConnectName :: Socket -> SocksConf -> String -> PortNumber -> IO ()