Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- init()
- closeConnection(Channel)
- closeApplicationConnection(Channel)
- closeApplicationConnection(Channel, QuicApplicationErrorCode)
- closeApplicationConnection(Channel, QuicApplicationErrorCode, FormattedMessage)
- getEventLoopGroup(String)
- getEventLoopGroup(int, String)
- getServerChannel()
- getDatagramChannelFactory(SocketProtocolFamily)
- formatRemoteAddress(Channel)
- formatLocalAddress(Channel)
- getRemoteSocketAddress(Channel)
- isFromSameOrigin(Channel, Channel)
- wrapChannelFuture(ChannelFuture, Function)
Class NettyUtil
java.lang.Object
com.hypixel.hytale.server.core.io.netty.NettyUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic classNettyUtil.ReflectiveChannelFactory<T extends io.netty.channel.Channel>static final recordContext information for timeout logging, stored as a channel attribute. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.channel.ChannelFutureListenerAChannelFutureListenerthat closes the connection gracefully after a write completes.static final HytaleLoggerstatic final Stringstatic final io.netty.handler.logging.LoggingHandlerstatic final Stringstatic final Stringstatic final PacketArrayEncoderstatic final Stringstatic final Stringstatic final HytaleLoggerstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseApplicationConnection(io.netty.channel.Channel channel) Closes a raw Netty channel gracefully with an application error code.static voidcloseApplicationConnection(io.netty.channel.Channel channel, QuicApplicationErrorCode errorCode) Closes a raw Netty channel gracefully with a specific application error code.static voidcloseApplicationConnection(io.netty.channel.Channel channel, QuicApplicationErrorCode errorCode, FormattedMessage reason) Closes a raw Netty channel gracefully with an application error code and aFormattedMessageserialized into the QUICCONNECTION_CLOSEreason phrase.static voidcloseConnection(io.netty.channel.Channel channel) Closes a raw Netty channel due to a transport-level protocol violation.static StringformatLocalAddress(io.netty.channel.Channel channel) static StringformatRemoteAddress(io.netty.channel.Channel channel) static NettyUtil.ReflectiveChannelFactory<? extends io.netty.channel.socket.DatagramChannel> getDatagramChannelFactory(io.netty.channel.socket.SocketProtocolFamily family) static io.netty.channel.EventLoopGroupgetEventLoopGroup(int nThreads, String name) static io.netty.channel.EventLoopGroupgetEventLoopGroup(String name) static SocketAddressgetRemoteSocketAddress(io.netty.channel.Channel channel) static Class<? extends io.netty.channel.ServerChannel> static voidinit()static booleanisFromSameOrigin(io.netty.channel.Channel channel1, io.netty.channel.Channel channel2) Tests if the two netty channels are from the same origin address.static <T> CompletableFuture<T> wrapChannelFuture(io.netty.channel.ChannelFuture future, Function<io.netty.channel.ChannelFuture, T> func)
-
Field Details
-
CONNECTION_EXCEPTION_LOGGER
-
PACKET_LOGGER
-
PACKET_DECODER
- See Also:
-
PACKET_ARRAY_ENCODER
- See Also:
-
PACKET_ARRAY_ENCODER_INSTANCE
-
PACKET_ENCODER
- See Also:
-
LOGGER_KEY
- See Also:
-
LOGGER
public static final io.netty.handler.logging.LoggingHandler LOGGER -
HANDLER
- See Also:
-
RATE_LIMIT
- See Also:
-
CLOSE_ON_COMPLETE
public static final io.netty.channel.ChannelFutureListener CLOSE_ON_COMPLETEAChannelFutureListenerthat closes the connection gracefully after a write completes.
-
-
Constructor Details
-
NettyUtil
public NettyUtil()
-
-
Method Details
-
init
public static void init() -
closeConnection
public static void closeConnection(@Nonnull io.netty.channel.Channel channel) Closes a raw Netty channel due to a transport-level protocol violation. For use in Netty pipeline handlers that operate on rawChannelobjects. -
closeApplicationConnection
public static void closeApplicationConnection(@Nonnull io.netty.channel.Channel channel) Closes a raw Netty channel gracefully with an application error code. For use in Netty pipeline handlers that operate on rawChannelobjects. -
closeApplicationConnection
public static void closeApplicationConnection(@Nonnull io.netty.channel.Channel channel, @Nonnull QuicApplicationErrorCode errorCode) Closes a raw Netty channel gracefully with a specific application error code. For use in Netty pipeline handlers that operate on rawChannelobjects. -
closeApplicationConnection
public static void closeApplicationConnection(@Nonnull io.netty.channel.Channel channel, @Nonnull QuicApplicationErrorCode errorCode, @Nonnull FormattedMessage reason) Closes a raw Netty channel gracefully with an application error code and aFormattedMessageserialized into the QUICCONNECTION_CLOSEreason phrase. Falls back to a reason-less close if the encoded message exceeds the datagram-safe cap. -
getEventLoopGroup
-
getEventLoopGroup
-
getServerChannel
-
getDatagramChannelFactory
@Nonnull public static NettyUtil.ReflectiveChannelFactory<? extends io.netty.channel.socket.DatagramChannel> getDatagramChannelFactory(io.netty.channel.socket.SocketProtocolFamily family) -
formatRemoteAddress
-
formatLocalAddress
-
getRemoteSocketAddress
-
isFromSameOrigin
public static boolean isFromSameOrigin(io.netty.channel.Channel channel1, io.netty.channel.Channel channel2) Tests if the two netty channels are from the same origin address. SeeConnectionOrigin.isFromSameOrigin(SocketAddress, SocketAddress)for the comparison rules.- Parameters:
channel1- The first channelchannel2- The second channel- Returns:
trueif they are from the same "origin"
-
wrapChannelFuture
@Nonnull public static <T> CompletableFuture<T> wrapChannelFuture(@Nonnull io.netty.channel.ChannelFuture future, @Nonnull Function<io.netty.channel.ChannelFuture, T> func)
-