Skip to content

Reset DefaultResolver on Android CGO builds#335

Open
madeye wants to merge 1 commit into
masterfrom
fix/android-cgo-dns-reset
Open

Reset DefaultResolver on Android CGO builds#335
madeye wants to merge 1 commit into
masterfrom
fix/android-cgo-dns-reset

Conversation

@madeye

@madeye madeye commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds dns_android.go (//go:build android && cgo) that resets net.DefaultResolver after v2ray-core's Android DNS workaround runs.
  • Fixes DNS loopback / poisoning when the plugin runs under Android VPN protect with a domain server address (v2ray-plugin-android#44).

Context

v2ray-core overrides net.DefaultResolver to hardcode 8.8.8.8 on all Android builds (v2fly/v2ray-core#572). That is only needed without CGO. This plugin always builds with CGO_ENABLED=1, so the override is harmful.

Upstream fixed it with a build-tag change in v2fly/v2ray-core#3755 (v5.52.0+), which requires Go 1.25.5+. Until core can be bumped, undo the override from main (main package inits run after dependency package inits).

Test plan

  • Build plugin for Android ABIs with CGO_ENABLED=1
  • Connect with a domain-name server address under shadowsocks-android VPN protect
  • Confirm resolution does not pin only to 8.8.8.8 / DNS loopback

v2ray-core hardcodes 8.8.8.8 as the system DNS on all Android builds
(v2fly/v2ray-core#572). That is only needed without CGO; with CGO it
causes DNS loopback/poisoning under Android VPN protect
(shadowsocks/v2ray-plugin-android#44).

Upstream fixed this with a build tag in v5.52.0 (v2fly/v2ray-core#3755),
which requires Go 1.25.5+. Until we can bump core, undo the override
from main after dependency package inits run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant