Package net.minecraftforge.network
Class DualStackUtils
java.lang.Object
net.minecraftforge.network.DualStackUtils
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanResolve the address and see if Java and the OS return an IPv6 or IPv4 one, then let Netty know accordingly (it doesn't understand thejava.net.preferIPv6Addresses=systemproperty).static booleancheckIPv6(InetAddress inetAddress) Checks if an address is an IPv6 one or an IPv4 one, lets Netty know accordingly and returns the result.private static voidstatic StringgetAddressString(SocketAddress address) Object.toString()but with IPv6 address compression supportstatic InetAddressGet the device's local IP address, taking into account scenarios where the client's network adapter supports IPv6 and has it enabled but the router's LAN does not.static StringUsed for the "Open to LAN" feature.static voidCalled byMinecraftForgeto load this class so that the initial network property constants are set before any of the other methods in this class are called.static voidLogs the initial values of thejava.net.preferIPv4Stackandjava.net.preferIPv6Addressessystem properties that Java has read on JVM start.
- 
Field Details- 
INITIAL_PREFER_IPv4_STACK
- 
INITIAL_PREFER_IPv6_ADDRESSES
- 
LOGGERprivate static final org.slf4j.Logger LOGGER
 
- 
- 
Constructor Details- 
DualStackUtilspublic DualStackUtils()
 
- 
- 
Method Details- 
initialise@Internal public static void initialise()Called byMinecraftForgeto load this class so that the initial network property constants are set before any of the other methods in this class are called. This is so we can distinguish what Java's read once on JVM start vs what we've set for Netty.
- 
checkIPv6Resolve the address and see if Java and the OS return an IPv6 or IPv4 one, then let Netty know accordingly (it doesn't understand thejava.net.preferIPv6Addresses=systemproperty).- Parameters:
- hostAddress- The address you want to check
- Returns:
- true if IPv6, false if IPv4
 
- 
checkIPv6Checks if an address is an IPv6 one or an IPv4 one, lets Netty know accordingly and returns the result.- Parameters:
- inetAddress- The address you want to check
- Returns:
- true if IPv6, false if IPv4
 
- 
debug
- 
getLocalAddressGet the device's local IP address, taking into account scenarios where the client's network adapter supports IPv6 and has it enabled but the router's LAN does not.- Returns:
- the client's local IP address or nullif unable to determine it
 
- 
getMulticastGroupUsed for the "Open to LAN" feature.- Returns:
- The multicast group to use for LAN discovery - IPv6 if available, IPv4 otherwise.
 
- 
logInitialPreferencespublic static void logInitialPreferences()Logs the initial values of thejava.net.preferIPv4Stackandjava.net.preferIPv6Addressessystem properties that Java has read on JVM start. Useful for debugging hostname lookup failures.
- 
getAddressStringObject.toString()but with IPv6 address compression support
 
-