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

Safe Haskell | None
Language | Haskell98

Network.Socks5.Lowlevel

Contents

- lowlevel types
- lowlevel interface

Synopsis

- resolveToSockAddr :: SocksAddress -> IO SockAddr
- socksListen :: Socket -> IO SocksRequest
- data SocksHello = SocksHello {
  - getSocksHelloMethods :: [SocksMethod]
  }
- data SocksHelloResponse = SocksHelloResponse {
  - getSocksHelloResponseMethod :: SocksMethod
  }
- data SocksRequest = SocksRequest {
  - requestCommand :: SocksCommand
  - requestDstAddr :: SocksHostAddress
  - requestDstPort :: PortNumber
  }
- data SocksResponse = SocksResponse {
  - responseReply :: SocksReply
  - responseBindAddr :: SocksHostAddress
  - responseBindPort :: PortNumber
  }
- establish :: Socket -> [SocksMethod] -> IO SocksMethod
- newtype Connect = Connect SocksAddress
- class Command a where
  - toRequest :: a -> SocksRequest
  - fromRequest :: SocksRequest -> Maybe a
- connectIPV4 :: Socket -> HostAddress -> PortNumber -> IO (HostAddress, PortNumber)
- connectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber)
- connectDomainName :: Socket -> String -> PortNumber -> IO (SocksHostAddress, PortNumber)
- rpc :: Command a => Socket -> a -> IO (Either SocksError (SocksHostAddress, PortNumber))
- rpc_ :: Command a => Socket -> a -> IO (SocksHostAddress, PortNumber)
- sendSerialized :: Serialize a => Socket -> a -> IO ()
- waitSerialized :: Serialize a => Socket -> IO a

# Documentation

resolveToSockAddr :: SocksAddress -> IO SockAddr

socksListen :: Socket -> IO SocksRequest

# lowlevel types

data SocksHello

Initial message sent by client with the list of authentification methods supported

Constructors

SocksHello |
Fields getSocksHelloMethods :: [SocksMethod]

Instances

Eq SocksHello |
Show SocksHello |
Serialize SocksHello |

data SocksHelloResponse

Initial message send by server in return from Hello, with the server chosen method of authentication

Constructors

SocksHelloResponse |
Fields getSocksHelloResponseMethod :: SocksMethod

Instances

Eq SocksHelloResponse |
Show SocksHelloResponse |
Serialize SocksHelloResponse |

data SocksRequest

Define a SOCKS requests

Constructors

SocksRequest |
Fields requestCommand :: SocksCommand requestDstAddr :: SocksHostAddress requestDstPort :: PortNumber

Instances

Eq SocksRequest |
Show SocksRequest |
Serialize SocksRequest |
Command SocksRequest |

data SocksResponse

Define a SOCKS response

Constructors

SocksResponse |
Fields responseReply :: SocksReply responseBindAddr :: SocksHostAddress responseBindPort :: PortNumber

Instances

Eq SocksResponse |
Show SocksResponse |
Serialize SocksResponse |

establish :: Socket -> [SocksMethod] -> IO SocksMethod

newtype Connect

Constructors

Connect SocksAddress |

Instances

Eq Connect |
Ord Connect |
Show Connect |
Command Connect |

class Command a where

Methods

toRequest :: a -> SocksRequest

fromRequest :: SocksRequest -> Maybe a

Instances

Command SocksRequest |
Command Connect |

connectIPV4 :: Socket -> HostAddress -> PortNumber -> IO (HostAddress, PortNumber)

connectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber)

connectDomainName :: Socket -> String -> PortNumber -> IO (SocksHostAddress, PortNumber)

# lowlevel interface

rpc :: Command a => Socket -> a -> IO (Either SocksError (SocksHostAddress, PortNumber))

rpc_ :: Command a => Socket -> a -> IO (SocksHostAddress, PortNumber)

sendSerialized :: Serialize a => Socket -> a -> IO ()

waitSerialized :: Serialize a => Socket -> IO a