init
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user