Skip to content

Setting device's availability status during onboarding

Description

  1. 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 the IsAvailable field from the CapacityForNunet struct.
    • Input validation is implemented for the --available flag so that it only accepts 'true' or 'false' as valid inputs.
  2. Onboarding Handler Modification (onboarding/handler.go):
    • The Onboard function is modified to extract the IsAvailable status from the incoming request and update the PeerData struct.
    • After updating PeerData, the libp2p.UpdateKadDHT() function is invoked to ensure the new availability status is propagated across the libp2p network.
  3. Model Struct Updates (models/onboarding.go & models/machine.go):
    • The CapacityForNunet and PeerData structs are changed to include the IsAvailable field, aligning with the new feature.

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

Merge request reports