mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2026-01-03 09:49:04 +08:00
fix panic on nil defaultInterfaceMonitor
This commit is contained in:
parent
e9efee0746
commit
60dc6f4528
@ -30,6 +30,9 @@ func HandleInterfaceChange(_ *control.Interface, _ int) {
|
||||
}
|
||||
|
||||
func getDefaultInterfaceGuid() (string, error) {
|
||||
if DefaultIfcMonitor == nil {
|
||||
return "", E.New("No default interface monitor")
|
||||
}
|
||||
ifc := DefaultIfcMonitor.DefaultInterface()
|
||||
if ifc == nil {
|
||||
log.Println("Default interface is nil!")
|
||||
@ -53,6 +56,9 @@ func getDefaultInterfaceGuid() (string, error) {
|
||||
}
|
||||
|
||||
func getDefaultInterfaceLUID() (winipcfg.LUID, error) {
|
||||
if DefaultIfcMonitor == nil {
|
||||
return 0, E.New("No default interface monitor")
|
||||
}
|
||||
ifc := DefaultIfcMonitor.DefaultInterface()
|
||||
if ifc == nil {
|
||||
log.Println("Default interface is nil!")
|
||||
|
||||
@ -15,6 +15,10 @@ import (
|
||||
var DefaultIfcMonitor tun.DefaultInterfaceMonitor
|
||||
|
||||
func monitorForUnderlyingDNS(customDNS []netip.Addr) {
|
||||
if DefaultIfcMonitor == nil {
|
||||
log.Println("Default interface monitor not available!")
|
||||
return
|
||||
}
|
||||
ifc := DefaultIfcMonitor.DefaultInterface()
|
||||
if ifc == nil {
|
||||
log.Println("Default interface is nil!")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user