anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.39k stars 615 forks source link

The operator wants to ban BitTorrent, so they want to wrap the data in a layer during transmission #850

Closed misslipan closed 9 months ago

misslipan commented 12 months ago

I want to use ase encryption to transmit end-to-end block data. Currently, I use hook to connect all connections, but this method will result in slow download and incomplete download data on the download resource end. Do you have a better solution

anacrolix commented 12 months ago

I believe you could do this with your own torrent.Dialer and torrent.Listener. You will lose compatibility with regular BitTorrent clients unless they also use the same encryption you do.

The default for this situation in BitTorrent is to use the message stream encryption. If you believe someone is intentionally banning BitTorrent traffic, set the configuration to allow and require encryption to minimize the chance that your use of BitTorrent is detected.

misslipan commented 12 months ago

image I don't need to be compatible with regular ones, I just need to be able to use it myself. Is PEX this configuration? At present, I have created a hookconn myself. Before sending, I encrypted, received, and decrypted a downloaded file that was damaged

The following are two places where I added hookconn, both in the client.go file

image image

anacrolix commented 12 months ago

If you hook connections to your own wrapping encryption, PEX will work within swarms of peers that are compatible with your own encryption, so there's no need to disable it. Your hooks look like they're in the correct places! If you think this is worth adding as a field in ClientConfig, or Torrent, feel free to open a PR.

anacrolix commented 9 months ago

Okay I think there's nothing else to do here.