diff --git a/client.go b/client.go index 975106f4..e3182fad 100644 --- a/client.go +++ b/client.go @@ -839,11 +839,11 @@ func (cl *Client) sendInitialMessages(conn *connection, torrent *Torrent) { Encryption: !cl.config.DisableEncryption, Port: cl.incomingPeerPort(), MetadataSize: torrent.metadataSize(), + // TODO: We can figured these out specific to the socket + // used. + Ipv4: pp.CompactIp(cl.config.PublicIp4.To4()), + Ipv6: cl.config.PublicIp6.To16(), } - // TODO: We can figured these out specific to the socket - // used. - copy(msg.Ipv4[:], cl.config.PublicIp4.To4()) - copy(msg.Ipv6[:], cl.config.PublicIp6.To16()) if !cl.config.DisablePEX { msg.M[pp.ExtensionNamePex] = pexExtendedId } diff --git a/peer_protocol/extended.go b/peer_protocol/extended.go index a02a96f6..ae5f124e 100644 --- a/peer_protocol/extended.go +++ b/peer_protocol/extended.go @@ -1,5 +1,7 @@ package peer_protocol +import "net" + // http://www.bittorrent.org/beps/bep_0010.html type ( ExtendedHandshakeMessage struct { @@ -13,8 +15,8 @@ type ( // a connection to send this. Port int `bencode:"p,omitempty"` YourIp CompactIp `bencode:"yourip,omitempty"` - Ipv4 [4]byte `bencode:"ipv4,omitempty"` - Ipv6 [16]byte `bencode:"ipv6,omitempty"` + Ipv4 CompactIp `bencode:"ipv4,omitempty"` + Ipv6 net.IP `bencode:"ipv6,omitempty"` } ExtensionName string