Setting device's availability status during onboarding
Description
-
CLI Command Update (
cmd/onboard.go
):- A new flag
--available
(or-x
) has been added to the onboard command. This flag enables users to set their device's availability status as either 'available' or 'unavailable' during onboarding. - The
setOnboardData
function is updated to process theIsAvailable
field from theCapacityForNunet
struct. - Input validation is implemented for the
--available
flag so that it only accepts 'true' or 'false' as valid inputs.
- A new flag
-
Onboarding Handler Modification (
onboarding/handler.go
):- The
Onboard
function is modified to extract theIsAvailable
status from the incoming request and update thePeerData
struct. - After updating
PeerData
, thelibp2p.UpdateKadDHT()
function is invoked to ensure the new availability status is propagated across the libp2p network.
- The
-
Model Struct Updates (
models/onboarding.go
&models/machine.go
):- The
CapacityForNunet
andPeerData
structs are changed to include theIsAvailable
field, aligning with the new feature.
- The
Ultimately, this feature allows users to control the availability of their devices right from the onboarding stage.
Checklist
-
I have update updated the @version
string in main.go. See https://semver.org/ -
I have update CHANGELOG.md with a short description of changes. -
I have run swag init
to update the swagger docs.
Closes #257 (closed)
Edited by Dagim Sisay