package main import ( "context" "fmt" "github.com/miekg/dns" ) func main() { client := dns.Client{ ReadTimeout: 5* time.Second, } ctx := context.Background() msg := dns.Msg{} msg.SetQuestion("example.com.", dns.TypeA) response, _, err := client.ExchangeContext(ctx, &msg, "8.8.8.8:53") if err != nil { fmt.Println("Error querying DNS server:", err) return } /* Handle response */ }In this example, a dns.Client object is created with a ReadTimeout of 5 seconds. The client then sends a DNS query to the Google DNS server (8.8.8.8) and waits up to 5 seconds for a response. If a response is received within the timeout period, it is stored in the "response" variable for further processing. Overall, the "github.com/miekg/dns" package provides useful tools for manipulating DNS messages in Go, including the ability to set a ReadTimeout for clients to prevent getting stuck waiting for a response from a server.