func ListenUDPAndServe(log *zap.Logger, serverNet, laddr string, u *server.Updater) error {
	var (
		c   net.PacketConn
		err error
	)
	opt := u.Get()
	if reuseport.Available() && opt.ReusePort {
		c, err = reuseport.ListenPacket(serverNet, laddr)
		if err != nil {
			reusePortErr := err
			c, err = net.ListenPacket(serverNet, laddr)
			if err == nil {
				opt.ReusePort = false
				log.Warn("failed to use REUSEPORT, falling back to non-reuseport", zap.Error(reusePortErr))
			}
		}
	} else {
		c, err = net.ListenPacket(serverNet, laddr)
	}
	if err != nil {
		return err
	}
	opt.Conn = c
	s, err := server.New(opt)
	if err != nil {
		return err
	}
	u.Subscribe(s)
	return s.Serve()
}
ListenUDPAndServe listens on laddr and process incoming packets.
package cli
import (
	"encoding/hex"
	"errors"
	"fmt"
	"log"
	"net"
	"net/http"
	"net/http/pprof"
	"os"
	"strings"
	"sync"
	"syscall"
	"github.com/libp2p/go-reuseport"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
	"go.uber.org/zap"
	"gortc.io/stun"
	"gortc.io/gortcd/internal/auth"
	"gortc.io/gortcd/internal/filter"
	"gortc.io/gortcd/internal/manage"
	"gortc.io/gortcd/internal/reload"
	"gortc.io/gortcd/internal/server"
	"gortc.io/ice"
)