netbird icon indicating copy to clipboard operation
netbird copied to clipboard

Refactor Route IDs

Open lixmal opened this issue 1 year ago • 0 comments

Describe your changes

We have at least 3 distinct IDs in use for routes:

  • ID in route.Route, which is the ID in the database
  • NetID in route.Route, which is the Name/ID in the dashboard
  • HAUniqueID which is a combination of Route.NetID and Route.Network

Having so many IDs using all string it's hard to distinguish them from each other. This PR refactors the IDs to use dedicated types to avoid mixing them up. Conversions from/to string must be done explicitly. Conversions between the types must not happen.

Issue ticket number and link

Checklist

  • [ ] Is it a bug fix
  • [ ] Is a typo/documentation fix
  • [ ] Is a feature enhancement
  • [x] It is a refactor
  • [ ] Created tests that fail without the change (if possible)
  • [ ] Extended the README / documentation, if necessary

lixmal avatar Apr 25 '24 16:04 lixmal