This commit is contained in:
2025-11-11 20:47:43 +01:00
parent 17a671a417
commit 1dbfe08225
9 changed files with 322 additions and 57 deletions

View File

@@ -22,6 +22,6 @@ func NewServer(addr string) *Server {
return s
}
func (s *Server) Start() error {
func (s *Server) Run() error {
return s.router.Run(s.addr)
}

View File

@@ -18,17 +18,17 @@ type Server struct {
cancel context.CancelFunc
}
func NewServer(bindAddr string) (*Server, error) {
func NewServer(bindAddr string) *Server {
ctx, cancel := context.WithCancel(context.Background())
return &Server{
bindAddr: bindAddr,
ctx: ctx,
cancel: cancel,
}, nil
}
}
func (s *Server) run() error {
func (s *Server) Run() error {
add, err := net.ResolveUDPAddr("udp", s.bindAddr)
if err != nil {
return fmt.Errorf("cannot resolve address: %w", err)