-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Socks proxy (version 5) implementation. -- -- Socks proxy (version 5) implementation. @package socks @version 0.5.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 :: !ByteString -> 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 Typeable SocksError instance Typeable SocksReply instance Typeable SocksVersionNotSupported instance Show SocksVersion instance Eq SocksVersion instance Ord SocksVersion instance Show SocksCommand instance Eq SocksCommand instance Ord SocksCommand instance Show SocksMethod instance Eq SocksMethod instance Ord SocksMethod instance Eq SocksHostAddress instance Ord SocksHostAddress instance Show SocksAddress instance Eq SocksAddress instance Ord SocksAddress instance Show SocksError instance Eq SocksError instance Ord SocksError instance Data SocksError instance Show SocksReply instance Eq SocksReply instance Ord SocksReply instance Data SocksReply instance Show SocksVersionNotSupported instance Data SocksVersionNotSupported instance Enum SocksReply instance Enum SocksError instance Enum SocksMethod instance Enum SocksCommand instance Exception SocksVersionNotSupported instance Exception SocksError instance Show SocksHostAddress module Network.Socks5.Lowlevel resolveToSockAddr :: SocksAddress -> IO SockAddr 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 :: 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 -> String -> 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 :: !ByteString -> 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 configuration structure. this structure will be extended in -- future to support authentification. use defaultSocksConf to create new -- record. data SocksConf SocksConf :: SocksAddress -> SocksVersion -> SocksConf -- | SOCKS Address socksServer :: SocksConf -> SocksAddress -- | SOCKS version to use socksVersion :: SocksConf -> SocksVersion -- | SOCKS Host socksHost :: SocksConf -> SocksHostAddress -- | SOCKS Port socksPort :: SocksConf -> PortNumber -- | defaultSocksConf create a new record, making sure API remains -- compatible when the record is extended. defaultSocksConf :: [Char] -> PortNumber -> SocksConf -- | same as defaultSocksConf except the server address is determined from -- a SockAddr -- -- A unix SockAddr will raises an error. Only Inet and Inet6 types -- supported defaultSocksConfFromSockAddr :: SockAddr -> SocksConf -- | connect a user specified new socket to the socks server, and connect -- the stream on the server side to the SockAddress specified. -- -- -- |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 on -- the server side to the sockaddr specified. the sockaddr need to be -- SockAddrInet or SockAddrInet6. -- -- a unix sockaddr will raises an exception. -- -- -- |socket|-----sockServer----->|server|----destAddr----->|destination| -- | Deprecated: use socksConnectWithSocket socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO () -- | connect a new socket to the socks server, and connect the stream to a -- FQDN resolved on the server side. socksConnectName :: Socket -> SockAddr -> String -> PortNumber -> IO () -- | similar to Network connectTo but use a socks proxy with default socks -- configuration. socksConnectTo :: String -> PortID -> String -> PortID -> IO Handle -- | create a new socket and connect in to a destination through the -- specified SOCKS configuration. socksConnectWith :: SocksConf -> String -> PortID -> IO Socket