mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-07 22:19:08 +02: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)
|
handlers := slices.Clone(e.handlers)
|
||||||
e.mu.Unlock()
|
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)
|
title := e.getEventTitle(event)
|
||||||
body := event.UserMessage
|
body := event.UserMessage
|
||||||
id := event.Metadata["id"]
|
id := event.Metadata["id"]
|
||||||
@@ -128,6 +128,14 @@ func (e *Manager) AddHandler(handler Handler) {
|
|||||||
e.handlers = append(e.handlers, 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 {
|
func (e *Manager) getEventTitle(event *proto.SystemEvent) string {
|
||||||
var prefix string
|
var prefix string
|
||||||
switch event.Severity {
|
switch event.Severity {
|
||||||
|
|||||||
Reference in New Issue
Block a user