ogham / dog

A command-line DNS client.
https://dns.lookup.dog/
European Union Public License 1.2
6.15k stars 175 forks source link

`Name or service not known` Error when querying a DoH service at a non-standard port. #57

Open IceCodeNew opened 3 years ago

IceCodeNew commented 3 years ago

# DOG_DEBUG=trace dog -q example.com -H --nameserver="https://1.0.0.1:443/dns-query" --time
[INFO dog] Running with options -> Options {
    requests: RequestGenerator {
        inputs: Inputs {
            domains: [
                Labels {
                    segments: [
                        (
                            7,
                            "example",
                        ),
                        (
                            3,
                            "com",
                        ),
                    ],
                },
            ],
            types: [
                1,
            ],
            classes: [
                IN,
            ],
            resolvers: [
                Specified(
                    "https://1.0.0.1:443/dns-query",
                ),
            ],
            transport_types: [
                HTTPS,
            ],
        },
        txid_generator: Random,
        edns: SendAndHide,
        protocol_tweaks: ProtocolTweaks {
            set_authoritative_flag: false,
            set_authentic_flag: false,
            set_checking_disabled_flag: false,
            udp_payload_size: None,
        },
    },
    measure_time: true,
    format: Text(
        Automatic,
        TextFormat {
            format_durations: true,
        },
    ),
}
[INFO dns_transport::https] Opening TLS socket to "1.0.0.1:443"
Error [network]: failed to lookup address information: Name or service not known
Ran in 5ms
IceCodeNew commented 3 years ago

Only works if we do not specific port here:

# dog -q example.com -H --nameserver="https://1.0.0.1/dns-query" --time
A example.com. 19h16m23s   93.184.216.34
Ran in 717ms

Seems this issue is related to https://github.com/ogham/dog/issues/15

IceCodeNew commented 3 years ago

Sadly the DoH service I would like to test does not serve on 443 port. I have to specify the port someway.

ogham commented 3 years ago

I see you found issue #15 :) Like I said there, eschewing --port was done on purpose but turned out to be a bad idea. Thanks for the detailed report.

seiry commented 2 years ago

Hi @ogham , I think that "port in doh" is different from the "--port in query" of #15 . For the doh situation, if i want to test my self-hosted doh server that deployed on a non-stand port other than 443

For example both dog -T @8.8.8.8 google.com and dog -T @8.8.8.8:53 google.com and even dog -T @8.8.8.8:666 google.com is fine.

But dog -H @https://8.8.8.8/dns-query google.com will work, while dog -H @https://8.8.8.8:443/dns-query google.com wont