License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
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
- data SocksAddress = SocksAddress !SocksHostAddress !PortNumber
- data SocksHostAddress
- data SocksReply
- data SocksError
- data SocksConf = SocksConf {}
- socksHost :: SocksConf -> SocksHostAddress
- socksPort :: SocksConf -> PortNumber
- defaultSocksConf :: [Char] -> PortNumber -> SocksConf
- defaultSocksConfFromSockAddr :: SockAddr -> SocksConf
- socksConnectWithSocket :: Socket -> SocksConf -> SocksAddress -> IO (SocksHostAddress, PortNumber)
- socksConnect :: SocksConf -> SocksAddress -> IO (Socket, (SocksHostAddress, PortNumber))
- socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO ()
- socksConnectName :: Socket -> SockAddr -> String -> PortNumber -> IO ()
- socksConnectTo' :: String -> PortID -> String -> PortID -> IO Socket
- socksConnectTo :: String -> PortID -> String -> PortID -> IO Handle
- socksConnectWith :: SocksConf -> String -> PortID -> IO Socket
Types
data SocksAddress #
Describe a Socket address on the SOCKS protocol
Instances
Eq SocksAddress # | |
Defined in Network.Socks5.Types (==) :: SocksAddress -> SocksAddress -> Bool # (/=) :: SocksAddress -> SocksAddress -> Bool # | |
Ord SocksAddress # | |
Defined in Network.Socks5.Types compare :: SocksAddress -> SocksAddress -> Ordering # (<) :: SocksAddress -> SocksAddress -> Bool # (<=) :: SocksAddress -> SocksAddress -> Bool # (>) :: SocksAddress -> SocksAddress -> Bool # (>=) :: SocksAddress -> SocksAddress -> Bool # max :: SocksAddress -> SocksAddress -> SocksAddress # min :: SocksAddress -> SocksAddress -> SocksAddress # | |
Show SocksAddress # | |
Defined in Network.Socks5.Types showsPrec :: Int -> SocksAddress -> ShowS # show :: SocksAddress -> String # showList :: [SocksAddress] -> ShowS # |
data SocksHostAddress #
A Host address on the SOCKS protocol.
Instances
Eq SocksHostAddress # | |
Defined in Network.Socks5.Types (==) :: SocksHostAddress -> SocksHostAddress -> Bool # (/=) :: SocksHostAddress -> SocksHostAddress -> Bool # | |
Ord SocksHostAddress # | |
Defined in Network.Socks5.Types compare :: SocksHostAddress -> SocksHostAddress -> Ordering # (<) :: SocksHostAddress -> SocksHostAddress -> Bool # (<=) :: SocksHostAddress -> SocksHostAddress -> Bool # (>) :: SocksHostAddress -> SocksHostAddress -> Bool # (>=) :: SocksHostAddress -> SocksHostAddress -> Bool # max :: SocksHostAddress -> SocksHostAddress -> SocksHostAddress # min :: SocksHostAddress -> SocksHostAddress -> SocksHostAddress # | |
Show SocksHostAddress # | |
Defined in Network.Socks5.Types showsPrec :: Int -> SocksHostAddress -> ShowS # show :: SocksHostAddress -> String # showList :: [SocksHostAddress] -> ShowS # |
data SocksReply #
Type of reply on the SOCKS protocol
Instances
data SocksError #
SOCKS error that can be received or sent
Instances
Configuration
SOCKS configuration structure. this structure will be extended in future to support authentification. use defaultSocksConf to create new record.
SocksConf | |
|
socksHost :: SocksConf -> SocksHostAddress #
SOCKS Host
socksPort :: SocksConf -> PortNumber #
SOCKS Port
defaultSocksConf :: [Char] -> PortNumber -> SocksConf #
defaultSocksConf create a new record, making sure API remains compatible when the record is extended.
defaultSocksConfFromSockAddr :: SockAddr -> 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
Methods
:: 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 to the socks server,
and connect the stream on the server side to the SockAddress
specified.
|socket|-----sockServer----->|server|----destAddr----->|destination|
:: 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
socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO () #
Deprecated: use socksConnectWithSocket
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 () #
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 Socket #
similar to Network connectTo but use a socks proxy with default socks configuration.