Add no route event
This commit is contained in:
parent
688d4da4b7
commit
59b86002c4
2 changed files with 9 additions and 3 deletions
|
|
@ -15,8 +15,9 @@ type (
|
|||
)
|
||||
|
||||
const (
|
||||
EventInterfaceUpdate = 1
|
||||
EventAndroidVPNUpdate = 2
|
||||
EventInterfaceUpdate = iota
|
||||
EventAndroidVPNUpdate
|
||||
EventNoRoute
|
||||
)
|
||||
|
||||
type NetworkUpdateMonitor interface {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package tun
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/netip"
|
||||
"sync"
|
||||
|
|
@ -84,7 +85,11 @@ func (m *defaultInterfaceMonitor) delayCheckUpdate() error {
|
|||
if err != nil {
|
||||
m.networkMonitor.NewError(context.Background(), E.Cause(err, "update interfaces"))
|
||||
}
|
||||
return m.checkUpdate()
|
||||
err = m.checkUpdate()
|
||||
if errors.Is(err, ErrNoRoute) {
|
||||
m.emit(EventNoRoute)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultInterfaceMonitor) updateInterfaces() error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue