socks-0.4.1: Socks proxy (version 5) implementation.

Portability | unknown
Stability | experimental
Maintainer | Vincent Hanquez <vincent@snarc.org>
Safe Haskell | None

Network.Socks5

Description

Synopsis

- data SocksConf = SocksConf {
  - socksHost :: String
  - socksPort :: PortNumber
  - socksVersion :: Int
  }
- defaultSocksConf :: String -> PortNumber -> SocksConf
- socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO ()
- socksConnectName :: Socket -> SockAddr -> String -> PortNumber -> IO ()
- socksConnectTo :: String -> PortID -> String -> PortID -> IO Handle
- socksConnectWith :: SocksConf -> String -> PortID -> IO Socket

# Documentation

data SocksConf Source

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

Constructors

SocksConf |

Fields

socksHost :: String

  SOCKS host.

socksPort :: PortNumber

  SOCKS port.

socksVersion :: Int

  SOCKS version to use, only 5 supported for now.

defaultSocksConf :: String -> PortNumber -> SocksConf Source

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

socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO ()Source

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|

socksConnectName :: Socket -> SockAddr -> String -> PortNumber -> IO ()Source

connect a new socket to the socks server, and connect the stream to a FQDN resolved on the server side.

socksConnectTo :: String -> PortID -> String -> PortID -> IO Handle Source

similar to Network connectTo but use a socks proxy with default socks configuration.

socksConnectWith Source

Arguments

:: SocksConf | SOCKS configuration
-> String | destination hostname
-> PortID | destination port
-> IO Socket |

create a new socket and connect in to a destination through the specified SOCKS configuration.