Fortunately I found a nice subnet checking library by @natevancouver
and after a facepalm from my side (check the issues 🤦♂️) that also worked flawless in the browser environment I was basically using.
Top-level
Fortunately I found a nice subnet checking library by @natevancouver 7 comments
Problem 4: Having all that, we should be done, should not we? Well… no! I still hear nothing! Playing a sound was surprisingly difficult, given browsers usually now limit that websites (browser extensions are basically websites) should not play a random sound out of nowhere. I am still trying here, but depending on how you load the sound file, you may end up getting weird errors. The worst thing is that you need to copy the sound element to have multiple sound effects starting at the same time, so they can overlap each other. All in all, note that due to the way ad blockers are/will be handled in Chrome, some of these things I did will not be possible. This includes modifying by injecting a header + the DNS API is not even there in Chrome. For what this means, check out this: (Thread is a response to https://twitter.com/bert_hu_bert/status/1561650689474011136, who made the same thing as a C app that works across applications.) @rugk where are you loading your sound and what codec are you using? I found that using some codecs will not work out of the box on all OSes when playing in the background page for https://github.com/freaktechnik/notification-sounds |
Problem 3: However, having a list of IPs and access to web requests (the listener is simple) is not enough.
As browsers are too high-level, we only get the URL/domain here. However, we need to get the IP here.
Fortunately Firefox (only!) has an API: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/dns/resolve