forked from redpanda-data/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_mqtt.go
39 lines (36 loc) · 1.49 KB
/
config_mqtt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package input
import (
mqttconf "github.com/benthosdev/benthos/v4/internal/impl/mqtt/shared"
"github.com/benthosdev/benthos/v4/internal/tls"
)
// MQTTConfig contains configuration fields for the MQTT input type.
type MQTTConfig struct {
URLs []string `json:"urls" yaml:"urls"`
QoS uint8 `json:"qos" yaml:"qos"`
Topics []string `json:"topics" yaml:"topics"`
ClientID string `json:"client_id" yaml:"client_id"`
DynamicClientIDSuffix string `json:"dynamic_client_id_suffix" yaml:"dynamic_client_id_suffix"`
Will mqttconf.Will `json:"will" yaml:"will"`
CleanSession bool `json:"clean_session" yaml:"clean_session"`
User string `json:"user" yaml:"user"`
Password string `json:"password" yaml:"password"`
ConnectTimeout string `json:"connect_timeout" yaml:"connect_timeout"`
KeepAlive int64 `json:"keepalive" yaml:"keepalive"`
TLS tls.Config `json:"tls" yaml:"tls"`
}
// NewMQTTConfig creates a new MQTTConfig with default values.
func NewMQTTConfig() MQTTConfig {
return MQTTConfig{
URLs: []string{},
QoS: 1,
Topics: []string{},
ClientID: "",
Will: mqttconf.EmptyWill(),
CleanSession: true,
User: "",
Password: "",
ConnectTimeout: "30s",
KeepAlive: 30,
TLS: tls.NewConfig(),
}
}