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))
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)
})
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
)
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
}