HTTP-FS-file-server icon indicating copy to clipboard operation
HTTP-FS-file-server copied to clipboard

How to set IP address?

Open bluelavalamp opened this issue 1 year ago • 3 comments

The IP address is being assigned and I can't figure out how to change it. Problem is my netmask is 255.225.0.0 with machines being on 10.0.X.X. But HTTP-FS is picking 10.12.125.48 as the IP address for the server. Is there a way to change it?

bluelavalamp avatar Sep 06 '24 13:09 bluelavalamp

The application automatically selects the device's IP address. You can only choose between localhost, IPv4, IPv6 in "Settings - Server settings - IP" where "All" is automatic.

The method for determining the IP looks like this

val ipAddressInLocalNetwork: String
        get() {
            val networkInterfaces = NetworkInterface.getNetworkInterfaces().iterator().asSequence()
            val localAddresses = networkInterfaces.flatMap {
                it.inetAddresses.asSequence()
                    .filter { inetAddress ->
                        inetAddress.isSiteLocalAddress && inetAddress.hostAddress?.contains(":") == false &&
                                inetAddress.hostAddress != "127.0.0.1"
                    }
                    .map { inetAddress -> inetAddress.hostAddress }
            }
            return localAddresses.firstOrNull() ?: "127.0.0.1"
        }

In the next version I will experiment and try to give the user a list of all available IPs. (I don't know how successful this will be)

Tiarait avatar Sep 08 '24 16:09 Tiarait

Would it be possible to use the IP address already assigned to the device for WIFI? Or add that selection as an option.

bluelavalamp avatar Sep 23 '24 17:09 bluelavalamp

10.0.0.24

QueenBiah avatar Dec 24 '24 14:12 QueenBiah