pkg

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Client identifier configurations
	Username = "Username"
	Password = "Password"
	ClientId = "ClientId"

	// Connection configuration names
	ConnectTimeout = "ConnectTimeout"
	AutoReconnect  = "AutoReconnect"

	// TLS configuration names
	SkipCertVerify = "SkipCertVerify"
	CertFile       = "CertFile"
	KeyFile        = "KeyFile"
	CaFile         = "CaFile"
	KeyPEMBlock    = "KeyPEMBlock"
	CertPEMBlock   = "CertPEMBlock"
	CaPEMBlock     = "CaPEMBlock"

	// MQTT Specifics
	Qos          = "Qos"
	KeepAlive    = "KeepAlive"
	Retained     = "Retained"
	CleanSession = "CleanSession"

	// NATS specifics
	RetryOnFailedConnect = "RetryOnFailedConnect"
	Format               = "Format"
	QueueGroup           = "QueueGroup"

	// NATS JetStream specifics
	Durable                 = "Durable"
	Subject                 = "Subject"
	AutoProvision           = "AutoProvision"
	Deliver                 = "Deliver"
	DefaultPubRetryAttempts = "DefaultPubRetryAttempts"
)

Variables

View Source
var TlsSchemes = []string{"tcps", "ssl", "tls", "redis", "nats"}

Functions

func GenerateTLSForClientClientOptions

func GenerateTLSForClientClientOptions(
	brokerURL string,
	tlsConfigurationOptions TlsConfigurationOptions,
	certCreator X509KeyPairCreator,
	certLoader X509KeyLoader,
	caCertCreator X509CaCertCreator,
	caCertLoader X509CaCertLoader,
	pemDecoder PEMDecoder) (*tls.Config, error)

GenerateTLSForClientClientOptions creates a tls.Config which can be used when configuring the underlying client. If TLS is not needed then nil will be returned which can be used to signal no TLS is needed to the client.

func Load

func Load(config map[string]string, des interface{}) error

load by reflect to check map key and then fetch the value. This function ignores properties that have not been provided from the source. Therefore it is recommended to provide a destination struct with reasonable defaults.

NOTE: This logic was borrowed from device-mqtt-go and some additional logic was added to accommodate more types. https://github.com/edgexfoundry/device-mqtt-go/blob/a0d50c6e03a7f7dcb28f133885c803ffad3ec502/internal/driver/config.go#L74-L101

Types

type BrokerURLErr

type BrokerURLErr struct {
	// contains filtered or unexported fields
}

BrokerURLErr represents an error associated parsing a broker's URL.

func NewBrokerURLErr

func NewBrokerURLErr(description string) BrokerURLErr

NewBrokerURLErr constructs a new BrokerURLErr

func (BrokerURLErr) Error

func (bue BrokerURLErr) Error() string

type CertificateErr

type CertificateErr struct {
	// contains filtered or unexported fields
}

CertificateErr represents an error associated with interacting with a Certificate.

func NewCertificateErr

func NewCertificateErr(message string) CertificateErr

NewCertificateErr constructs a new CertificateErr

func (CertificateErr) Error

func (ce CertificateErr) Error() string

type InvalidTopicErr

type InvalidTopicErr struct {
	// contains filtered or unexported fields
}

func NewInvalidTopicErr

func NewInvalidTopicErr(topic string, description string) InvalidTopicErr

func (InvalidTopicErr) Error

func (ite InvalidTopicErr) Error() string

type MissingConfigurationErr

type MissingConfigurationErr struct {
	// contains filtered or unexported fields
}

func NewMissingConfigurationErr

func NewMissingConfigurationErr(missingConfiguration string, message string) MissingConfigurationErr

func (MissingConfigurationErr) Error

func (mce MissingConfigurationErr) Error() string

type NoopClient added in v2.3.0

type NoopClient struct{}

func (NoopClient) Connect added in v2.3.0

func (n NoopClient) Connect() error

func (NoopClient) Disconnect added in v2.3.0

func (n NoopClient) Disconnect() error

func (NoopClient) Publish added in v2.3.0

func (n NoopClient) Publish(message types.MessageEnvelope, topic string) error

func (NoopClient) Subscribe added in v2.3.0

func (n NoopClient) Subscribe(topics []types.TopicChannel, messageErrors chan error) error

type PEMDecoder added in v2.3.0

type PEMDecoder func(data []byte) (*pem.Block, []byte)

PEMDecoder defines the function signature for finding the next PEM formatted block in the input. It returns that block and the remainder of the input.

type PublishHostURLErr

type PublishHostURLErr struct {
	// contains filtered or unexported fields
}

func NewPublishHostURLErr

func NewPublishHostURLErr(message string) PublishHostURLErr

func (PublishHostURLErr) Error

func (p PublishHostURLErr) Error() string

type SubscribeHostURLErr

type SubscribeHostURLErr struct {
	// contains filtered or unexported fields
}

func NewSubscribeHostURLErr

func NewSubscribeHostURLErr(message string) SubscribeHostURLErr

func (SubscribeHostURLErr) Error

func (p SubscribeHostURLErr) Error() string

type TlsConfigurationOptions

type TlsConfigurationOptions struct {
	SkipCertVerify bool
	CertFile       string
	KeyFile        string
	CaFile         string
	KeyPEMBlock    string
	CertPEMBlock   string
	CaPEMBlock     string
}

func CreateDefaultTlsConfigurationOptions

func CreateDefaultTlsConfigurationOptions() TlsConfigurationOptions

type X509CaCertCreator added in v2.3.0

type X509CaCertCreator func(caCertPEMBlock []byte) (*x509.Certificate, error)

X509CaCertCreator defines the function signature for creating a CA certificate based on PEM encoding.

type X509CaCertLoader added in v2.3.0

type X509CaCertLoader func(caCertFile string) ([]byte, error)

X509CaCertLoader defines the function signature for loading a PEM formatted block from the given CA certificate file.

type X509KeyLoader

type X509KeyLoader func(certFile string, keyFile string) (tls.Certificate, error)

X509KeyLoader defines a function signature for loading a tls.Certificate from cert and key files.

type X509KeyPairCreator

type X509KeyPairCreator func(certPEMBlock []byte, keyPEMBlock []byte) (tls.Certificate, error)

X509KeyPairCreator defines the function signature for creating a tls.Certificate based on PEM encoding.

Directories

Path Synopsis
interfaces/mocks
Code generated by mockery v2.13.1.
Code generated by mockery v2.13.1.
redis package contains a RedisClient which leverages go-redis to interact with a Redis server.
redis package contains a RedisClient which leverages go-redis to interact with a Redis server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL