Perhaps someone has ideas for improvements? It’s possible, say, that the regex is slightly off, but so far, it’s worked for everything I gave it in real life!
I would advise against v2 onion addresses, although I’m not entirely sure they are completely, absolutely unavailable these days. I know TBB doesn’t allow them anymore.
Actually, I always forget how much (one or two?) backslashes one needs to use in CL to hape properly escaped regex special characters, so it can still be “incorrect”
Another tip: instead of merely customizing proxy-mode, you can subclass it and use that instead, in case, say, you have more than just Tor for a proxy.
(define-mode tor-proxy-mode (nyxt/proxy-mode:proxy-mode)
"Set proxy to local Tor SOCKS5 proxy."
((nyxt/proxy-mode:proxy (make-instance 'proxy
:url (quri:uri "socks5://localhost:9050")
:allowlist '("localhost")
:proxied-downloads-p t))))
It should be easy to test the correct number of escapes by running a minimal regex containing a single dot against a character other than dot and seeing whether it matches.
That actually answers exactly what I was wondering, I just expressed myself poorly. More clearly stated my question was whether one could write rules such that Nyxt resolves I2P addresses via the I2P network, and Tor addresses via the Tor network.