diff --git a/internal/server/coap/coap.go b/internal/server/coap/coap.go index ddf1e6224c..a1816b961b 100644 --- a/internal/server/coap/coap.go +++ b/internal/server/coap/coap.go @@ -5,7 +5,6 @@ package coap import ( "context" - "crypto/tls" "fmt" "log/slog" "time" @@ -44,26 +43,10 @@ func New(ctx context.Context, cancel context.CancelFunc, name string, config ser func (s *Server) Start() error { errCh := make(chan error) s.Logger.Info(fmt.Sprintf("%s service started using http, exposed port %s", s.Name, s.Address)) - switch { - case s.Config.CertFile != "" || s.Config.KeyFile != "": - s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s with TLS cert %s and key %s", s.Name, s.Protocol, s.Address, s.Config.CertFile, s.Config.KeyFile)) - certificate, err := tls.LoadX509KeyPair(s.Config.CertFile, s.Config.KeyFile) - if err != nil { - return fmt.Errorf("failed to load auth certificates: %w", err) - } - tlsConfig := &tls.Config{ - Certificates: []tls.Certificate{certificate}, - } - - go func() { - errCh <- gocoap.ListenAndServeTCPTLS("udp", s.Address, tlsConfig, s.handler) - }() - default: - s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s without TLS", s.Name, s.Protocol, s.Address)) - go func() { - errCh <- gocoap.ListenAndServe("udp", s.Address, s.handler) - }() - } + s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s without TLS", s.Name, s.Protocol, s.Address)) + go func() { + errCh <- gocoap.ListenAndServe("udp", s.Address, s.handler) + }() select { case <-s.Ctx.Done():