Skip to content

[Spotify not working حل مشکل اسپاتیفای] Intercepting DNS traffic to solve issues with some apps like spotify (using fakeDNS) #1019

Closed
@pulsarice

Description

@pulsarice

برای راه ساده حل مشکل اسپاتیفای این کامنت رو ببینید

Spotify blocks requests from many datacenter IPs and we have to route its traffic through Warp.
For some reason, xray can't sniff the domain name in some of Spotify's requests. The only solution that I have found is to use fakeDNS.
But using fakeDNS for all domains can cause DNS corruption and make some apps misbehave after VPN disconnection.
The solution is to intercept DNS traffic on port 53 and forward it to core's built-in DNS and using fakeDNS only for those specific domains.

Currently I'm doing it by manually editing the config file.
It would be nice if these configurations could be implemented in the GUI:

{
  "dns": {
    "tag": "dns_inbound",
    "queryStrategy": "UseIPv4",
    "servers": [
      "8.8.8.8",
      "1.1.1.1",
      {
        "address": "fakedns",
        "domains": [ //specifying domains which should be answered via fakedns
          "domain:spotify.com"
        ],
        "skipFallback": true // avoid using fakedns for all other domains
      }
    ]
  },
  "outbounds": [
    {
      "tag": "direct"
    },
    {
      "tag": "proxy",
    },
    {
      "protocol": "dns", // any DNS request routed to this outbound will be served by internal DNS server. It will also provide DNS caching.
      "tag": "dns-out"
    },
    {
      "tag": "warp",
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "dns_inbound"
        ],
        "outboundTag": "proxy" // setting default outbound for internal DNS server's traffic.
      },
      {
        "type": "field",
        "port": "53", // intercepting clients' DNS traffic
        "outboundTag": "dns-out"
      },
      {
        "type": "field",
        "port": "853", // blocking dns over TLS so the client falls back to unencrypted DNS
        "outboundTag": "blocked"
      },
      {
        "type": "field",
        "outboundTag": "warp",
        "domain": [
          "domain:spotify.com" // now that all requests to Spotify is detected correctly, we can route it to warp
        ]
      }
    ]
  },
  "fakedns": [ // this part is optional as xray-core will automatically assign a pool for fakedns when it's called upon.
    {
      "ipPool": "198.18.0.0/16",
      "poolSize": 65535
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestto deployTo be deployed during the time

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions