Cute   Learning Hub


  • ConnectionInfo
  • ConnectionInfo Class

    class Cute::ConnectionInfo

    The Cute::ConnectionInfo holds connection information when handling errors. More...

    Header: #include <CuteServer.h>

    Public Functions

    bool hasProxy() const
    QString localIp() const
    quint16 localPort() const
    QString peerIp() const
    quint16 peerPort() const
    QString proxiedIp() const
    quint16 proxiedPort() const
    QString proxyIp() const
    quint16 proxyPort() const

    Detailed Description

    Whenever an error is reported to a handler registered through the setErrorHandler function, connection information is passed in an instance of Cute::ConnectionInfo, allowing handlers to take actions, like banning temporarily/permanently an IP.

    Member Function Documentation

    bool ConnectionInfo::hasProxy() const

    Returns true if a proxy is present. A proxy is an intermediary in the connection path. When proxies are used, clients connect to proxy and proxy connects to backend servers. Proxies may act as load balancers by accepting client connections and dispatching messages to connections established to background servers or may have the purpose of hiding background infrastructure from DDOS attacks by hiding backend server IPs from malicious clients.

    Proxies may process TCP data or they may process HTTP requests. When processing TCP data, proxies may use SSL termination or SSL passthrough for encrypted connections. One of the most used open source TCP/HTTP proxy is HAProxy.

    Proxies pass client information (IP) to backend servers in two ways. When handling TCP data, a proxy header can be sent when the backend connection is established. Two formats (v1/v2) for passing information as a proxy header exist. HTTP proxies can send client information as HTTP headers. Cute server supports both ways of processing client information (see Configuring Server for more information).

    QString ConnectionInfo::localIp() const

    Returns the local IP of the connection.

    quint16 ConnectionInfo::localPort() const

    Returns the local port of the connection.

    QString ConnectionInfo::peerIp() const

    Returns the IP of the connected peer. If a proxy is present, this is the proxy IP.

    quint16 ConnectionInfo::peerPort() const

    Returns the port of the connected peer. If a proxy is present, this is the proxy port.

    QString ConnectionInfo::proxiedIp() const

    Returns the client IP when a proxy is being used.

    See also hasProxy.

    quint16 ConnectionInfo::proxiedPort() const

    Returns the client port when a proxy is being used.

    See also hasProxy.

    QString ConnectionInfo::proxyIp() const

    Returns the proxy IP when a proxy is being used.

    See also hasProxy.

    quint16 ConnectionInfo::proxyPort() const

    Returns the proxy port when a proxy is being used.

    See also hasProxy.