Skip to content

Commit

Permalink
Amend server
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru committed Oct 16, 2023
1 parent 40db759 commit cc3e72e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/server/coap/coap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/mainflux/mainflux/internal/server"
"github.com/mainflux/mainflux/logger"
piondtls "github.com/pion/dtls/v2"
gocoap "github.com/plgd-dev/go-coap/v2"
"github.com/plgd-dev/go-coap/v2/mux"
)
Expand Down Expand Up @@ -59,10 +60,9 @@ func (s *Server) Start() error {
}()

case enableDTLS:
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))


go func(){
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))

go func() {
errCh <- gocoap.ListenAndServeDTLS("udp", ":5688", &piondtls.Config{
PSK: func(hint []byte) ([]byte, error) {
fmt.Printf("Client's hint: %s \n", hint)
Expand All @@ -71,9 +71,9 @@ func (s *Server) Start() error {
PSKIdentityHint: []byte("Pion DTLS Client"),
CipherSuites: []piondtls.CipherSuiteID{piondtls.TLS_PSK_WITH_AES_128_CCM_8},
}, 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() {
Expand Down

0 comments on commit cc3e72e

Please sign in to comment.