]> Sergey Matveev's repositories - btrtrc.git/commitdiff
BEP20
authorMatt Joiner <anacrolix@gmail.com>
Wed, 2 Oct 2013 10:12:05 +0000 (20:12 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 2 Oct 2013 10:12:05 +0000 (20:12 +1000)
client.go

index 0a190925deab9b43f254a42a8f57da04248cd2e7..f2d7621594bba1eab9fa810942b1cd92f4b840ec 100644 (file)
--- a/client.go
+++ b/client.go
@@ -21,6 +21,7 @@ const (
        PieceHash   = crypto.SHA1
        maxRequests = 10
        chunkSize   = 0x4000 // 16KiB
+       BEP20       = "-GT0000-"
 )
 
 type InfoHash [20]byte
@@ -273,7 +274,8 @@ func NewClient(dataDir string) *client {
                torrentFinished: make(chan InfoHash),
                actorTask:       make(chan func()),
        }
-       _, err := rand.Read(c.PeerId[:])
+       o := copy(c.PeerId[:], BEP20)
+       _, err := rand.Read(c.PeerId[o:])
        if err != nil {
                panic("error generating peer id")
        }