Skip to content

Commit 382c106

Browse files
Use IPv4 addresses if possible (#3812)
1 parent 65564a4 commit 382c106

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

message/outbound_msg_builder.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,13 @@ func (b *outMsgBuilder) Handshake(
246246
) (OutboundMessage, error) {
247247
subnetIDBytes := make([][]byte, len(trackedSubnets))
248248
encodeIDs(trackedSubnets, subnetIDBytes)
249-
// TODO: Use .AsSlice() after v1.12.x activates.
250-
addr := ip.Addr().As16()
251249
return b.builder.createOutbound(
252250
&p2p.Message{
253251
Message: &p2p.Message_Handshake{
254252
Handshake: &p2p.Handshake{
255253
NetworkId: networkID,
256254
MyTime: myTime,
257-
IpAddr: addr[:],
255+
IpAddr: ip.Addr().AsSlice(),
258256
IpPort: uint32(ip.Port()),
259257
IpSigningTime: ipSigningTime,
260258
IpNodeIdSig: ipNodeIDSig,
@@ -306,11 +304,9 @@ func (b *outMsgBuilder) GetPeerList(
306304
func (b *outMsgBuilder) PeerList(peers []*ips.ClaimedIPPort, bypassThrottling bool) (OutboundMessage, error) {
307305
claimIPPorts := make([]*p2p.ClaimedIpPort, len(peers))
308306
for i, p := range peers {
309-
// TODO: Use .AsSlice() after v1.12.x activates.
310-
ip := p.AddrPort.Addr().As16()
311307
claimIPPorts[i] = &p2p.ClaimedIpPort{
312308
X509Certificate: p.Cert.Raw,
313-
IpAddr: ip[:],
309+
IpAddr: p.AddrPort.Addr().AsSlice(),
314310
IpPort: uint32(p.AddrPort.Port()),
315311
Timestamp: p.Timestamp,
316312
Signature: p.Signature,

0 commit comments

Comments
 (0)