Skip to content

Commit

Permalink
[#64] Refactor flags implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Antonia Avramova <antonia.avramova@bosch.io>
  • Loading branch information
antonia-avramova committed Nov 10, 2023
1 parent 93f5838 commit 6c53518
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 264 deletions.
23 changes: 0 additions & 23 deletions internal/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ package feature

import (
"encoding/json"
"net/url"

"github.com/eclipse-kanto/software-update/internal/logger"
"github.com/eclipse-kanto/software-update/internal/util/tls"

MQTT "github.com/eclipse/paho.mqtt.golang"
"github.com/google/uuid"
Expand Down Expand Up @@ -60,18 +58,6 @@ func newEdgeConnector(scriptSUPConfig *ScriptBasedSoftwareUpdatableConfig, ecl e
if len(scriptSUPConfig.Username) > 0 {
opts = opts.SetUsername(scriptSUPConfig.Username).SetPassword(scriptSUPConfig.Password)
}
u, err := url.Parse(scriptSUPConfig.Broker)
if err != nil {
return nil, err
}

if isConnectionSecure(u.Scheme) {
tlsConfig, err := tls.NewTLSConfig(scriptSUPConfig.CACert, scriptSUPConfig.Cert, scriptSUPConfig.Key)
if err != nil {
return nil, err
}
opts.SetTLSConfig(tlsConfig)
}

p := &EdgeConnector{mqttClient: MQTT.NewClient(opts), edgeClient: ecl}
if token := p.mqttClient.Connect(); token.Wait() && token.Error() != nil {
Expand Down Expand Up @@ -112,15 +98,6 @@ func newEdgeConnector(scriptSUPConfig *ScriptBasedSoftwareUpdatableConfig, ecl e
return p, nil
}

func isConnectionSecure(schema string) bool {
switch schema {
case "wss", "ssl", "tls", "mqtts", "mqtt+ssl", "tcps":
return true
default:
}
return false
}

// Close the EdgeConnector
func (p *EdgeConnector) Close() {
if p.cfg != nil {
Expand Down
22 changes: 0 additions & 22 deletions internal/util/tls/testdata/ca.crt

This file was deleted.

27 changes: 0 additions & 27 deletions internal/util/tls/testdata/certificate.pem

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion internal/util/tls/testdata/invalid.pem

This file was deleted.

27 changes: 0 additions & 27 deletions internal/util/tls/testdata/key.pem

This file was deleted.

60 changes: 0 additions & 60 deletions internal/util/tls/tls_config.go

This file was deleted.

104 changes: 0 additions & 104 deletions internal/util/tls/tls_config_test.go

This file was deleted.

0 comments on commit 6c53518

Please sign in to comment.