(n *Nylon, node state.NodeId, wgEndpoint conn.Endpoint)
| 87 | } |
| 88 | |
| 89 | func handleProbePing(n *Nylon, node state.NodeId, wgEndpoint conn.Endpoint) { |
| 90 | if node == n.LocalCfg.Id { |
| 91 | return |
| 92 | } |
| 93 | // check if link exists |
| 94 | for _, neigh := range n.RouterState.Neighbours { |
| 95 | for _, dep := range neigh.Eps { |
| 96 | dep := dep.AsNylonEndpoint() |
| 97 | ap, err := dep.DynEP.Get() |
| 98 | if err == nil && ap == wgEndpoint.DstIPPort() && neigh.Id == node { |
| 99 | // we have a link |
| 100 | |
| 101 | // refresh wireguard ep |
| 102 | dep.WgEndpoint = wgEndpoint |
| 103 | |
| 104 | wasInactive := !dep.IsActive() |
| 105 | dep.Renew() |
| 106 | if wasInactive { |
| 107 | ComputeRoutes(n.RouterState, n) |
| 108 | n.UpdateNeighbour(node) |
| 109 | } |
| 110 | |
| 111 | if n.DBG_log_probe { |
| 112 | n.Log.Debug("probe from", "addr", ap.String()) |
| 113 | } |
| 114 | return |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | // create a new link if we dont have a link |
| 119 | for _, neigh := range n.RouterState.Neighbours { |
| 120 | if neigh.Id == node { |
| 121 | newEp := state.NewEndpoint(state.NewDynamicEndpoint(wgEndpoint.DstIPPort().String()), true, wgEndpoint, &n.RouterTunables) |
| 122 | newEp.Renew() |
| 123 | neigh.Eps = append(neigh.Eps, newEp) |
| 124 | // push route update to improve convergence time |
| 125 | ComputeRoutes(n.RouterState, n) |
| 126 | n.UpdateNeighbour(node) |
| 127 | return |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | func handleProbePong(n *Nylon, node state.NodeId, token uint64, ep conn.Endpoint) { |
| 133 | // check if link exists |
no test coverage detected