I was pulling my hair out doing it all from scratch, especially on the torrent side, but then I found out there's a reference torrent implementation that does HLS streaming, tracking, DHT node stuff all in one, so I'm kind of using that now and modifying it for nostr.