func (s *TCPServer) Serve() error {
	srv := &dns.Server{
		Addr:    s.address,
		Net:     "tcp",
		Handler: s.handler,
	}
	zap.L().Named("server").Info("listening and serving",
		zap.String("proto", "tcp"),
		zap.String("address", s.address),
	)
	return srv.ListenAndServe()
}
Serve starts the TCP DNS server
package main
import (
	"github.com/go-yaml/yaml"
	"github.com/miekg/dns"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
	"net/url"
	"os"
	"time"
)
type Server interface {
	Serve() error
	Type() string
	Address() string
	Handler() *Handler
	SetHandler(handler *Handler)
}
type ServerImpl struct {
	address string
	handler *Handler
}
func (s *ServerImpl) Address() string {
	return s.address
}
func (s *ServerImpl) Handler() *Handler {
	return s.handler
}
func (s *ServerImpl) SetHandler(handler *Handler) {
	s.handler = handler
}
type UDPServer struct {
	ServerImpl
}
type TCPServer struct {
	ServerImpl
}
func (s *UDPServer) Serve() error {
	srv := &dns.Server{
		Addr:    s.address,
		Net:     "udp",
		Handler: s.handler,
	}
	zap.L().Named("server").Info("listening and serving",
		zap.String("proto", "udp"),
		zap.String("address", s.address),
	)
	return srv.ListenAndServe()
}
func (s *UDPServer) Type() string {
	return "udp"
}