Interface QuicContext

All Known Subinterfaces:
QuicStreamContext

public interface QuicContext
One intercepted QUIC connection, as a QuicInterceptor sees it: who the client is, where the connection goes, what was negotiated, and a way to add datagrams. The same context is given to every connection-level hook call (connection() returns it too), so it can serve as a key for per-connection state.
  • Method Summary

    Modifier and Type
    Method
    Description
    The ALPN protocol negotiated with both sides: the one the server chose of those the client offered.
    The client's address: the redirected client's, or the client of the CONNECT-UDP flow the QUIC came in.
    default QuicContext
    The QUIC connection's context: this one, for a connection; the connection's, for a stream.
    long
    The client connection the QUIC connection belongs to (FlowContext.getConnectionId()).
    The flow of the CONNECT the proxy made up to decide on the connection.
    The host the connection goes to: the SNI's on the transparent QUIC listener, the CONNECT-UDP target's inside a flow.
    boolean
    Whether the QUIC came inside a CONNECT-UDP flow (MASQUE), rather than to the transparent QUIC listener.
    int
    The port the connection goes to.
    void
    sendDatagram(boolean fromClient, byte[] data)
    Sends a datagram as if one side had sent it: with fromClient it goes to the server, else to the client.
    The address the proxy's QUIC connection to the server is connected to.
    sni()
    The server name the client asked for in its ClientHello, which the proxy asked the server for and issued its certificate for.
  • Method Details

    • connectionId

      long connectionId()
      The client connection the QUIC connection belongs to (FlowContext.getConnectionId()).
      Returns:
      the client connection's id
    • clientAddress

      InetSocketAddress clientAddress()
      The client's address: the redirected client's, or the client of the CONNECT-UDP flow the QUIC came in.
      Returns:
      the client address
    • host

      String host()
      The host the connection goes to: the SNI's on the transparent QUIC listener, the CONNECT-UDP target's inside a flow.
      Returns:
      the server's host name or IP address (IPv6 without brackets)
    • port

      int port()
      The port the connection goes to.
      Returns:
      the server's port
    • serverAddress

      InetSocketAddress serverAddress()
      The address the proxy's QUIC connection to the server is connected to.
      Returns:
      the server's address
    • sni

      String sni()
      The server name the client asked for in its ClientHello, which the proxy asked the server for and issued its certificate for.
      Returns:
      the SNI
    • alpn

      String alpn()
      The ALPN protocol negotiated with both sides: the one the server chose of those the client offered.
      Returns:
      the protocol, or null for none
    • masque

      boolean masque()
      Whether the QUIC came inside a CONNECT-UDP flow (MASQUE), rather than to the transparent QUIC listener.
      Returns:
      whether the connection is a CONNECT-UDP flow's
    • flowContext

      FlowContext flowContext()
      The flow of the CONNECT the proxy made up to decide on the connection.
      Returns:
      the flow context
    • connection

      default QuicContext connection()
      The QUIC connection's context: this one, for a connection; the connection's, for a stream.
      Returns:
      the connection's context
    • sendDatagram

      void sendDatagram(boolean fromClient, byte[] data)
      Sends a datagram as if one side had sent it: with fromClient it goes to the server, else to the client. It does not pass through QuicInterceptor.datagram(org.microproxy.quic.QuicDatagram, org.microproxy.quic.QuicContext). Like any datagram it may be lost, and is dropped when the destination takes no datagrams or it is too large.
      Parameters:
      fromClient - true to send to the server, false to send to the client
      data - the payload of one datagram
      Throws:
      IllegalStateException - if the connection has ended
      NullPointerException - if data is null