Package org.microproxy
Class FlowRecord.Builder
java.lang.Object
org.microproxy.FlowRecord.Builder
- Enclosing class:
FlowRecord
Builds a
FlowRecord; unset values are unknown.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the record.bytes(long received, long sent) Sets the bytes exchanged with the client.downstreamLocalAddress(InetSocketAddress address) Sets the proxy's local address on the client connection.outcome(Set<ResponseFlag> flags, ProxyFailure failure, String details) Sets the outcome: flags, failure and details.request(HttpRequest request) Sets the client's request.response(HttpResponse response, ResponseSource source) Sets the response the client got, and where it came from.time(long startEpochMillis, long durationNanos) Sets when the exchange started and how long it lasted.timings(FlowTimings timings) Sets the phase timings.Sets the exchange's distributed trace.trailers(HttpHeaders trailers) Sets the response's trailers.Fixes the unique id instead of making a random one when asked.upstream(InetSocketAddress address, InetSocketAddress localAddress, String cluster, SSLSession session) Sets what the exchange was connected to.upstreamBytes(long sent, long received) Sets the bytes exchanged with the server, on the wire.upstreamProtocol(String protocol) Sets the protocol spoken to the upstream (FlowRecord.upstreamProtocol()).upstreamTransportFailureReason(String reason) Sets why the TLS handshake with the server failed.
-
Method Details
-
request
Sets the client's request.- Parameters:
request- the request head, ornull- Returns:
- this builder
-
response
Sets the response the client got, and where it came from.- Parameters:
response- the response head, ornullsource- where it came from, ornull- Returns:
- this builder
-
trailers
Sets the response's trailers.- Parameters:
trailers- the trailers, ornull- Returns:
- this builder
-
time
Sets when the exchange started and how long it lasted.- Parameters:
startEpochMillis- the wall-clock start, in epoch millisecondsdurationNanos- the duration in nanoseconds, or -1 when unknown- Returns:
- this builder
-
timings
Sets the phase timings.- Parameters:
timings- the timings- Returns:
- this builder
-
bytes
Sets the bytes exchanged with the client.- Parameters:
received- bytes received from the client, or -1sent- bytes sent to the client, or -1- Returns:
- this builder
-
upstreamBytes
Sets the bytes exchanged with the server, on the wire.- Parameters:
sent- bytes written to the server, or -1received- bytes read from the server, or -1- Returns:
- this builder
-
upstream
public FlowRecord.Builder upstream(InetSocketAddress address, InetSocketAddress localAddress, String cluster, SSLSession session) Sets what the exchange was connected to.- Parameters:
address- the server or chained proxy, ornulllocalAddress- the proxy's end of that connection, ornullcluster- the chained proxy's or server's name, ornullsession- the TLS session with it, ornull- Returns:
- this builder
-
upstreamProtocol
Sets the protocol spoken to the upstream (FlowRecord.upstreamProtocol()).- Parameters:
protocol-HTTP/1.1,HTTP/2,HTTP/3,SOCKS4orSOCKS5, ornull- Returns:
- this builder
-
upstreamTransportFailureReason
Sets why the TLS handshake with the server failed.- Parameters:
reason- the reason, ornull- Returns:
- this builder
-
downstreamLocalAddress
Sets the proxy's local address on the client connection.- Parameters:
address- the address, ornull- Returns:
- this builder
-
outcome
Sets the outcome: flags, failure and details.- Parameters:
flags- the response flagsfailure- the failure, ornulldetails- the response code details, ornull- Returns:
- this builder
-
trace
Sets the exchange's distributed trace.- Parameters:
trace- the trace,FlowTrace.NONEfor none- Returns:
- this builder
-
uniqueId
Fixes the unique id instead of making a random one when asked.- Parameters:
uniqueId- the id- Returns:
- this builder
-
build
Returns the record.- Returns:
- the record
-