Record Class HaProxyContext
java.lang.Object
java.lang.Record
io.kroxylicious.proxy.internal.net.HaProxyContext
- Record Components:
sourceAddress- the original client address reported by the load-balancerdestinationAddress- the destination address the client connected tosourcePort- the original client portdestinationPort- the destination porttlvs- HaProxy v2 TLV extensions keyed by type name, values arebyte[]
public record HaProxyContext(String sourceAddress, String destinationAddress, int sourcePort, int destinationPort, Map<String,byte[]> tlvs)
extends Record
Immutable snapshot of a decoded PROXY protocol header.
Captures the source/destination addresses, ports and any TLV extensions
from the Netty HAProxyMessage so that the reference-counted
message can be released immediately after extraction.
-
Constructor Summary
ConstructorsConstructorDescriptionHaProxyContext(String sourceAddress, String destinationAddress, int sourcePort, int destinationPort, Map<String, byte[]> tlvs) Compact constructor that deep-copies and wraps the TLV map to ensure immutability. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedestinationAddressrecord component.intReturns the value of thedestinationPortrecord component.final booleanIndicates whether some other object is "equal to" this one.static HaProxyContextfrom(io.netty.handler.codec.haproxy.HAProxyMessage msg) Creates anHaProxyContextfrom a NettyHAProxyMessage.final inthashCode()Returns a hash code value for this object.Returns the value of thesourceAddressrecord component.intReturns the value of thesourcePortrecord component.tlvs()Returns a defensive copy of the TLV map to prevent mutation of internal state.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
tlvs
Returns a defensive copy of the TLV map to prevent mutation of internal state.- Returns:
- a new map with cloned byte array values
-
from
Creates anHaProxyContextfrom a NettyHAProxyMessage.TLV content is deep-copied so the returned context is safe to use after the message is released.
- Parameters:
msg- the decoded proxy message- Returns:
- an immutable context snapshot
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
sourceAddress
Returns the value of thesourceAddressrecord component.- Returns:
- the value of the
sourceAddressrecord component
-
destinationAddress
Returns the value of thedestinationAddressrecord component.- Returns:
- the value of the
destinationAddressrecord component
-
sourcePort
public int sourcePort()Returns the value of thesourcePortrecord component.- Returns:
- the value of the
sourcePortrecord component
-
destinationPort
public int destinationPort()Returns the value of thedestinationPortrecord component.- Returns:
- the value of the
destinationPortrecord component
-