mqtt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIRoute = "mqtt/v1"
)

Variables

View Source
var (
	Component *app.Component
)
View Source
var ParamsMQTT = &ParametersMQTT{}

Functions

This section is empty.

Types

type ParametersMQTT

type ParametersMQTT struct {
	BufferSize      int `default:"0" usage:"the size of the client buffers in bytes"`
	BufferBlockSize int `default:"0" usage:"the size per client buffer R/W block in bytes"`

	Subscriptions struct {
		MaxTopicSubscriptionsPerClient int     `default:"1000" usage:"the maximum number of topic subscriptions per client before the client gets dropped (DOS protection)"`
		TopicsCleanupThresholdCount    int     `default:"10000" usage:"the number of deleted topics that trigger a garbage collection of the subscription manager"`
		TopicsCleanupThresholdRatio    float32 `` /* 132-byte string literal not displayed */
	}

	Websocket struct {
		Enabled          bool   `default:"true" usage:"whether to enable the websocket connection of the MQTT broker"`
		BindAddress      string `default:"localhost:1888" usage:"the websocket bind address on which the MQTT broker listens on"`
		AdvertiseAddress string `default:"" usage:"the address of the websocket of the MQTT broker which is advertised to the INX Server (optional)."`
	}

	TCP struct {
		Enabled     bool   `default:"false" usage:"whether to enable the TCP connection of the MQTT broker"`
		BindAddress string `default:"localhost:1883" usage:"the TCP bind address on which the MQTT broker listens on"`

		Auth struct {
			Enabled      bool              `default:"false" usage:"whether to enable auth for TCP connections"`
			PasswordSalt string            `` /* 140-byte string literal not displayed */
			Users        map[string]string `usage:"the list of allowed users with their password+salt as a scrypt hash"`
		}

		TLS struct {
			Enabled         bool   `default:"false" usage:"whether to enable TLS for TCP connections"`
			PrivateKeyPath  string `default:"private_key.pem" usage:"the path to the private key file (x509 PEM) for TCP connections with TLS"`
			CertificatePath string `default:"certificate.pem" usage:"the path to the certificate file (x509 PEM) for TCP connections with TLS"`
		} `name:"tls"`
	} `name:"tcp"`
}

type Server

type Server struct {
	*logger.WrappedLogger

	MQTTBroker *mqtt.Broker
	NodeBridge *nodebridge.NodeBridge
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log *logger.Logger,
	bridge *nodebridge.NodeBridge,
	shutdownHandler *shutdown.ShutdownHandler,
	brokerOpts ...mqtt.BrokerOption) (*Server, error)

func (*Server) PublishBlock

func (s *Server) PublishBlock(blk *inx.RawBlock)

func (*Server) PublishBlockMetadata

func (s *Server) PublishBlockMetadata(metadata *inx.BlockMetadata)

func (*Server) PublishMilestoneOnTopic

func (s *Server) PublishMilestoneOnTopic(topic string, ms *nodebridge.Milestone)

func (*Server) PublishOnOutputChainTopics

func (s *Server) PublishOnOutputChainTopics(outputID iotago.OutputID, output iotago.Output, payloadFunc func() interface{})

func (*Server) PublishOnTopic

func (s *Server) PublishOnTopic(topic string, payload interface{})

func (*Server) PublishOnTopicIfSubscribed

func (s *Server) PublishOnTopicIfSubscribed(topic string, payload interface{})

func (*Server) PublishOnUnlockConditionTopics

func (s *Server) PublishOnUnlockConditionTopics(baseTopic string, output iotago.Output, payloadFunc func() interface{})

func (*Server) PublishOutput

func (s *Server) PublishOutput(ctx context.Context, ledgerIndex uint32, output *inx.LedgerOutput, publishOnAllTopics bool)

func (*Server) PublishPayloadFuncOnTopicIfSubscribed

func (s *Server) PublishPayloadFuncOnTopicIfSubscribed(topic string, payloadFunc func() interface{})

func (*Server) PublishRawOnTopicIfSubscribed

func (s *Server) PublishRawOnTopicIfSubscribed(topic string, payload []byte)

func (*Server) PublishReceipt

func (s *Server) PublishReceipt(r *inx.RawReceipt)

func (*Server) PublishSpent

func (s *Server) PublishSpent(ledgerIndex uint32, spent *inx.LedgerSpent)

func (*Server) PublishTransactionIncludedBlock

func (s *Server) PublishTransactionIncludedBlock(transactionID iotago.TransactionID, block *inx.RawBlock)

func (*Server) Run

func (s *Server) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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