Package org.microproxy.quic
Interface QuicStreamContext
- All Superinterfaces:
QuicContext
One stream of an intercepted QUIC connection, as a
QuicInterceptor sees it: the
connection's details (QuicContext), which stream it is, who opened it, and a way to add
bytes. The same context is given to every hook call of the stream, so it can serve as a key for
per-stream state; QuicContext.connection() is the key for per-connection state.-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the stream is bidirectional; a unidirectional stream carries data only from the side that opened it.booleanWhether the client opened the stream, rather than the server.voidsend(boolean fromClient, byte[] data) Adds bytes to the stream, as if one side had sent them: withfromClientthey go to the server, else to the client.longThe stream's ID on the proxy's connection to the server.longstreamId()The stream's ID on the client's connection (RFC 9000 section 2.1).Methods inherited from interface org.microproxy.quic.QuicContext
alpn, clientAddress, connection, connectionId, flowContext, host, masque, port, sendDatagram, serverAddress, sni
-
Method Details
-
streamId
long streamId()The stream's ID on the client's connection (RFC 9000 section 2.1). Its two low bits say who opened it and whether it is unidirectional.- Returns:
- the client-side stream ID
-
serverStreamId
long serverStreamId()The stream's ID on the proxy's connection to the server. Streams are opened on the other connection in the order they arrive, so the two IDs are usually the same.- Returns:
- the server-side stream ID
-
bidirectional
boolean bidirectional()Whether the stream is bidirectional; a unidirectional stream carries data only from the side that opened it.- Returns:
- true for a bidirectional stream
-
clientInitiated
boolean clientInitiated()Whether the client opened the stream, rather than the server.- Returns:
- true for a stream the client opened
-
send
void send(boolean fromClient, byte[] data) Adds bytes to the stream, as if one side had sent them: withfromClientthey go to the server, else to the client. They do not pass throughQuicInterceptor.streamData(org.microproxy.quic.QuicStreamMessage, org.microproxy.quic.QuicStreamContext)orQuicInterceptor.streamMessage(org.microproxy.quic.QuicMessage, org.microproxy.quic.QuicStreamContext), and are not framed: on a framed stream, return messages fromstreamMessageinstead. Called from astreamDataorstreamMessagehook of the same direction, they follow that message (or what replaced it); otherwise, from any hook or any thread while that direction is open, they are written at once, between messages. The call may block while the destination's flow control holds the data back.- Parameters:
fromClient- true to send to the server, false to send to the clientdata- the bytes, written as they are- Throws:
IllegalStateException- if that direction has ended (finished, reset or stopped) or does not exist on a unidirectional streamNullPointerException- ifdatais null
-