feature: Support use of FQDN resolution with DNS and mDNS - #1760
Conversation
52acb36 to
16c499c
Compare
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
16c499c to
b676386
Compare
|
Need to add:
|
|
Thanks a lot for this pr. I really appreciate all the work you have done in the last days/weeks! Some general issues i found accross this pr is the formatting for go files. All indentation is done with 2 spaces. You can use go's build in formattor called cd backend/
go fmt ./...Which will format all files automatically. Depending on your editor you can enable Also using I've left comments on all the parts where I'd make changes. I have not yet tested the implementation (just quickly changed the IP from my pi to Regarding the feedback you requested:
How do we handle changes in interfaces? When we store nics in the database and those nics become unavailable (new host or other network card) it will cause issues.
I've tested this a couple days back and resolution failed on timeouts below 100ms on my local network. I think setting it to 1-2 seconds should be plenty. Again, thank you for your work :) |
| placeholder={m.device_general_netmask()} | ||
| class="input" | ||
| maxlength="16" | ||
| pattern={netmaskPattern} |
There was a problem hiding this comment.
This will create a merge conflict with my new commits from issue #1761.
Make sure to pull in the latest commits and keep your changes.
There was a problem hiding this comment.
I rebased and resolved the conflicts, but now I need to replace my migration file. But I'm going to work on the regexp for international domains first.
|
I will take care of all the formatting and try
We can identify the interface by the IP assigned to the host/server itself, so the optional input field on the form would take an IP. Or we can just leave it at broadcasting on all interfaces, but the OCD in me doesn't like the idea of sending so many packets out at once unnecessarily. BUT from what I can tell from Googling, there is 0 harm in keeping it this way. Packets are very small, and the occurrences of this (when a WOL is triggered) is rare.
Great! I'll set the context timeout to 2 then.
❤️ |
RFC 6762 says |
|
@seriousm4x Earlier in the other thread we spoke about mDNS queries flooding the network but I realized I made an oversight in my calculations. With 13 devices that are powered on, responses are going to be cached for the TTL (80% of 120 secs) which mitigates the spam factor a bit. However, if all the devices are powered off, there is nothing to cache and UpSnap will send out 260 mDNS queries per minute, which is a pretty high number. Any ideas on how to better handle when devices are off? |
We could save the last known ip address and ping that. When a device is offline, we could only do an mdns request every x ping. Ip leases don't change that often so it's quite likely that once the device comes back up it will get the same ip. So only quering mdns every x ping would reduce the amount of queries. |
In my experience, that varies a lot, depending on the network configuration and how many devices are joining/leaving the network. The longer the device is powered off, the greater the likelihood its IP will be handed out by the DHCP server to some other random device that needs an IP. In a busy network, it can happen very quickly. Example: I manage a family member's network in his coffee shop, and that is high traffic, high turnover for DHCP, so IPs get reassigned very, very quickly. But even if I were to save the previous IP and continue using that when it goes offline, if/when the IP were to get reassigned to another device, then we're just stuck in the same boat again with flooding queries trying to get the new IP. I'm going to keep thinking about a way to fix this. I've made the other changes discussed above, but am going to hold off on pushing the update. |
Resolves: #1753
Submitting as a DRAFT since it is still being worked on:
ResolveToIPAddrfunction that takes one string parameter - either FQDN or IP.net.DefaultResolveris made.net.DefaultResolverwill perform both a DNS and mNDS lookup.ResolveToIPAddrand added valid actions if the IP string is""wakeUDPno longer sends 6 packets for WOL..localname cannot be resolved via mDNS, and as a result there is no IP address. Without an IP address of the device, we cannot send a unicast (routed) packet, and we also cannot determine the broadcast address. Broadcasting to 255.255.255.255 does not work (reliably) because the OS will send the packet to either the default network interface, or the one with the lowest metric (behavior varies depending on the OS.).localdevice,wakeUDPwill send (2) WOL packets (ports 7 and 9) to every interface (except loopback, non-broadcast capable, and inactive/down).To Do/Need Feedback:
Interfacethat would allow specifying the local/host interface for broadcasting the WOL packet.