A short review;
Your implementation of _buildConnectRequest and _buildAnnounceRequest is missing, it would have been interesting to review that
I am not a big fan of using underscores to denote private methods. If you run version 12 or later of Node, you can prefix with # to denote private functions.
Your code does not support IPV6 at all. You will have to ...
Follow some standards, use code linting (for example ESLint) and code formatting (for example Prettier), try to prevent code duplication as much as possible,
use design patterns and don't complex things. Those things will make your code more readable for others.
There is no right or wrong while the code works and it's easy to read.
(Extension of my comment above)
Ways of improving/optimizations:
What fixApostrophes and fixDashes functions actually try to do is replacing a specific punctuation chars with respective HTML entities.
Instead of those numerous horrifying while loops - a more optimized, concise and extendable approach would be to:
compose a predefined replacement map (where keys are search patterns and ...