Network.Socks5: exported symbols usage examples

Symbols

  • SocksAddress No usage example found for this symbol :( Collapse [-]
    SocksError No usage example found for this symbol :( Collapse [-]
    SocksHostAddress No usage example found for this symbol :( Collapse [-]
    SocksReply No usage example found for this symbol :( Collapse [-]
    defaultSocksConf See 1 Occurences [+] Collapse [-]
    Found in Network.Anonymous.Tor.Protocol from the package network-anonymous-tor
    --
    --   This function is provided as a convenience, since it doesn't actually use
    --   the Tor control protocol, and can be used to talk with any Socks5 compatible
    --   proxy server.
    connect :: MonadIO m
            => Integer                  -- ^ Port our tor SOCKS server listens at.
            -> Socks.SocksAddress       -- ^ Address we wish to connect to
            -> (Network.Socket -> IO a) -- ^ Computation to execute once connection has been establised
            -> m a
    connect sport remote callback = liftIO $ do
      (sock, _) <- Socks.socksConnect conf remote
      callback sock
    
      where
        conf = Socks.defaultSocksConf "127.0.0.1" (fromInteger sport)
    
    connect' :: MonadIO m
             => Network.Socket           -- ^ Our connection with the Tor control port
             -> Socks.SocksAddress       -- ^ Address we wish to connect to
             -> (Network.Socket -> IO a) -- ^ Computation to execute once connection has been establised
    

    defaultSocksConfFromSockAddr No usage example found for this symbol :( Collapse [-]
    socksHost No usage example found for this symbol :( Collapse [-]
    socksPort See 4 Occurences [+] Collapse [-]
    Found in Network.Anonymous.Tor.Protocol from the package network-anonymous-tor
            -> m a
    connect sport remote callback = liftIO $ do
      (sock, _) <- Socks.socksConnect conf remote
      callback sock
    
      where
        conf = Socks.defaultSocksConf "127.0.0.1" (fromInteger sport)
    
    connect' :: MonadIO m
             => Network.Socket           -- ^ Our connection with the Tor control port
             -> Socks.SocksAddress       -- ^ Address we wish to connect to
             -> (Network.Socket -> IO a) -- ^ Computation to execute once connection has been establised
             -> m a
    connect' sock remote callback = do
      sport <- socksPort sock
      connect sport remote callback
    
    -- | Requests protocol version information from Tor. This can be used while
    --   still unauthenticated and authentication methods can be derived from this
    --   information.
    

    Found in Network.Anonymous.Tor.Protocol from the package network-anonymous-tor
                               else E.ioError e)
        (performTest port result)
    
      takeMVar result
    
      where
        performTest port result =
          NST.connect "127.0.0.1" (show port) (\(sock, _) -> do
                                                    _ <- protocolInfo sock
                                                    putMVar result Available)
    -- | Returns the configured SOCKS proxy port
    socksPort :: MonadIO m
              => Network.Socket
              -> m Integer
    socksPort s = do
      reply <- sendCommand s (BS8.pack "GETCONF SOCKSPORT\n")
    
      return . fst . fromJust . BS8.readInteger . fromJust . Ast.tokenValue . head . Ast.lineMessage . fromJust $ Ast.line (BS8.pack "SocksPort") reply
    
    -- | Connect through a remote using the Tor SOCKS proxy. The remote might me a
    

    Found in Network.Anonymous.Tor.Protocol from the package network-anonymous-tor
                          else if   E.ioeGetErrorType e == E.UserError -- This gets thrown by network-attoparsec
                                                                       -- when there is a parse error.
                               then putMVar result IncorrectPort
                               else E.ioError e)
        (performTest port result)
    
      takeMVar result
    
      where
        performTest port result =
          NST.connect "127.0.0.1" (show port) (\(sock, _) -> do
                                                    _ <- protocolInfo sock
                                                    putMVar result Available)
    -- | Returns the configured SOCKS proxy port
    socksPort :: MonadIO m
              => Network.Socket
              -> m Integer
    socksPort s = do
      reply <- sendCommand s (BS8.pack "GETCONF SOCKSPORT\n")
    

    Found in Network.Anonymous.Tor.Protocol from the package network-anonymous-tor
    {-# LANGUAGE OverloadedStrings #-}
    
    -- | Protocol description
    --
    -- Defines functions that handle the advancing of the Tor control protocol.
    --
    --   __Warning__: This function is used internally by 'Network.Anonymous.Tor'
    --                and using these functions directly is unsupported. The
    --                interface of these functions might change at any time without
    --                prior notice.
    --
    module Network.Anonymous.Tor.Protocol ( Availability (..)
                                          , isAvailable
                                          , socksPort
                                          , connect
                                          , connect'
                                          , protocolInfo
                                          , authenticate
                                          , mapOnion ) where
    

    SocksConf No usage example found for this symbol :( Collapse [-]
    socksConnect See 1 Occurences [+] Collapse [-]
    Found in Network.Anonymous.Tor.Protocol from the package network-anonymous-tor
    -- | Connect through a remote using the Tor SOCKS proxy. The remote might me a
    --   a normal host/ip or a hidden service address. When you provide a FQDN to
    --   resolve, it will be resolved by the Tor service, and as such is secure.
    --
    --   This function is provided as a convenience, since it doesn't actually use
    --   the Tor control protocol, and can be used to talk with any Socks5 compatible
    --   proxy server.
    connect :: MonadIO m
            => Integer                  -- ^ Port our tor SOCKS server listens at.
            -> Socks.SocksAddress       -- ^ Address we wish to connect to
            -> (Network.Socket -> IO a) -- ^ Computation to execute once connection has been establised
            -> m a
    connect sport remote callback = liftIO $ do
      (sock, _) <- Socks.socksConnect conf remote
      callback sock
    
      where
        conf = Socks.defaultSocksConf "127.0.0.1" (fromInteger sport)
    

    socksConnectAddr No usage example found for this symbol :( Collapse [-]
    socksConnectName No usage example found for this symbol :( Collapse [-]
    socksConnectTo No usage example found for this symbol :( Collapse [-]
    socksConnectTo' See 2 Occurences [+] Collapse [-]
    Found in Network.Connection from the package connection
      where
            getConFct Nothing                            = return resolve'
            getConFct (Just (OtherProxy h p))            = return $ \_ _ -> resolve' h (N.PortNumber p)
            getConFct (Just (SockSettingsSimple h p))    = return $ socksConnectTo' h (N.PortNumber p)
            getConFct (Just (SockSettingsEnvironment v)) = do
                -- if we can't get the environment variable or that the variable cannot be parsed
                -- we connect directly.
                let name = maybe "SOCKS_SERVER" id v
                evar <- E.try (getEnv name)
                case evar of
                    Left (_ :: E.IOException) -> return resolve'
                    Right var                 ->
                        case parseSocks var of
                            Nothing             -> return resolve'
                            Just (sHost, sPort) -> return $ socksConnectTo' sHost (N.PortNumber $ fromIntegral (sPort :: Int))
    
            -- Try to parse "host:port" or "host"
            parseSocks s =
                case break (== ':') s of
                    (sHost, "")        -> Just (sHost, 1080)
    

    Found in Network.Connection from the package connection
              cid = (connectionHostname p, connectionPort p)
    
    -- | connect to a destination using the parameter
    connectTo :: ConnectionContext -- ^ The global context of this connection.
              -> ConnectionParams  -- ^ The parameters for this connection (where to connect, and such).
              -> IO Connection     -- ^ The new established connection on success.
    connectTo cg cParams = do
        conFct <- getConFct (connectionUseSocks cParams)
        let doConnect = conFct (connectionHostname cParams) (N.PortNumber $ connectionPort cParams)
        E.bracketOnError doConnect N.close $ \h->
            connectFromSocket cg h cParams
      where
            getConFct Nothing                            = return resolve'
            getConFct (Just (OtherProxy h p))            = return $ \_ _ -> resolve' h (N.PortNumber p)
            getConFct (Just (SockSettingsSimple h p))    = return $ socksConnectTo' h (N.PortNumber p)
            getConFct (Just (SockSettingsEnvironment v)) = do
                -- if we can't get the environment variable or that the variable cannot be parsed
                -- we connect directly.
                let name = maybe "SOCKS_SERVER" id v
                evar <- E.try (getEnv name)
    

    socksConnectWith No usage example found for this symbol :( Collapse [-]
    socksConnectWithSocket No usage example found for this symbol :( Collapse [-]