1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-08-10 13:46:46 +02:00

Add comment, improve error message

This commit is contained in:
Mustafa Enes Batur 2025-06-05 14:41:30 +02:00
parent 7610e8c398
commit fe97600c88

View File

@ -210,18 +210,19 @@ func (ns *noiseServer) NoisePollNetMapHandler(
}
node, err := ns.headscale.db.GetNodeByMachineKey(ns.machineKey)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
httpError(writer, NewHTTPError(http.StatusNotFound, "node not found", nil))
return
}
httpError(writer, err)
return
}
// Ensure the NodeKey in the request matches the one associated with the machine key from the Noise session
if node.NodeKey != mapRequest.NodeKey {
httpError(writer, NewHTTPError(http.StatusNotFound, "node does not belong to machine key", nil))
httpError(writer, NewHTTPError(http.StatusNotFound, "node key in request does not match the one associated with this machine key", nil))
return
}
@ -274,6 +275,7 @@ func (ns *noiseServer) NoiseRegistrationHandler(
return &regReq, resp
} else {
}
return &regReq, regErr(err)
}