-
-
Notifications
You must be signed in to change notification settings - Fork 905
[client] Extend Darwin network monitoring with wakeup detection #4636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request extends Darwin network monitoring functionality by adding system wakeup detection capabilities alongside the existing network change monitoring. The implementation monitors macOS system wakeups by polling the kern.sleeptime
sysctl value and detecting changes that indicate the system has resumed from sleep.
- Creates Darwin-specific network monitoring with wakeup detection
- Separates Darwin implementation from other BSD systems
- Adds logging for network monitoring startup
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
client/internal/networkmonitor/monitor.go | Adds logging message for network monitoring startup |
client/internal/networkmonitor/check_change_darwin.go | New Darwin-specific implementation with route monitoring and wakeup detection |
client/internal/networkmonitor/check_change_bsd.go | Updates build constraint to exclude Darwin systems |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
log.Infof("Network monitor: default route changed: via %s, interface %s", route.Gw, intf) | ||
return | ||
case unix.RTM_DELETE: | ||
if nexthopv4.Intf != nil && route.Gw.Compare(nexthopv4.IP) == 0 || nexthopv6.Intf != nil && route.Gw.Compare(nexthopv6.IP) == 0 { |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logical expression lacks parentheses to clarify operator precedence. Consider grouping the conditions: (nexthopv4.Intf != nil && route.Gw.Compare(nexthopv4.IP) == 0) || (nexthopv6.Intf != nil && route.Gw.Compare(nexthopv6.IP) == 0)
if nexthopv4.Intf != nil && route.Gw.Compare(nexthopv4.IP) == 0 || nexthopv6.Intf != nil && route.Gw.Compare(nexthopv6.IP) == 0 { | |
if (nexthopv4.Intf != nil && route.Gw.Compare(nexthopv4.IP) == 0) || (nexthopv6.Intf != nil && route.Gw.Compare(nexthopv6.IP) == 0) { |
Copilot uses AI. Check for mistakes.
if _, err := hasher.Write(data); err != nil { | ||
return 0, err | ||
} |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hasher.Write()
method never returns an error for FNV hash implementations. The error check is unnecessary and can be simplified to just hasher.Write(data)
.
if _, err := hasher.Write(data); err != nil { | |
return 0, err | |
} | |
hasher.Write(data) |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Describe your changes
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__