From e466295096c5b1ae84ccc392bf2eaae5997802ad Mon Sep 17 00:00:00 2001 From: mzz <2017@duck.com> Date: Mon, 1 Jan 2024 20:45:44 +0800 Subject: [PATCH] fix: running issue and no network on android (#264) --- common/netutils/dns.go | 4 ---- component/dns/dns.go | 5 ++++- control/control_plane.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/netutils/dns.go b/common/netutils/dns.go index 621a094..a9b18d0 100644 --- a/common/netutils/dns.go +++ b/common/netutils/dns.go @@ -59,10 +59,6 @@ func tryUpdateSystemDnsElapse(k time.Duration) (err error) { func tryUpdateSystemDns() (err error) { dnsConf := dnsReadConfig("/etc/resolv.conf") - if len(dnsConf.servers) == 0 { - err = fmt.Errorf("no valid dns server in /etc/resolv.conf") - return err - } systemDns = netip.AddrPort{} for _, s := range dnsConf.servers { ipPort := netip.MustParseAddrPort(s) diff --git a/component/dns/dns.go b/component/dns/dns.go index 6a2951e..973b248 100644 --- a/component/dns/dns.go +++ b/component/dns/dns.go @@ -141,7 +141,10 @@ func (s *Dns) InitUpstreams() { for _, upstream := range s.upstream { wg.Add(1) go func(upstream *UpstreamResolver) { - upstream.GetUpstream() + _, err := upstream.GetUpstream() + if err != nil { + s.log.WithError(err).Debugln("Dns.GetUpstream") + } wg.Done() }(upstream) } diff --git a/control/control_plane.go b/control/control_plane.go index dddac44..5828060 100644 --- a/control/control_plane.go +++ b/control/control_plane.go @@ -213,7 +213,7 @@ func NewControlPlane( // Bind to WAN if len(global.WanInterface) > 0 { if err = core.setupSkPidMonitor(); err != nil { - return nil, err + log.WithError(err).Warnln("cgroup2 is not enabled; pname routing cannot be used") } for _, ifname := range global.WanInterface { if err = core.bindWan(ifname, global.AutoConfigKernelParameter); err != nil {