Ejemplo n.º 1
0
func main() {

	var ext = make(getdns.Extension)
	ext["dnssec_return_status"] = true

	ctx, err := getdns.ContextCreate()
	if err != nil {
		fmt.Println("ContextCreate() failed", err)
		return
	}

	qname := os.Args[1]

	rc, response := getdns.Address(ctx, qname, ext)
	if rc != getdns.RETURN_GOOD {
		fmt.Printf("getdns.AddressSync() failed: %d\n", rc)
	} else {
		for _, addr := range getdns.JustAddresses(response) {
			fmt.Println(addr)
		}
		// getdns.PrintResponseDict(response)
		// fmt.Printf("JustAddresses: %s\n", getdns.JustAddresses(response))
	}

	return
}
Ejemplo n.º 2
0
func main() {

	var ext = make(getdns.Extension)
	ext["dnssec_return_status"] = true

	ctx, err := getdns.ContextCreate()
	if err != nil {
		fmt.Println("ContextCreate() failed", err)
		return
	}
	ctx.SetServer("8.8.8.8")

	qname, qtype := os.Args[1], os.Args[2]

	rc, response := getdns.General(ctx, qname, qtype, ext)
	if rc != getdns.RETURN_GOOD {
		fmt.Printf("getdns.GeneralSync() failed: %d\n", rc)
	} else {
		for i, reply := range response.RepliesTree {
			fmt.Println("Response:", i)
			fmt.Println(reply)
		}
	}

	return
}
Ejemplo n.º 3
0
func main() {

	var ext = make(getdns.Extension)
	ext["dnssec_return_status"] = true

	ctx, err := getdns.ContextCreate()
	if err != nil {
		fmt.Println("ContextCreate() failed", err)
		return
	}

	service := os.Args[1]

	rc, response := getdns.Service(ctx, service, ext)
	if rc != getdns.RETURN_GOOD {
		fmt.Printf("getdns.ServieSync() failed: %d\n", rc)
	} else {
		for i, reply := range response.RepliesTree {
			fmt.Println("Response:", i)
			fmt.Println(reply)
		}
	}

	return
}
Ejemplo n.º 4
0
func main() {

	var ext getdns.Extension

	ctx, err := getdns.ContextCreate()
	if err != nil {
		fmt.Println("ContextCreate() failed", err)
		return
	}

	qname, qtype := os.Args[1], os.Args[2]

	rc, response := getdns.General(ctx, qname, qtype, ext)
	if rc != getdns.RETURN_GOOD {
		fmt.Printf("getdns.GeneralSync() failed: %d\n", rc)
	} else {
		getdns.PrintResponseDict(response)
	}

	return
}