Below is a single‑file, ~200‑line Rust program that gives you both a central index server and a peer client in the spirit of the original Napster:
- Central server keeps an in‑memory map file → Vec<Peer>.
- Each peer starts a tiny file server, registers its song list, can search, and then pulls files directly from the chosen peer.
- Blocking I/O, zero external crates, so it compiles with plain
rustc
. - Run as
napster server 0.0.0.0:8080
for the index, andnapster client 127.0.0.1:8080 ./music 9000
on each peer (share dir + local port).
Educational use only. No authentication, encryption, or rate‑limiting—so never expose to the open Internet.