Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ensure dns:v2.0.0-beta works with TCP over 53 for truncated messages #132

@qdm12

Description

@qdm12

A test to do this:

package dnssec

import (
	"context"
	"net"
	"testing"

	"github.com/miekg/dns"
)

func Test(t *testing.T) {
	ctx := context.Background()
	dialer := &net.Dialer{}
	netConn, err := dialer.DialContext(ctx, "udp", "1.1.1.1:53")
	if err != nil {
		t.Error(err)
	}
	dnsConn := &dns.Conn{Conn: netConn}

	client := &dns.Client{}
	request := new(dns.Msg)
	request.SetQuestion("berkeley.edu.", dns.TypeDNSKEY)
	response, _, err := client.ExchangeWithConn(request, dnsConn)
	if err != nil {
		t.Error(err)
	}
	t.Log(response.Truncated)

	err = dnsConn.Close()
	if err != nil {
		t.Error(err)
	}
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions