2021-09-28 12:42:01 +02:00
|
|
|
package netxlite
|
2021-09-09 21:24:27 +02:00
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
2021-09-28 10:47:59 +02:00
|
|
|
// DNSTransport represents an abstract DNS transport.
|
|
|
|
type DNSTransport interface {
|
2021-09-09 21:24:27 +02:00
|
|
|
// RoundTrip sends a DNS query and receives the reply.
|
|
|
|
RoundTrip(ctx context.Context, query []byte) (reply []byte, err error)
|
|
|
|
|
2021-09-29 20:21:25 +02:00
|
|
|
// RequiresPadding returns whether this transport needs padding.
|
2021-09-09 21:24:27 +02:00
|
|
|
RequiresPadding() bool
|
|
|
|
|
2021-09-29 20:21:25 +02:00
|
|
|
// Network is the network of the round tripper (e.g. "dot").
|
2021-09-09 21:24:27 +02:00
|
|
|
Network() string
|
|
|
|
|
2021-09-29 20:21:25 +02:00
|
|
|
// Address is the address of the round tripper (e.g. "1.1.1.1:853").
|
2021-09-09 21:24:27 +02:00
|
|
|
Address() string
|
|
|
|
|
2021-09-29 20:21:25 +02:00
|
|
|
// CloseIdleConnections closes idle connections, if any.
|
2021-09-09 21:24:27 +02:00
|
|
|
CloseIdleConnections()
|
|
|
|
}
|