mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-19 03:27:50 +01:00
Alpha 2 release. Includes Traverse message according to latest Whitepaper 0.8.
Send and traverse code needs some cleanup.
This commit is contained in:
15
Bootstrap.go
15
Bootstrap.go
@@ -240,15 +240,16 @@ func (peer *PeerInfo) cmdResponseBootstrapFindSelf(msg *MessageResponse, closest
|
||||
if contactArbitraryPeer(closePeer.PublicKey, []*net.UDPAddr{{IP: closePeer.IP, Port: int(port)}}) {
|
||||
// Blacklist the target Peer ID, IP:Port for contact in the next 10 minutes.
|
||||
// TODO
|
||||
}
|
||||
|
||||
// If NAT is detected and the port is not forwarded, send a Traverse message.
|
||||
// NAT detection is the same algorithm as connection.IsBehindNAT.
|
||||
if closePeer.PortReportedExternal == 0 && closePeer.Port != closePeer.PortReportedInternal {
|
||||
// TODO send traverse message
|
||||
//fmt.Printf("FIND_SELF Traverse message needed for target %s target port %d internal %d\n", closePeer.IP.String(), closePeer.Port, closePeer.PortReportedInternal)
|
||||
// If NAT is detected and the port is not forwarded, send a Traverse message.
|
||||
// NAT detection is the same algorithm as connection.IsBehindNAT.
|
||||
if closePeer.PortReportedExternal == 0 && closePeer.Port != closePeer.PortReportedInternal {
|
||||
// TODO: PortExternal needs to be guaranteed. send() needs to be broken up.
|
||||
if raw, err := createVirtualAnnouncement(msg.MessageRaw.connection.Network, closePeer.PublicKey, &bootstrapFindSelf{}); err == nil {
|
||||
peer.sendTraverse(raw, closePeer.PublicKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user