From dd8867615e31a3ff9613e98ea9396ded1dde648a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 13 Nov 2020 17:34:53 +0100 Subject: [PATCH] fix naming convention. --- internal/http/{http.go => manager.go} | 10 +++++----- internal/webrtc/{webrtc.go => manager.go} | 0 neko.go | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) rename internal/http/{http.go => manager.go} (92%) rename internal/webrtc/{webrtc.go => manager.go} (100%) diff --git a/internal/http/http.go b/internal/http/manager.go similarity index 92% rename from internal/http/http.go rename to internal/http/manager.go index 524c2510..dd5dd37a 100644 --- a/internal/http/http.go +++ b/internal/http/manager.go @@ -16,14 +16,14 @@ import ( "demodesk/neko/internal/http/endpoint" ) -type ServerCtx struct { +type HttpManagerCtx struct { logger zerolog.Logger router *chi.Mux http *http.Server conf *config.Server } -func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, conf *config.Server) *ServerCtx { +func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, conf *config.Server) *HttpManagerCtx { logger := log.With().Str("module", "http").Logger() router := chi.NewRouter() @@ -63,7 +63,7 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c Handler: router, } - return &ServerCtx{ + return &HttpManagerCtx{ logger: logger, router: router, http: http, @@ -71,7 +71,7 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c } } -func (s *ServerCtx) Start() { +func (s *HttpManagerCtx) Start() { if s.conf.Cert != "" && s.conf.Key != "" { go func() { if err := s.http.ListenAndServeTLS(s.conf.Cert, s.conf.Key); err != http.ErrServerClosed { @@ -89,6 +89,6 @@ func (s *ServerCtx) Start() { } } -func (s *ServerCtx) Shutdown() error { +func (s *HttpManagerCtx) Shutdown() error { return s.http.Shutdown(context.Background()) } diff --git a/internal/webrtc/webrtc.go b/internal/webrtc/manager.go similarity index 100% rename from internal/webrtc/webrtc.go rename to internal/webrtc/manager.go diff --git a/neko.go b/neko.go index c01aed72..0cf4db37 100644 --- a/neko.go +++ b/neko.go @@ -120,7 +120,7 @@ type Neko struct { sessionManager *session.SessionManagerCtx webSocketManager *websocket.WebSocketManagerCtx apiManager *api.ApiManagerCtx - server *http.ServerCtx + httpManager *http.HttpManagerCtx } func (neko *Neko) Preflight() { @@ -167,12 +167,12 @@ func (neko *Neko) Start() { neko.Configs.Server, ) - neko.server = http.New( + neko.httpManager = http.New( neko.webSocketManager, neko.apiManager, neko.Configs.Server, ) - neko.server.Start() + neko.httpManager.Start() } func (neko *Neko) Shutdown() { @@ -200,10 +200,10 @@ func (neko *Neko) Shutdown() { neko.logger.Debug().Msg("websocket manager shutdown") } - if err := neko.server.Shutdown(); err != nil { - neko.logger.Err(err).Msg("server shutdown with an error") + if err := neko.httpManager.Shutdown(); err != nil { + neko.logger.Err(err).Msg("http manager shutdown with an error") } else { - neko.logger.Debug().Msg("server shutdown") + neko.logger.Debug().Msg("http manager shutdown") } }