MCPcopy Create free account
hub / github.com/encodeous/nylon / handleIPCProbe

Function handleIPCProbe

core/ipc_handler.go:414–434  ·  view source on GitHub ↗
(n *Nylon, req *protocol.ProbeRequest)

Source from the content-addressed store, hash-verified

412}
413
414func handleIPCProbe(n *Nylon, req *protocol.ProbeRequest) *protocol.IpcResponse {
415 neigh := n.RouterState.GetNeighbour(state.NodeId(req.PeerId))
416 if neigh == nil {
417 return errResponse(fmt.Sprintf("peer %q is not a neighbour", req.PeerId))
418 }
419 results := make([]*protocol.EndpointProbeResult, 0, len(neigh.Eps))
420 for _, ep := range neigh.Eps {
421 nep := ep.AsNylonEndpoint()
422 addr := nep.DynEP.Value
423 err := n.Probe(neigh.Id, nep, true)
424 r := &protocol.EndpointProbeResult{Address: addr, Success: err == nil}
425 if err != nil {
426 r.Error = err.Error()
427 }
428 results = append(results, r)
429 }
430 return &protocol.IpcResponse{
431 Ok: true,
432 Response: &protocol.IpcResponse_Probe{Probe: &protocol.ProbeResponse{Results: results}},
433 }
434}
435
436func handleIPCReload(n *Nylon, req *protocol.ReloadRequest) *protocol.IpcResponse {
437 data, err := os.ReadFile(n.ConfigPath)

Callers 1

HandleNylonIPCFunction · 0.85

Calls 6

NodeIdTypeAlias · 0.92
errResponseFunction · 0.85
GetNeighbourMethod · 0.80
ProbeMethod · 0.80
AsNylonEndpointMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected