[PR #680] Mobile prerefactor #2833

Open
opened 2025-11-20 08:04:07 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/680

State: closed
Merged: Yes


Describe your changes

Small code cleaning in the iface package. These changes necessary to get a clean code in case if we involve more platforms.
The OS related functions has been distributed into separate files and it has been mixed with not OS related logic. The goal is to get a clear picture of the layer between Wirequard and business logic.

Main problem

Unfortunately the Android implementation of Wrieguard tool does not fit with the original Wireguard approach.
Until now the service communicated with the wireguard device via wgctrl package on every OS. In Android it is not possible so we have to create some new function what doing almost the same what the wgctrl did. I would like to provide a well layered solution.

Changes

  • Remove unused variables
  • Set to private some variables what is not used externally
  • We have OS related implementations so remove the 'if runtime.GOOS != "windows"' expression
  • Eliminate spagetti style function calls inside WGIface struct across several files.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/680 **State:** closed **Merged:** Yes --- ## Describe your changes Small code cleaning in the iface package. These changes necessary to get a clean code in case if we involve more platforms. The OS related functions has been distributed into separate files and it has been mixed with not OS related logic. The goal is to get a clear picture of the layer between Wirequard and business logic. ## Main problem Unfortunately the Android implementation of Wrieguard tool does not fit with the original Wireguard approach. Until now the service communicated with the wireguard device via wgctrl package on every OS. In Android it is not possible so we have to create some new function what doing almost the same what the wgctrl did. I would like to provide a well layered solution. ## Changes - Remove unused variables - Set to private some variables what is not used externally - We have OS related implementations so remove the 'if runtime.GOOS != "windows"' expression - Eliminate spagetti style function calls inside WGIface struct across several files. ## 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
saavagebueno added the pull-request label 2025-11-20 08:04:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2833