]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Comments
authorMatt Joiner <anacrolix@gmail.com>
Fri, 19 Jul 2019 03:04:10 +0000 (13:04 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 19 Jul 2019 03:04:10 +0000 (13:04 +1000)
client_test.go
cmd/torrent/main.go
mse/mse.go

index 7f292d9a01c17d86c339bfa86cbb070ed131c42b..682b33f56991e7efc02a0894a94e7142e4ad94c6 100644 (file)
@@ -943,6 +943,8 @@ func TestSetMaxEstablishedConn(t *testing.T) {
        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))
index 67b5122bbff75eb653f00fe44d1a94199ef5feee..caac4855bb15a4d15b7027276a9625ebcd5b31af 100644 (file)
@@ -200,9 +200,8 @@ func main() {
        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)
        })
index d9b87803182726df3ce0d841e287ac8c3539f6ee..b51a5aaf45d1500bb02cbbc715cf9b4687f47ab6 100644 (file)
@@ -25,8 +25,8 @@ import (
 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 @@ func ReceiveHandshake(rw io.ReadWriter, skeys SecretKeyIter, selectCrypto Crypto
 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
        }