client_test.go | 2 ++ cmd/torrent/main.go | 5 ++--- mse/mse.go | 5 +++-- diff --git a/client_test.go b/client_test.go index 7f292d9a01c17d86c339bfa86cbb070ed131c42b..682b33f56991e7efc02a0894a94e7142e4ad94c6 100644 --- a/client_test.go +++ b/client_test.go @@ -943,6 +943,8 @@ addPeers() waitTotalConns(6) } +// Creates a file containing its own name as data. Make a metainfo from that, adds it to the given +// client, and returns a magnet link. func makeMagnet(t *testing.T, cl *Client, dir string, name string) string { os.MkdirAll(dir, 0770) file, err := os.Create(filepath.Join(dir, name)) diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 67b5122bbff75eb653f00fe44d1a94199ef5feee..caac4855bb15a4d15b7027276a9625ebcd5b31af 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -200,9 +200,8 @@ } defer client.Close() go exitSignalHandlers(client) - // Write status on the root path on the default HTTP muxer. This will be - // bound to localhost somewhere if GOPPROF is set, thanks to the envpprof - // import. + // Write status on the root path on the default HTTP muxer. This will be bound to localhost + // somewhere if GOPPROF is set, thanks to the envpprof import. http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { client.WriteStatus(w) }) diff --git a/mse/mse.go b/mse/mse.go index d9b87803182726df3ce0d841e287ac8c3539f6ee..b51a5aaf45d1500bb02cbbc715cf9b4687f47ab6 100644 --- a/mse/mse.go +++ b/mse/mse.go @@ -25,8 +25,8 @@ const ( maxPadLen = 512 - CryptoMethodPlaintext CryptoMethod = 1 - CryptoMethodRC4 CryptoMethod = 2 + CryptoMethodPlaintext CryptoMethod = 1 // After header obfuscation, drop into plaintext + CryptoMethodRC4 CryptoMethod = 2 // After header obfuscation, use RC4 for the rest of the stream AllSupportedCrypto = CryptoMethodPlaintext | CryptoMethodRC4 ) @@ -557,6 +557,7 @@ // returns false or exhausted. type SecretKeyIter func(callback func(skey []byte) (more bool)) func DefaultCryptoSelector(provided CryptoMethod) CryptoMethod { + // We prefer plaintext for performance reasons. if provided&CryptoMethodPlaintext != 0 { return CryptoMethodPlaintext }