socks-0.5.6: Socks proxy (ver 5)

Safe Haskell | None
Language | Haskell2010

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
- 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 Source #

socksListen :: Socket -> IO SocksRequest Source #

# lowlevel types

data SocksHello Source #

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

Constructors

SocksHello |

Fields

- getSocksHelloMethods :: [SocksMethod]

Instances

Eq SocksHello Source # |
Methods (==) :: SocksHello -> SocksHello -> Bool # (/=) :: SocksHello -> SocksHello -> Bool #
Show SocksHello Source # |
Methods showsPrec :: Int -> SocksHello -> ShowS # show :: SocksHello -> String # showList :: [SocksHello] -> ShowS #
Serialize SocksHello Source # |
Methods put :: Putter SocksHello # get :: Get SocksHello #

data SocksHelloResponse Source #

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

Constructors

SocksHelloResponse |

Fields

- getSocksHelloResponseMethod :: SocksMethod

Instances

Eq SocksHelloResponse Source # |
Methods (==) :: SocksHelloResponse -> SocksHelloResponse -> Bool # (/=) :: SocksHelloResponse -> SocksHelloResponse -> Bool #
Show SocksHelloResponse Source # |
Methods showsPrec :: Int -> SocksHelloResponse -> ShowS # show :: SocksHelloResponse -> String # showList :: [SocksHelloResponse] -> ShowS #
Serialize SocksHelloResponse Source # |
Methods put :: Putter SocksHelloResponse # get :: Get SocksHelloResponse #

data SocksRequest Source #

Define a SOCKS requests

Constructors

SocksRequest |

Fields

- requestCommand :: SocksCommand
- requestDstAddr :: SocksHostAddress
- requestDstPort :: PortNumber

Instances

Eq SocksRequest Source # |
Methods (==) :: SocksRequest -> SocksRequest -> Bool # (/=) :: SocksRequest -> SocksRequest -> Bool #
Show SocksRequest Source # |
Methods showsPrec :: Int -> SocksRequest -> ShowS # show :: SocksRequest -> String # showList :: [SocksRequest] -> ShowS #
Serialize SocksRequest Source # |
Methods put :: Putter SocksRequest # get :: Get SocksRequest #
Command SocksRequest Source # |
Methods toRequest :: SocksRequest -> SocksRequest Source # fromRequest :: SocksRequest -> Maybe SocksRequest Source #

data SocksResponse Source #

Define a SOCKS response

Constructors

SocksResponse |

Fields

- responseReply :: SocksReply
- responseBindAddr :: SocksHostAddress
- responseBindPort :: PortNumber

Instances

Eq SocksResponse Source # |
Methods (==) :: SocksResponse -> SocksResponse -> Bool # (/=) :: SocksResponse -> SocksResponse -> Bool #
Show SocksResponse Source # |
Methods showsPrec :: Int -> SocksResponse -> ShowS # show :: SocksResponse -> String # showList :: [SocksResponse] -> ShowS #
Serialize SocksResponse Source # |
Methods put :: Putter SocksResponse # get :: Get SocksResponse #

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

newtype Connect Source #

Constructors

Connect SocksAddress |

Instances

Eq Connect Source # |
Methods (==) :: Connect -> Connect -> Bool # (/=) :: Connect -> Connect -> Bool #
Ord Connect Source # |
Methods compare :: Connect -> Connect -> Ordering # (<) :: Connect -> Connect -> Bool # (<=) :: Connect -> Connect -> Bool # (>) :: Connect -> Connect -> Bool # (>=) :: Connect -> Connect -> Bool # max :: Connect -> Connect -> Connect # min :: Connect -> Connect -> Connect #
Show Connect Source # |
Methods showsPrec :: Int -> Connect -> ShowS # show :: Connect -> String # showList :: [Connect] -> ShowS #
Command Connect Source # |
Methods toRequest :: Connect -> SocksRequest Source # fromRequest :: SocksRequest -> Maybe Connect Source #

class Command a where Source #

Minimal complete definition

toRequest, fromRequest

Methods

toRequest :: a -> SocksRequest Source #

fromRequest :: SocksRequest -> Maybe a Source #

Instances

Command SocksRequest Source # |
Methods toRequest :: SocksRequest -> SocksRequest Source # fromRequest :: SocksRequest -> Maybe SocksRequest Source #
Command Connect Source # |
Methods toRequest :: Connect -> SocksRequest Source # fromRequest :: SocksRequest -> Maybe Connect Source #

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

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

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

# lowlevel interface

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

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

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

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