Send RI-Upds to peers #14
2 changed files with 21 additions and 23 deletions
25
main.go
25
main.go
|
@ -297,18 +297,7 @@ func main() {
|
|||
continue
|
||||
}
|
||||
|
||||
peer := &router.AURPPeer{
|
||||
Transport: &aurp.Transport{
|
||||
LocalDI: localDI,
|
||||
RemoteDI: aurp.IPDomainIdentifier(raddr.IP),
|
||||
LocalConnID: nextConnID,
|
||||
},
|
||||
UDPConn: ln,
|
||||
ConfiguredAddr: peerStr,
|
||||
RemoteAddr: raddr,
|
||||
ReceiveCh: make(chan aurp.Packet, 1024),
|
||||
RouteTable: routes,
|
||||
}
|
||||
peer := router.NewAURPPeer(routes, ln, peerStr, raddr, localDI, nil, nextConnID)
|
||||
aurp.Inc(&nextConnID)
|
||||
peersMu.Lock()
|
||||
peers[udpAddrFromNet(raddr)] = peer
|
||||
|
@ -404,17 +393,7 @@ func main() {
|
|||
continue
|
||||
}
|
||||
// New peer!
|
||||
pr = &router.AURPPeer{
|
||||
Transport: &aurp.Transport{
|
||||
LocalDI: localDI,
|
||||
RemoteDI: dh.SourceDI, // platinum rule
|
||||
LocalConnID: nextConnID,
|
||||
},
|
||||
UDPConn: ln,
|
||||
RemoteAddr: raddr,
|
||||
ReceiveCh: make(chan aurp.Packet, 1024),
|
||||
RouteTable: routes,
|
||||
}
|
||||
pr = router.NewAURPPeer(routes, ln, "", raddr, localDI, dh.SourceDI, nextConnID)
|
||||
aurp.Inc(&nextConnID)
|
||||
peers[ra] = pr
|
||||
goPeerHandler(pr)
|
||||
|
|
|
@ -129,6 +129,25 @@ type AURPPeer struct {
|
|||
sendRetries int
|
||||
}
|
||||
|
||||
func NewAURPPeer(routes *RouteTable, udpConn *net.UDPConn, peerAddr string, raddr *net.UDPAddr, localDI, remoteDI aurp.DomainIdentifier, connID uint16) *AURPPeer {
|
||||
if remoteDI == nil {
|
||||
remoteDI = aurp.IPDomainIdentifier(raddr.IP)
|
||||
}
|
||||
return &AURPPeer{
|
||||
Transport: &aurp.Transport{
|
||||
LocalDI: localDI,
|
||||
RemoteDI: remoteDI,
|
||||
LocalConnID: connID,
|
||||
},
|
||||
UDPConn: udpConn,
|
||||
ConfiguredAddr: peerAddr,
|
||||
RemoteAddr: raddr,
|
||||
ReceiveCh: make(chan aurp.Packet, 1024),
|
||||
RouteTable: routes,
|
||||
pendingEvents: make(chan aurp.EventTuple, 1024),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *AURPPeer) addPendingEvent(ec aurp.EventCode, route *Route) {
|
||||
// Don't advertise routes to AURP peers to other AURP peers
|
||||
if route.AURPPeer != nil {
|
||||
|
|
Loading…
Reference in a new issue