DEVELOPMENT ENVIRONMENT

~liljamo/felu

fa29c9640b88b5d9434c16d6feaac4dc5a42c655 — Jonni Liljamo a month ago 23fe546
feat: serve dns on tcp too
2 files changed, 8 insertions(+), 4 deletions(-)

M cmd/felu/main.go
M internal/dns/server.go
M cmd/felu/main.go => cmd/felu/main.go +6 -2
@@ 77,9 77,13 @@ func main() {
	dnsIP := config.FeluConfig.DNSBindIP
	dnsPort := strconv.Itoa(int(config.FeluConfig.DNSBindPort))
	dnsAddr := dnsIP + ":" + dnsPort
	slog.Info("Serving DNS", slog.String("addr", dnsAddr))
	slog.Info("Serving DNS (udp)", slog.String("addr", dnsAddr))
	g.Go(func() error {
		return dns.Run(dnsAddr)
		return dns.Run(dnsAddr, "udp")
	})
	slog.Info("Serving DNS (tcp)", slog.String("addr", dnsAddr))
	g.Go(func() error {
		return dns.Run(dnsAddr, "tcp")
	})

	if err := g.Wait(); err != nil {

M internal/dns/server.go => internal/dns/server.go +2 -2
@@ 14,12 14,12 @@ import (
)

// Run starts the DNS server.
func Run(addr string) error {
func Run(addr string, net string) error {
	dns.HandleFunc(config.FeluConfig.DNSPattern, handleDNSRequest)

	server := &dns.Server{
		Addr: addr,
		Net:  "udp",
		Net:  net,
	}

	return server.ListenAndServe()