Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lepz0r opened this issue Aug 4, 2022 · 11 comments
Open

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

lepz0r opened this issue Aug 4, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@lepz0r
Copy link

lepz0r commented Aug 4, 2022

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

@jckefan
Copy link

jckefan commented Aug 5, 2022

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

@xvzc
Copy link
Owner

xvzc commented Aug 5, 2022

is this like the same request as #32 ?

@lepz0r
Copy link
Author

lepz0r commented Aug 5, 2022

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

@xvzc
Copy link
Owner

xvzc commented Aug 11, 2022

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

@xvzc
Copy link
Owner

xvzc commented Aug 11, 2022

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

@lepz0r
Copy link
Author

lepz0r commented Aug 11, 2022

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

@xvzc
Copy link
Owner

xvzc commented Aug 12, 2022

i meant it either. just mistyped

@xvzc
Copy link
Owner

xvzc commented Aug 12, 2022

okay, then let me take a look on it

@r3a1d3a1
Copy link

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.

@xvzc xvzc added the enhancement New feature or request label Jan 30, 2023
@vukitoso
Copy link

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

@nokia8801
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants