Contents
Record Class IceCandidate
java.lang.Object
java.lang.Record
com.hypixel.hytale.server.core.io.ice.IceCandidate
public record IceCandidate(@Nonnull IceCandidate.Type type, @Nonnull InetSocketAddress address, long priority, @Nonnull String foundation)
extends Record
A transport address this host can be reached at, with the priority that orders checks against it.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumType preferences from RFC 8445 section 5.1.2.2. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intOnly one component is used: a single QUIC connection, unlike media that splits RTP and RTCP.static final longHighest priority the formula can produce.static final longPriority used for a check whose pair was learned from the peer rather than advertised. -
Constructor Summary
ConstructorsConstructorDescriptionIceCandidate(IceCandidate.Type type, InetSocketAddress address, long priority, String foundation) Creates an instance of aIceCandidaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionaddress()Returns the value of theaddressrecord component.static longcomputePriority(IceCandidate.Type type, int localPreference) final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefoundationrecord component.final inthashCode()Returns a hash code value for this object.static IceCandidatehost(InetSocketAddress address) static booleanisValidPriority(long priority) Whether a peer-supplied priority could have come from the formula.longpriority()Returns the value of thepriorityrecord component.static IceCandidateserverReflexive(InetSocketAddress address) A candidate for the address a socket appears to have from outside its own network.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Field Details
-
COMPONENT_ID
public static final int COMPONENT_IDOnly one component is used: a single QUIC connection, unlike media that splits RTP and RTCP.- See Also:
-
MAX_PRIORITY
public static final long MAX_PRIORITYHighest priority the formula can produce. Anything above it, or at or beyond 2^31, could not have come from a legal computation and is refused rather than trusted.- See Also:
-
PEER_REFLEXIVE_PRIORITY
public static final long PEER_REFLEXIVE_PRIORITYPriority used for a check whose pair was learned from the peer rather than advertised.
-
-
Constructor Details
-
IceCandidate
public IceCandidate(@Nonnull IceCandidate.Type type, @Nonnull InetSocketAddress address, long priority, @Nonnull String foundation) Creates an instance of aIceCandidaterecord class.- Parameters:
type- the value for thetyperecord componentaddress- the value for theaddressrecord componentpriority- the value for thepriorityrecord componentfoundation- the value for thefoundationrecord component
-
-
Method Details
-
computePriority
-
isValidPriority
public static boolean isValidPriority(long priority) Whether a peer-supplied priority could have come from the formula.Priority is unsigned on the wire. Java has no unsigned int, so a value at or above 2^31 would read as negative and sort checks in the wrong order; it is refused at the boundary instead.
-
host
-
serverReflexive
A candidate for the address a socket appears to have from outside its own network.- Parameters:
address- the address a STUN server reported, not the one the socket is bound to
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
address
Returns the value of theaddressrecord component.- Returns:
- the value of the
addressrecord component
-
priority
public long priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
foundation
Returns the value of thefoundationrecord component.- Returns:
- the value of the
foundationrecord component
-