[PR #2932] [MERGED] [client] Code cleaning in net pkg #20895

Open
opened 2026-08-05 05:07:50 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2932
Author: @pappz
Created: 11/22/2024
Status: Merged
Merged: 11/26/2024
Merged by: @pappz

Base: mainHead: net-code-cleaning


📝 Commits (5)

📊 Changes

23 files changed (+245 additions, -181 deletions)

View changed files

client/iface/bind/control_android.go (+12 -0)
📝 client/internal/routemanager/systemops/systemops_linux.go (+1 -1)
📝 go.mod (+1 -1)
📝 go.sum (+2 -2)
util/net/conn.go (+31 -0)
util/net/dial.go (+58 -0)
📝 util/net/dial_ios.go (+0 -0)
util/net/dialer_android.go (+0 -25)
📝 util/net/dialer_dial.go (+0 -70)
util/net/dialer_init_android.go (+5 -0)
📝 util/net/dialer_init_linux.go (+1 -1)
📝 util/net/dialer_init_nonlinux.go (+1 -0)
util/net/env.go (+29 -0)
util/net/listen.go (+37 -0)
📝 util/net/listen_ios.go (+0 -0)
util/net/listener_android.go (+0 -26)
util/net/listener_init_android.go (+6 -0)
📝 util/net/listener_init_linux.go (+1 -1)
📝 util/net/listener_init_nonlinux.go (+1 -0)
📝 util/net/listener_listen.go (+0 -25)

...and 3 more files

📄 Description

Describe your changes

Code cleaning around the util/net package. The goal was to write a more understandable source code but modify nothing on the logic.
Protect the WireGuard UDP listeners with marks.
The implementation can support the VPN permission revocation events in thread safe way. It will be important if we start to support the running time route and DNS update features.

  • uniformize the file name convention: [struct_name] _ [functions] _ [os].go
  • code cleaning in net_linux.go
  • move env variables to env.go file

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/2932 **Author:** [@pappz](https://github.com/pappz) **Created:** 11/22/2024 **Status:** ✅ Merged **Merged:** 11/26/2024 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `net-code-cleaning` --- ### 📝 Commits (5) - [`d176685`](https://github.com/netbirdio/netbird/commit/d176685e52ae27256d5a2389f342da119e792f6e) Code cleaning in net pkg - [`a9dfed4`](https://github.com/netbirdio/netbird/commit/a9dfed4ff78b9101565c8912397864f47b4a482d) Add comment - [`a0550d1`](https://github.com/netbirdio/netbird/commit/a0550d1f496c3397d5ad954249c4ff5c72fca323) Typo fix - [`4eda224`](https://github.com/netbirdio/netbird/commit/4eda2242065d31b29b68cba5894ec194c213d58d) Fix formated print - [`af71982`](https://github.com/netbirdio/netbird/commit/af71982878dae31bc8205b63ce9cdbec4d6dfd83) [client] Android exit node via P2P (#2937) ### 📊 Changes **23 files changed** (+245 additions, -181 deletions) <details> <summary>View changed files</summary> ➕ `client/iface/bind/control_android.go` (+12 -0) 📝 `client/internal/routemanager/systemops/systemops_linux.go` (+1 -1) 📝 `go.mod` (+1 -1) 📝 `go.sum` (+2 -2) ➕ `util/net/conn.go` (+31 -0) ➕ `util/net/dial.go` (+58 -0) 📝 `util/net/dial_ios.go` (+0 -0) ➖ `util/net/dialer_android.go` (+0 -25) 📝 `util/net/dialer_dial.go` (+0 -70) ➕ `util/net/dialer_init_android.go` (+5 -0) 📝 `util/net/dialer_init_linux.go` (+1 -1) 📝 `util/net/dialer_init_nonlinux.go` (+1 -0) ➕ `util/net/env.go` (+29 -0) ➕ `util/net/listen.go` (+37 -0) 📝 `util/net/listen_ios.go` (+0 -0) ➖ `util/net/listener_android.go` (+0 -26) ➕ `util/net/listener_init_android.go` (+6 -0) 📝 `util/net/listener_init_linux.go` (+1 -1) 📝 `util/net/listener_init_nonlinux.go` (+1 -0) 📝 `util/net/listener_listen.go` (+0 -25) _...and 3 more files_ </details> ### 📄 Description ## Describe your changes Code cleaning around the util/net package. The goal was to write a more understandable source code but modify nothing on the logic. Protect the WireGuard UDP listeners with marks. The implementation can support the VPN permission revocation events in thread safe way. It will be important if we start to support the running time route and DNS update features. - uniformize the file name convention: [struct_name] _ [functions] _ [os].go - code cleaning in net_linux.go - move env variables to env.go file ## Issue ticket number and link ### Checklist - [x] 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 05:07:50 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#20895