fix: running issue and no network on android (#264)

This commit is contained in:
mzz 2024-01-01 20:45:44 +08:00 committed by GitHub
parent 5360893c3d
commit e466295096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -59,10 +59,6 @@ func tryUpdateSystemDnsElapse(k time.Duration) (err error) {
func tryUpdateSystemDns() (err error) { func tryUpdateSystemDns() (err error) {
dnsConf := dnsReadConfig("/etc/resolv.conf") 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{} systemDns = netip.AddrPort{}
for _, s := range dnsConf.servers { for _, s := range dnsConf.servers {
ipPort := netip.MustParseAddrPort(s) ipPort := netip.MustParseAddrPort(s)

View File

@ -141,7 +141,10 @@ func (s *Dns) InitUpstreams() {
for _, upstream := range s.upstream { for _, upstream := range s.upstream {
wg.Add(1) wg.Add(1)
go func(upstream *UpstreamResolver) { go func(upstream *UpstreamResolver) {
upstream.GetUpstream() _, err := upstream.GetUpstream()
if err != nil {
s.log.WithError(err).Debugln("Dns.GetUpstream")
}
wg.Done() wg.Done()
}(upstream) }(upstream)
} }

View File

@ -213,7 +213,7 @@ func NewControlPlane(
// Bind to WAN // Bind to WAN
if len(global.WanInterface) > 0 { if len(global.WanInterface) > 0 {
if err = core.setupSkPidMonitor(); err != nil { 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 { for _, ifname := range global.WanInterface {
if err = core.bindWan(ifname, global.AutoConfigKernelParameter); err != nil { if err = core.bindWan(ifname, global.AutoConfigKernelParameter); err != nil {