network: add getaddr message handling

Respond with known good addresses.
This commit is contained in:
Roman Khimov 2019-09-13 20:38:34 +03:00
parent b2530a4c93
commit b9ff4d929c
3 changed files with 34 additions and 5 deletions

View file

@ -35,7 +35,7 @@ func TestEncodeDecodeAddress(t *testing.T) {
func TestEncodeDecodeAddressList(t *testing.T) {
var lenList uint8 = 4
addrList := &AddressList{make([]*AddressAndTime, lenList)}
addrList := NewAddressList(int(lenList))
for i := 0; i < int(lenList); i++ {
e, _ := net.ResolveTCPAddr("tcp", fmt.Sprintf("127.0.0.1:200%d", i))
addrList.Addrs[i] = NewAddressAndTime(e, time.Now())