The relay tests weren't really testing anything related to the relays, as the connection stack could connect over the local network, and the relay logic never triggered.
This PR modifies the test where both client and server follow a normal flow, ensuring they cannot connect over LAN or holepunch, also adding explicit checks to ensure this.
This also means that I don't know how to fix the relay tests where the holepunching is cancelled at one side, as those too get saved by that code and currently make no use at all of the relay
The relay tests weren't really testing anything related to the relays, as the connection stack could connect over the local network, and the relay logic never triggered.
This PR modifies the test where both client and server follow a normal flow, ensuring they cannot connect over LAN or holepunch, also adding explicit checks to ensure this.
Note: I had to add a new, hidden
_noHolepunching
option to the DHT server, because whenever the holepunch code at the end of the_addHandshake
function executed, server and client connected directly anyway (https://github.com/holepunchto/hyperdht/blob/66341e7f028189d1418c1ec49635b14d208a26f1/lib/server.js#L402-L407)This also means that I don't know how to fix the relay tests where the holepunching is cancelled at one side, as those too get saved by that code and currently make no use at all of the relay