Use bencode.List over []interface{}
This commit is contained in:
parent
019c87182e
commit
c36974d515
2 changed files with 7 additions and 7 deletions
|
@ -29,17 +29,17 @@ func TestPublicAnnounce(t *testing.T) {
|
|||
|
||||
// Add one seeder.
|
||||
peer := basePeer("peer1", true)
|
||||
expected := baseResponse(1, 0, []interface{}{})
|
||||
expected := baseResponse(1, 0, bencode.List{})
|
||||
checkResponse(peer, expected, srv, t)
|
||||
|
||||
// Add another seeder.
|
||||
peer = basePeer("peer2", true)
|
||||
expected = baseResponse(2, 0, []interface{}{})
|
||||
expected = baseResponse(2, 0, bencode.List{})
|
||||
checkResponse(peer, expected, srv, t)
|
||||
|
||||
// Add a leecher.
|
||||
peer = basePeer("peer3", false)
|
||||
expected = baseResponse(2, 1, []interface{}{
|
||||
expected = baseResponse(2, 1, bencode.List{
|
||||
bencode.Dict{
|
||||
"ip": "127.0.0.1",
|
||||
"peer id": "peer1",
|
||||
|
@ -62,7 +62,7 @@ func TestPublicAnnounce(t *testing.T) {
|
|||
|
||||
// Check seeders.
|
||||
peer = basePeer("peer3", false)
|
||||
expected = baseResponse(1, 1, []interface{}{
|
||||
expected = baseResponse(1, 1, bencode.List{
|
||||
bencode.Dict{
|
||||
"ip": "127.0.0.1",
|
||||
"peer id": "peer2",
|
||||
|
@ -91,7 +91,7 @@ func basePeer(id string, seed bool) params {
|
|||
}
|
||||
}
|
||||
|
||||
func baseResponse(seeders, leechers int64, peers []interface{}) bencode.Dict {
|
||||
func baseResponse(seeders, leechers int64, peers bencode.List) bencode.Dict {
|
||||
dict := bencode.Dict{
|
||||
"complete": seeders,
|
||||
"incomplete": leechers,
|
||||
|
|
|
@ -138,7 +138,7 @@ func TestPrivateAnnounce(t *testing.T) {
|
|||
"incomplete": int64(2),
|
||||
"interval": int64(1800),
|
||||
"min interval": int64(900),
|
||||
"peers": []interface{}{
|
||||
"peers": bencode.List{
|
||||
bencode.Dict{
|
||||
"ip": "127.0.0.1",
|
||||
"peer id": "-TR2820-l71jtqkl8xx1",
|
||||
|
@ -164,7 +164,7 @@ func TestPrivateAnnounce(t *testing.T) {
|
|||
"incomplete": int64(2),
|
||||
"interval": int64(1800),
|
||||
"min interval": int64(900),
|
||||
"peers": []interface{}{
|
||||
"peers": bencode.List{
|
||||
bencode.Dict{
|
||||
"ip": "127.0.0.1",
|
||||
"peer id": "-TR2820-l71jtqkl8xx1",
|
||||
|
|
Loading…
Reference in a new issue