SpoofDPI icon indicating copy to clipboard operation
SpoofDPI copied to clipboard

Option to disable built-in DNS resolver & use system DNS

Open lepz0r opened this issue 2 years ago • 11 comments

For users that already use encrypted DNS resolver like dnscrypt-proxy & stubby

lepz0r avatar Aug 04 '22 21:08 lepz0r

OMG! Yes, I also was about to make the same feature request!

jckefan avatar Aug 05 '22 05:08 jckefan

is this like the same request as #32 ?

xvzc avatar Aug 05 '22 14:08 xvzc

is this like the same request as #32 ?

I think it's different, #32 allows you to specify DoH's resolver template while this request allows you to completely disable DoH & use system's DNS

lepz0r avatar Aug 05 '22 15:08 lepz0r

so, do you guys locally have your own dns severs ?

xvzc avatar Aug 11 '22 05:08 xvzc

should i add an option like --use-system-proxy or what kinda option would it be?

xvzc avatar Aug 11 '22 05:08 xvzc

should i add an option like --use-system-proxy or what kinda option would it be?

--use-system-dns would be good for this feature

lepz0r avatar Aug 11 '22 11:08 lepz0r

i meant it either. just mistyped

xvzc avatar Aug 12 '22 00:08 xvzc

okay, then let me take a look on it

xvzc avatar Aug 12 '22 00:08 xvzc

A simple hack in the meantime. Replace the dns.go file contents in the doh folder with this:

package doh

import (
	dns "github.com/Focinfi/go-dns-resolver"

	"errors"
	"regexp"
)

func Init() {
	dns.Config.SetTimeout(uint(5))
	dns.Config.RetryTimes = uint(2)
}

func Lookup(domain string) (string, error) {
	ipRegex := "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"

	if r, _ := regexp.MatchString(ipRegex, domain); r {
		return domain, nil
	}

	if results, err := dns.Exchange(domain, "127.0.0.1:53", dns.TypeA); err == nil {
		if len(results) < 1 {
			return "", errors.New(" couldn't resolve the domain")
		}
		return results[0].Content, nil
	} else {
		return "", err
	}
}

N.B. change '127.0.0.1:53' to point to your local DNS server.

r3a1d3a1 avatar Nov 29 '22 00:11 r3a1d3a1

How can I disable DOH and use a local DNS server on port 53?

vukitoso avatar Sep 25 '23 13:09 vukitoso

Please add an option for this. I too use dnscrpyt-proxy with a custom configuration and blocklist/whitelist and I can't get this and it to work together. Something like a --use-system-dns switch would be great.

nokia8801 avatar Jan 14 '24 14:01 nokia8801