When something is decentralized, it's very hard to not think about the edge cases, because many clients could implement things wrong, no?

Reply to this note

Please Login to reply.

Discussion

Its URL complies with the standard, and the trailing xxx.onion is part of the URL pathname. I cannot identify it as an onion URL. If I simply classify all URLs containing "onion" as onion relays, some normal relays with "onion" in their domain names might also be misclassified as onion relays.

Edge cases like these are impossible to cover completely. An error in one client should not be the burden of other clients.

.onion/ is the term you are looking for. There must be prefix/suffix match text comparison functions, if it breaks the URL down. Scheme, address, path and query. I find it hard to believe that JavaScript lacks an equivalent of Go's url.URL type. Then it is literally just a suffix match on the address element.

ws://ws/oxtrdevav64z64yb7x6rjg4ntzqjhedm5b5zjqulugknhzr46ny2qbad.onion

The issue is that there's an extra ws/ in the URL, which actually makes xxx.onion part of the path, not the host.

JavaScript does have a URL class too. To be more rigorous, I should extract the host and match the suffix there.