socks-0.6.1: Socks proxy (ver 5)
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Socks5

Description

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.

Synopsis

Types

data SocksAddress Source #

Describe a Socket address on the SOCKS protocol

Constructors

SocksAddress !SocksHostAddress !PortNumber 

Instances

Instances details
Show SocksAddress Source # 
Instance details

Defined in Network.Socks5.Types

Methods

showsPrec :: Int -> SocksAddress -> ShowS

show :: SocksAddress -> String

showList :: [SocksAddress] -> ShowS

Eq SocksAddress Source # 
Instance details

Defined in Network.Socks5.Types

Methods

(==) :: SocksAddress -> SocksAddress -> Bool

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

Ord SocksAddress Source # 
Instance details

Defined in Network.Socks5.Types

data SocksHostAddress Source #

A Host address on the SOCKS protocol.

Constructors

SocksAddrIPV4 !HostAddress 
SocksAddrDomainName !FQDN 
SocksAddrIPV6 !HostAddress6 

data SocksReply Source #

Type of reply on the SOCKS protocol

Instances

Instances details
Data SocksReply Source # 
Instance details

Defined in Network.Socks5.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SocksReply -> c SocksReply

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SocksReply

toConstr :: SocksReply -> Constr

dataTypeOf :: SocksReply -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SocksReply)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksReply)

gmapT :: (forall b. Data b => b -> b) -> SocksReply -> SocksReply

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SocksReply -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SocksReply -> r

gmapQ :: (forall d. Data d => d -> u) -> SocksReply -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> SocksReply -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply

Enum SocksReply Source # 
Instance details

Defined in Network.Socks5.Types

Show SocksReply Source # 
Instance details

Defined in Network.Socks5.Types

Methods

showsPrec :: Int -> SocksReply -> ShowS

show :: SocksReply -> String

showList :: [SocksReply] -> ShowS

Eq SocksReply Source # 
Instance details

Defined in Network.Socks5.Types

Methods

(==) :: SocksReply -> SocksReply -> Bool

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

Ord SocksReply Source # 
Instance details

Defined in Network.Socks5.Types

data SocksError Source #

SOCKS error that can be received or sent

Instances

Instances details
Data SocksError Source # 
Instance details

Defined in Network.Socks5.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SocksError -> c SocksError

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SocksError

toConstr :: SocksError -> Constr

dataTypeOf :: SocksError -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SocksError)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksError)

gmapT :: (forall b. Data b => b -> b) -> SocksError -> SocksError

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SocksError -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SocksError -> r

gmapQ :: (forall d. Data d => d -> u) -> SocksError -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> SocksError -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SocksError -> m SocksError

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SocksError -> m SocksError

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SocksError -> m SocksError

Enum SocksError Source # 
Instance details

Defined in Network.Socks5.Types

Exception SocksError Source # 
Instance details

Defined in Network.Socks5.Types

Methods

toException :: SocksError -> SomeException

fromException :: SomeException -> Maybe SocksError

displayException :: SocksError -> String

Show SocksError Source # 
Instance details

Defined in Network.Socks5.Types

Methods

showsPrec :: Int -> SocksError -> ShowS

show :: SocksError -> String

showList :: [SocksError] -> ShowS

Eq SocksError Source # 
Instance details

Defined in Network.Socks5.Types

Methods

(==) :: SocksError -> SocksError -> Bool

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

Ord SocksError Source # 
Instance details

Defined in Network.Socks5.Types

Configuration

data SocksConf Source #

SOCKS identification and configuration structure.

this structure will be extended in future to support authentification. use defaultSocksConf to create new record.

Constructors

SocksConf 

Fields

socksHost :: SocksConf -> SockAddr Source #

SOCKS Host

defaultSocksConf :: SockAddr -> SocksConf Source #

defaultSocksConf create a new record, making sure API remains compatible when the record is extended.

defaultSocksConfFromSockAddr :: SockAddr -> SocksConf Source #

same as defaultSocksConf.

soft deprecation: use 'defaultSocksConf"

Methods

socksConnectWithSocket Source #

Arguments

:: Socket

Socket to use.

-> SocksConf

SOCKS configuration for the server.

-> SocksAddress

SOCKS Address to connect to.

-> IO (SocksHostAddress, PortNumber) 

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|

socksConnect Source #

Arguments

:: SocksConf

SOCKS configuration for the server.

-> SocksAddress

SOCKS Address to connect to.

-> IO (Socket, (SocksHostAddress, PortNumber)) 

connect a new socket to a socks server and connect the stream on the server side to the SocksAddress specified.

Variants

socksConnectName :: Socket -> SocksConf -> String -> PortNumber -> IO () Source #

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.