Copyright | (c) 2010-2019 Vincent Hanquez <vincent@snarc.org> |
---|---|
License | BSD-style |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
Network.Socks5.Lowlevel
Contents
Description
Low level types and functions for interacting with a SOCKS server.
Synopsis
- socksListen :: Socket -> IO SocksRequest
- newtype SocksHello = SocksHello {}
- newtype SocksHelloResponse = SocksHelloResponse {}
- data SocksRequest = SocksRequest {}
- data SocksResponse = SocksResponse {}
- class Command a where
- toRequest :: a -> SocksRequest
- fromRequest :: SocksRequest -> Maybe a
- newtype Connect = Connect SocksAddress
- establish :: SocksVersion -> Socket -> [SocksMethod] -> IO SocksMethod
- rpc_ :: Command a => Socket -> a -> IO (SocksHostAddress, PortNumber)
- 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))
- sendSerialized :: Serialize a => Socket -> a -> IO ()
- waitSerialized :: Serialize a => Socket -> IO a
Documentation
Arguments
:: Socket | The socket to use. |
-> IO SocksRequest |
For the specified socket, wait for a SOCKS Hello, send a SOCKS Hello response (specifying no authentification method), and wait for a SOCKS request.
Low level types and functions
newtype SocksHello Source #
Type representing initial messages sent by a client with the list of authentification methods supported.
Constructors
SocksHello | |
Fields |
Instances
Show SocksHello Source # | |
Defined in Network.Socks5.Wire Methods showsPrec :: Int -> SocksHello -> ShowS # show :: SocksHello -> String # showList :: [SocksHello] -> ShowS # | |
Serialize SocksHello Source # | |
Defined in Network.Socks5.Wire | |
Eq SocksHello Source # | |
Defined in Network.Socks5.Wire |
newtype SocksHelloResponse Source #
Type representing initial messages sent by a server in response to Hello, with the server's chosen method of authentication.
Constructors
SocksHelloResponse | |
Fields |
Instances
Show SocksHelloResponse Source # | |
Defined in Network.Socks5.Wire Methods showsPrec :: Int -> SocksHelloResponse -> ShowS # show :: SocksHelloResponse -> String # showList :: [SocksHelloResponse] -> ShowS # | |
Serialize SocksHelloResponse Source # | |
Defined in Network.Socks5.Wire | |
Eq SocksHelloResponse Source # | |
Defined in Network.Socks5.Wire Methods (==) :: SocksHelloResponse -> SocksHelloResponse -> Bool # (/=) :: SocksHelloResponse -> SocksHelloResponse -> Bool # |
data SocksRequest Source #
Type representing SOCKS requests.
Constructors
SocksRequest | |
Fields |
Instances
Show SocksRequest Source # | |
Defined in Network.Socks5.Wire Methods showsPrec :: Int -> SocksRequest -> ShowS # show :: SocksRequest -> String # showList :: [SocksRequest] -> ShowS # | |
Serialize SocksRequest Source # | |
Defined in Network.Socks5.Wire | |
Command SocksRequest Source # | |
Defined in Network.Socks5.Command Methods toRequest :: SocksRequest -> SocksRequest Source # | |
Eq SocksRequest Source # | |
Defined in Network.Socks5.Wire |
data SocksResponse Source #
Type representing SOCKS responses.
Constructors
SocksResponse | |
Instances
Show SocksResponse Source # | |
Defined in Network.Socks5.Wire Methods showsPrec :: Int -> SocksResponse -> ShowS # show :: SocksResponse -> String # showList :: [SocksResponse] -> ShowS # | |
Serialize SocksResponse Source # | |
Defined in Network.Socks5.Wire | |
Eq SocksResponse Source # | |
Defined in Network.Socks5.Wire Methods (==) :: SocksResponse -> SocksResponse -> Bool # (/=) :: SocksResponse -> SocksResponse -> Bool # |
class Command a where Source #
A type class for types that can yield a SOCKS request or, optionally, be obtained from a SOCKS request.
Instances
Command Connect Source # | |
Defined in Network.Socks5.Command Methods toRequest :: Connect -> SocksRequest Source # fromRequest :: SocksRequest -> Maybe Connect Source # | |
Command SocksRequest Source # | |
Defined in Network.Socks5.Command Methods toRequest :: SocksRequest -> SocksRequest Source # |
Type representing connect commands.
Constructors
Connect SocksAddress |
Arguments
:: SocksVersion | The SOCKS protocol version to use. |
-> Socket | The socket to use. |
-> [SocksMethod] | A list of the authentification methods supported. |
-> IO SocksMethod |
Establish a connection with a SOCKS server.
Arguments
:: Command a | |
=> Socket | The socket to use. |
-> a | The command. |
-> IO (SocksHostAddress, PortNumber) |
As for rpc
but throws an exception if it does not succeed.
Arguments
:: Socket | The socket to use. |
-> HostAddress | The host address. |
-> PortNumber | The port number to use. |
-> IO (HostAddress, PortNumber) |
Connect using IPv4.
Arguments
:: Socket | The socket to use. |
-> HostAddress6 | The host address. |
-> PortNumber | The port number to use. |
-> IO (HostAddress6, PortNumber) |
Connect using IPv6.
Arguments
:: Socket | The socket to use. |
-> String | Destination FQDN. Should comprise only ASCII characters, otherwise unexpected behaviour will ensure. For FQDN including other Unicode code points, Punycode encoding should be used. |
-> PortNumber | The port number to use. |
-> IO (SocksHostAddress, PortNumber) |
Connect using a fully-qualified domain name (FQDN).
Arguments
:: Command a | |
=> Socket | The socket to use. |
-> a | The command. |
-> IO (Either SocksError (SocksHostAddress, PortNumber)) |
Try to execute the specified command with the specified socket.
Send data to the specified socket.