crypton-socks-0.6.2: SOCKS Protocol Version 5
Copyright(c) 2010-2019 Vincent Hanquez <vincent@snarc.org>
LicenseBSD-style
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Network.Socks5.Lowlevel

Description

Low level types and functions for interacting with a SOCKS server.

Synopsis

Documentation

socksListen Source #

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 

Instances

Instances details
Serialize SocksHello Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

put :: Putter SocksHello

get :: Get SocksHello

Show SocksHello Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

showsPrec :: Int -> SocksHello -> ShowS

show :: SocksHello -> String

showList :: [SocksHello] -> ShowS

Eq SocksHello Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

(==) :: SocksHello -> SocksHello -> Bool

(/=) :: SocksHello -> SocksHello -> Bool

newtype SocksHelloResponse Source #

Type representing initial messages sent by a server in response to Hello, with the server's chosen method of authentication.

Instances

Instances details
Serialize SocksHelloResponse Source # 
Instance details

Defined in Network.Socks5.Wire

Show SocksHelloResponse Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

showsPrec :: Int -> SocksHelloResponse -> ShowS

show :: SocksHelloResponse -> String

showList :: [SocksHelloResponse] -> ShowS

Eq SocksHelloResponse Source # 
Instance details

Defined in Network.Socks5.Wire

data SocksRequest Source #

Type representing SOCKS requests.

Instances

Instances details
Serialize SocksRequest Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

put :: Putter SocksRequest

get :: Get SocksRequest

Command SocksRequest Source # 
Instance details

Defined in Network.Socks5.Command

Show SocksRequest Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

showsPrec :: Int -> SocksRequest -> ShowS

show :: SocksRequest -> String

showList :: [SocksRequest] -> ShowS

Eq SocksRequest Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

(==) :: SocksRequest -> SocksRequest -> Bool

(/=) :: SocksRequest -> SocksRequest -> Bool

data SocksResponse Source #

Type representing SOCKS responses.

Instances

Instances details
Serialize SocksResponse Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

put :: Putter SocksResponse

get :: Get SocksResponse

Show SocksResponse Source # 
Instance details

Defined in Network.Socks5.Wire

Methods

showsPrec :: Int -> SocksResponse -> ShowS

show :: SocksResponse -> String

showList :: [SocksResponse] -> ShowS

Eq SocksResponse Source # 
Instance details

Defined in Network.Socks5.Wire

class Command a where Source #

A type class for types that can yield a SOCKS request or, optionally, be obtained from a SOCKS request.

newtype Connect Source #

Type representing connect commands.

Constructors

Connect SocksAddress 

Instances

Instances details
Command Connect Source # 
Instance details

Defined in Network.Socks5.Command

Show Connect Source # 
Instance details

Defined in Network.Socks5.Command

Methods

showsPrec :: Int -> Connect -> ShowS

show :: Connect -> String

showList :: [Connect] -> ShowS

Eq Connect Source # 
Instance details

Defined in Network.Socks5.Command

Methods

(==) :: Connect -> Connect -> Bool

(/=) :: Connect -> Connect -> Bool

Ord Connect Source # 
Instance details

Defined in Network.Socks5.Command

Methods

compare :: Connect -> Connect -> Ordering

(<) :: Connect -> Connect -> Bool

(<=) :: Connect -> Connect -> Bool

(>) :: Connect -> Connect -> Bool

(>=) :: Connect -> Connect -> Bool

max :: Connect -> Connect -> Connect

min :: Connect -> Connect -> Connect

establish Source #

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.

rpc_ Source #

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.

connectIPV4 Source #

Arguments

:: Socket

The socket to use.

-> HostAddress

The host address.

-> PortNumber

The port number to use.

-> IO (HostAddress, PortNumber) 

Connect using IPv4.

connectIPV6 Source #

Arguments

:: Socket

The socket to use.

-> HostAddress6

The host address.

-> PortNumber

The port number to use.

-> IO (HostAddress6, PortNumber) 

Connect using IPv6.

connectDomainName Source #

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).

rpc Source #

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.

sendSerialized Source #

Arguments

:: Serialize a 
=> Socket

The socket to use.

-> a

The data.

-> IO () 

Send data to the specified socket.

waitSerialized Source #

Arguments

:: Serialize a 
=> Socket

The socket to use.

-> IO a 

Wait for data from the specified socket.