1
1
mirror of https://github.com/wader/fq.git synced 2024-11-26 21:55:57 +03:00
fq/format/dns/dns_tcp.go
Mattias Wadman 46dca8cdc5 dns: Don't use dns (udp) format for tcp also
Fixes issue with TCP streams being probed as dns over TCP
2022-08-09 18:15:34 +02:00

24 lines
492 B
Go

package dns
import (
"github.com/wader/fq/format"
"github.com/wader/fq/pkg/decode"
"github.com/wader/fq/pkg/interp"
)
func init() {
interp.RegisterFormat(decode.Format{
Name: format.DNS_TCP,
Description: "DNS packet (TCP)",
Groups: []string{format.TCP_STREAM},
DecodeFn: dnsTCPDecode,
})
}
func dnsTCPDecode(d *decode.D, in any) any {
if tsi, ok := in.(format.TCPStreamIn); ok {
tsi.MustIsPort(d.Fatalf, format.TCPPortDomain)
}
return dnsDecode(d, true)
}