add keepAlive option for udp Listener

This commit is contained in:
ginuerzh
2022-04-03 22:23:27 +08:00
parent fc1e6e8ff2
commit 6340d5198f
9 changed files with 109 additions and 79 deletions

View File

@ -197,7 +197,10 @@ func (ex *exchanger) exchange(ctx context.Context, msg []byte) ([]byte, error) {
c = tls.Client(c, ex.options.tlsConfig)
}
conn := &dns.Conn{Conn: c}
conn := &dns.Conn{
UDPSize: 1024,
Conn: c,
}
if _, err = conn.Write(msg); err != nil {
return nil, err