resolve

command
v0.0.0-...-78384c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

Domain Resolution Tool

The resolve tool lets you resolve domain names with custom DNS resolvers and using configurable transports.

Usage:

Usage: resolve [flags...] <domain>
  -resolver string
        The address of the recursive DNS resolver to use in host:port format. If the port is missing, it's assumed to be 53
  -tcp
        Force TCP when querying the DNS resolver
  -transport string
        The transport for the connection to the recursive DNS resolver
  -type string
        The type of the query (A, AAAA, CNAME, NS or TXT). (default "A")
  -v    Enable debug output

Lookup the IPv4 for www.rferl.org using the system resolver:

$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve www.rferl.org     
104.102.138.8

Use -type aaaa to lookup the IPv6:

$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type aaaa www.rferl.org
2600:141b:1c00:1098::1317
2600:141b:1c00:10a1::1317

Use -resolver to specify which resolver to use. In this case we use Google's Public DNS:

$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -resolver 8.8.8.8 www.rferl.org
104.102.138.83

It's possible to specify a proxy to connect to the resolver using the -transport flag. This is very helpful for experimentation. In the example below, we resolve via a remote proxy in Russia. When using a remote server, you must also specify the resolver to use. Note in the example output how the domain is blocked with a CNAME to fz139.ttk.ru

$ KEY=ss://[REDACTED OUTLINE KEY]
$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type CNAME -transport "$KEY" -resolver 8.8.8.8 www.rferl.org
fz139.ttk.ru.

Using Quad9 in the Russian server bypasses the blocking:

$ KEY=ss://[REDACTED OUTLINE KEY]
$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type CNAME -transport "$KEY" -resolver 9.9.9.9 www.rferl.org
e4887.dscb.akamaiedge.net.

It's possible to specify non-standard ports. For example, OpenDNS supports port 443:

$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type CNAME -resolver 208.67.222.222:443 www.rferl.org
e4887.dscb.akamaiedge.net.

However, it seems UDP on alternate ports is blocked in our remote test proxy:

$ KEY=ss://[REDACTED OUTLINE KEY]
$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type CNAME -transport "$KEY" -resolver 208.67.222.222:443 www.rferl.org
2023/10/13 19:04:18 Failed to lookup CNAME: lookup www.rferl.org on 208.67.222.222:443: could not create PacketConn: could not connect to endpoint: dial udp [REDACTED ADDRESS]: i/o timeout
exit status 1

By forcing TCP with the -tcp flag, you can make it work again:

$ KEY=ss://[REDACTED OUTLINE KEY]
$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type CNAME -transport "$KEY" -resolver 208.67.222.222:443 -tcp www.rferl.org
e4887.dscb.akamaiedge.net.

Forcing TCP lets you use stream fragmentation. In this example, we split the first 20 bytes:

$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/resolve -type CNAME -tcp -transport "split:20" -resolver 208.67.222.222:443 www.rferl.org
e4887.dscb.akamaiedge.net.

You can see that the domain name in the query got split:

image

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL