| License | BSD-style |
|---|---|
| Maintainer | Vincent Hanquez <vincent@snarc.org> |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- data SocksAddress = SocksAddress !SocksHostAddress !PortNumber
- data SocksHostAddress
- data SocksReply
- data SocksError
- defaultSocksConf :: SockAddr -> SocksConf
- defaultSocksConfFromSockAddr :: SockAddr -> SocksConf
- socksHost :: SocksConf -> SockAddr
- data SocksConf = SocksConf {}
- socksConnectWithSocket :: Socket -> SocksConf -> SocksAddress -> IO (SocksHostAddress, PortNumber)
- socksConnect :: SocksConf -> SocksAddress -> IO (Socket, (SocksHostAddress, PortNumber))
- socksConnectName :: Socket -> SocksConf -> String -> PortNumber -> IO ()
Types
data SocksAddress Source #
Describe a Socket address on the SOCKS protocol
Constructors
| SocksAddress !SocksHostAddress !PortNumber |
Instances
| Eq SocksAddress Source # | |
Defined in Network.Socks5.Types | |
| Ord SocksAddress Source # | |
Defined in Network.Socks5.Types Methods 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 Source # | |
Defined in Network.Socks5.Types Methods showsPrec :: Int -> SocksAddress -> ShowS # show :: SocksAddress -> String # showList :: [SocksAddress] -> ShowS # | |
data SocksHostAddress Source #
A Host address on the SOCKS protocol.
Constructors
| SocksAddrIPV4 !HostAddress | |
| SocksAddrDomainName !FQDN | |
| SocksAddrIPV6 !HostAddress6 |
Instances
| Eq SocksHostAddress Source # | |
Defined in Network.Socks5.Types Methods (==) :: SocksHostAddress -> SocksHostAddress -> Bool # (/=) :: SocksHostAddress -> SocksHostAddress -> Bool # | |
| Ord SocksHostAddress Source # | |
Defined in Network.Socks5.Types Methods 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 Source # | |
Defined in Network.Socks5.Types Methods showsPrec :: Int -> SocksHostAddress -> ShowS # show :: SocksHostAddress -> String # showList :: [SocksHostAddress] -> ShowS # | |
data SocksReply Source #
Type of reply on the SOCKS protocol
Constructors
| SocksReplySuccess | |
| SocksReplyError SocksError |
Instances
data SocksError Source #
SOCKS error that can be received or sent
Constructors
Instances
Configuration
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"
SOCKS identification and configuration structure.
this structure will be extended in future to support authentification. use defaultSocksConf to create new record.
Constructors
| SocksConf | |
Fields
| |
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|
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.