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

DNS Resolution service #9

Open
Jorropo opened this issue Sep 9, 2020 · 2 comments
Open

DNS Resolution service #9

Jorropo opened this issue Sep 9, 2020 · 2 comments
Labels
Milestone

Comments

@Jorropo
Copy link
Collaborator

Jorropo commented Sep 9, 2020

No description provided.

@Jorropo Jorropo added the feature label Sep 9, 2020
@Jorropo Jorropo added this to the 1.0 milestone Sep 9, 2020
@cpacia
Copy link

cpacia commented Sep 9, 2020

This is how I was going to handle it:

func NewTorResover(proxy string) *madns.Resolver {
	return &madns.Resolver{
		Backend: &net.Resolver{
			PreferGo: true,
			Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
				d := net.Dialer{
					Timeout: time.Millisecond * time.Duration(10000),
				}
				return d.DialContext(ctx, network, proxy)
			},
		},
	}
}

With:

tor.StartConf{
		ExtraArgs:       []string{"--DNSPort", "2121"},
}

And then you can set the global libp2p name resolution using:

madns.DefaultResolver = NewTorResover("localhost:2121")

Not a big fan of global vars but without any changes to libp2p I'm not sure there's a better way. Downside is this does not resolve TXT records as far as I can tell.

@Jorropo
Copy link
Collaborator Author

Jorropo commented Sep 10, 2020

Not a big fan of global vars but without any changes to libp2p I'm not sure there's a better way.

I'm not a big either, I guess we can create a DNSResolverOption in the libp2p basic host, and ensure routed/circuit host use the underlying basic host for that.

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

No branches or pull requests

2 participants