#{SOLVED} Trying to get IP from authoritative NS

6 messages · Page 1 of 1 (latest)

robust hazel
#

Hello!
I'm trying to get the IP from Namecheap authoritative NS.

I'm not sure I'm doing it right but my thought process was:

  1. resolve the DNS servers to endpoints
  2. call to resolve with those NSs IPs calling net.get_dns_records_from_nameservers (from core:net)

This is how I did it:

package main

import "core:net"
import "core:fmt"

main :: proc() {
    ns1, res_err1 := net.resolve_ip4("dns1.registrar-servers.com")
    if res_err1 != nil {
        fmt.printfln("error retrieving IP = %s", res_err1)
        return
    }

    ns2, res_err2 := net.resolve_ip4("dns2.registrar-servers.com") 
    if res_err2 != nil {
        fmt.printfln("main - ns:\nerror retrieving IP = %s", res_err2)
        return
    }

    fmt.printfln("%s\n%s", ns1, ns2)

    name_servers := []net.Endpoint{ns1, ns2}

    records, get_records_error := net.get_dns_records_from_nameservers(
        "shroomander.com",
        .DNS_TYPE_A,
        name_servers,
        []net.DNS_Record{}
    )

    if get_records_error != nil {
        fmt.printfln("main - error retrieving dns - %s", get_records_error)
        return
    }

    defer net.destroy_dns_records(records)

    if len(records) == 0 {
        fmt.println("main - No records found")
    } else {
        for record in records {
            fmt.printfln("main - IP = %s", record)
        }
    }
}

The response was:

%!s(Endpoint=Endpoint{address = [156, 154, 132, 200], port = 0})
%!s(Endpoint=Endpoint{address = [156, 154, 133, 200], port = 0})
main - No records found

I recognize the IPs as being the correct ones, but should find the IP for shroomander.com
Can anyone tell me what I'm getting wrong?

Thanks!

river thunder
#

simple dig

#

perhaps thats an issue

robust hazel
robust hazel
#

Ok aparently I just had to change the port to 53