Code Monkey home page Code Monkey logo

Comments (5)

povsister avatar povsister commented on July 22, 2024 1

However, dns tags do not work this way. The tag is only used for routing, and not participating in DNS server selection.

I know exactly what i am doing.
I have two domestic DNS servers(one as primary and one as backup) with same rules/tags configured within the DNS server list, and I am intending to identitify and direct send domestic DNS traffic.

I have read the code of DNS processing, and I am sure those 2 domestic servers will be used in sequence for domestic sites.

it should be more like a bug with the parsing logic of v2ray convert, rather than the DNS itself.

I agree with that, too.
As I have mentioned the "merging" behaviour referred in documentation, I don't think the same-tag-merging shoud be applied to DNS configurations.

Can you check whether you can get expected behavior without any sorts of merging, just run with the config as-is?

I am using a workaround right now, by configuring different tag on different servers.
It works as expected now.
For example:

{
// omitted

  "dns": {
    "queryStrategy": "UseIPv4",
    "fallbackStrategy": "disabled-if-any-match",
    "domainMatcher": "mph",
    "servers": [
      {
         "address": "aaa.bbb.ccc.ddd", // DNS from ISP
         "port": 53,
         "domains": [
           "geosite:cn"
         ],
         "tag": "dns-domestic"
      },
      {
         "address": "114.114.114.114", // 114 public DNS as backup
         "port": 53,
         "domains": [
           "geosite:cn"
         ],
         "tag": "dns-domestic-backup", //  <- WORKAROUND HERE
      },
      {
         "address": "https://1.1.1.1/dns-query", // Cloudflare DoH as default fallback
         "tag": "dns-international",
      }
    ]
  },
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "domainMatcher": "mph",
    "rules": [
      // omitted
      {
        "type": "field",
        "inboundTag": ["dns-domestic", "dns-domestic-backup"], // <- Don't forget to add tag here.
        "outboundTag": "direct"   // always direct sent domestic site DNS queries
      },
      {
        "type": "field",
        "inboundTag": "dns-international",
        "outboundTag": "proxy"  // proxy international cf DoH queries
      }
      // omitted
    ]
  }

// omitted
}

from v2ray-core.

Vigilans avatar Vigilans commented on July 22, 2024 1

See it. I would seek some time to look into the code and propose a fix for it.

from v2ray-core.

Vigilans avatar Vigilans commented on July 22, 2024

What I actually got after configuration parsed:

What are your reproduction steps for What I actually got after configuration parsed? How is the second configuration generated/printed?

from v2ray-core.

povsister avatar povsister commented on July 22, 2024

What are your reproduction steps for What I actually got after configuration parsed? How is the second configuration generated/printed?

The actual effective configuration is exported by adding stdout print code before+after config load.
It can also be verified by adding some print code during config build.

From what I have seen, the issue reported here can be easily reproduced with v4 JSON config format.
Other config formats are not tested.

from v2ray-core.

Vigilans avatar Vigilans commented on July 22, 2024

@povsister Can reproduce with v2ray convert.

However, dns tags do not work this way. The tag is only used for routing, and not participating in DNS server selection. It should be more like a bug with the parsing logic of v2ray convert, rather than the DNS itself.

Can you check whether you can get expected behavior without any sorts of merging, just run with the config as-is?

from v2ray-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.