aboutsummaryrefslogtreecommitdiff
path: root/tracker
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-07-17 03:05:33 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-07-17 03:05:33 +0200
commit0fe086993b01f7d53c8b226bd1eb5665c1d0c18f (patch)
tree81d1289c4312baa54b3ded4ff5a61a8aaa550df1 /tracker
parentc317718d85c2881dad37dd009c4d690e599a2f34 (diff)
Replace InfoHash with Raw
Diffstat (limited to 'tracker')
-rw-r--r--tracker/messages.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/tracker/messages.go b/tracker/messages.go
index 5f96286..2df0367 100644
--- a/tracker/messages.go
+++ b/tracker/messages.go
@@ -2,6 +2,7 @@ package tracker
import (
"bytes"
+ "crypto/sha1"
"encoding/binary"
"io/ioutil"
"net"
@@ -22,19 +23,19 @@ const (
)
type Request struct {
- InfoHash []byte `query:"info_hash"` // info_hash
- PeerID []byte `query:"peer_id"` // peer_id
- Port int `query:"port,optional"`
- Uploaded int `query:"uploaded,optional"`
- Downloaded int `query:"downloaded,optional"`
- Left int `query:"left,optional"`
- Compact bool `query:"compact,optional"` // always true
- NoPeerID bool `query:"no_peer_id,optional"`
- Event Event `query:"event,optional"`
- IP net.IPAddr `query:"ip,optional"`
- NumWant int `query:"numwant,optional"`
- Key []byte `query:"key,optional"`
- TrackerID []byte `query:"tracker_id,optional"`
+ InfoHash [sha1.Size]byte `query:"info_hash"` // info_hash
+ PeerID []byte `query:"peer_id"` // peer_id
+ Port int `query:"port,optional"`
+ Uploaded int `query:"uploaded,optional"`
+ Downloaded int `query:"downloaded,optional"`
+ Left int `query:"left,optional"`
+ Compact bool `query:"compact,optional"` // always true
+ NoPeerID bool `query:"no_peer_id,optional"`
+ Event Event `query:"event,optional"`
+ IP net.IPAddr `query:"ip,optional"`
+ NumWant int `query:"numwant,optional"`
+ Key []byte `query:"key,optional"`
+ TrackerID []byte `query:"tracker_id,optional"`
}
// we support only compact mode