mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-30 22:26:42 +00:00
Ignore v6 exit node notification
This commit is contained in:
@@ -107,7 +107,7 @@ func (e *Manager) handleEvent(event *proto.SystemEvent) {
|
||||
handlers := slices.Clone(e.handlers)
|
||||
e.mu.Unlock()
|
||||
|
||||
if event.UserMessage != "" && (enabled || event.Severity == proto.SystemEvent_CRITICAL) {
|
||||
if event.UserMessage != "" && (enabled || event.Severity == proto.SystemEvent_CRITICAL) && !isV6DefaultRoutePartner(event) {
|
||||
title := e.getEventTitle(event)
|
||||
body := event.UserMessage
|
||||
id := event.Metadata["id"]
|
||||
@@ -128,6 +128,14 @@ func (e *Manager) AddHandler(handler Handler) {
|
||||
e.handlers = append(e.handlers, handler)
|
||||
}
|
||||
|
||||
// isV6DefaultRoutePartner reports whether the event is the IPv6 half of a
|
||||
// paired v4/v6 default-route event. Management always pairs ::/0 with 0.0.0.0/0
|
||||
// for exit nodes, so the v4 partner already drives the user-facing toast and
|
||||
// the v6 one is suppressed to avoid a duplicate notification.
|
||||
func isV6DefaultRoutePartner(event *proto.SystemEvent) bool {
|
||||
return event.Category == proto.SystemEvent_NETWORK && event.Metadata["network"] == "::/0"
|
||||
}
|
||||
|
||||
func (e *Manager) getEventTitle(event *proto.SystemEvent) string {
|
||||
var prefix string
|
||||
switch event.Severity {
|
||||
|
||||
Reference in New Issue
Block a user