public String queryPrivateIp() {
        IpProperties ipProperties = propertiesManager.getLocalProperties()
                .getIp();
        int cachedPrivateIpExpireAfterMillis = ipProperties.getCachedPrivateIpExpireAfterMillis();
        String localCachedPrivateIp = cachedPrivateIp;
        if (cachedPrivateIpExpireAfterMillis > 0
                && localCachedPrivateIp != null
                && System.nanoTime() - privateIpLastUpdatedTimeNanos < DateTimeUtil
                        .millisToNanos(cachedPrivateIpExpireAfterMillis)) {
            return localCachedPrivateIp;
        }
        DatagramChannel channel = null;
        try {
            channel = DatagramChannel.open();
            InetSocketAddress address = new InetSocketAddress("8.8.8.8", 10002);
            channel.connect(address);
            InetSocketAddress localAddress = (InetSocketAddress) channel.getLocalAddress();
            InetAddress inetAddress = localAddress.getAddress();
            String ip = inetAddress.getHostAddress();
            if (!inetAddress.isSiteLocalAddress()) {
                throw new NoAvailableAddressFoundException(
                        "The IP address ("
                                + ip
                                + ") is not a site local IP address");
            }
            privateIpLastUpdatedTimeNanos = System.nanoTime();
            cachedPrivateIp = ip;
            return ip;
        } catch (Exception e) {
            throw new NoAvailableAddressFoundException("Failed to detect the local IP", e);
        } finally {
            try {
                if (channel != null) {
                    channel.close();
                }
            } catch (IOException ignored) {
            }
        }
    }
@author James Chen
@implNote Don't cache the IP forever because they may change over time.
turms-server-common/src/main/java/im/turms/server/common/infra/address/IpDetector.java