Skip to content
/ magina Public

An MQTT broker library for Golang, using RabbitMQ as backend.

License

Notifications You must be signed in to change notification settings

ruizeng/magina

Repository files navigation

magina

An MQTT broker library for Golang, using RabbitMQ as backend.

WARNING

This project is under development and not production ready. Issues and contributions are wellcomed.

Features

  • support running standalone or being embed in your own application as golang library.
  • based on RabbitMQ's stable, reliable and efficient message service.
  • suport QoS 0 and 1.
  • easy to scale up because of the share nothing implementation.
  • extend topic schema to support RPC(non-mqtt-official).

Features in the near future.

  • suport QoS 2.
  • suport websocket proxy.
  • suport TLS/SSL.

How to use

(package management depends on glide, install it first and run glide install in the projectv folder)

standalone

the standalone borker is in ./standalone, you can build and run it as you like.

options:

As GoLang library

example:
package main

import (
	"github.com/ruizeng/magina"
)

func authenticate(client *magina.Client, username string, password string) bool {
	return true
}
func authorizePublish(client *magina.Client, topic string) bool {
	return true
}
func authorizeSubscribe(client *magina.Client, topic string) bool {
	return true
}

func main() {
	server := &magina.Broker{
		// server address to listen
		Addr: ":1883",
		// rabbit uri
		RabbitURI: "amqp://guest:guest@localhost:5672/",
		// callbacks
		Authenticate:       authenticate,
		AuthorizePublish:   authorizePublish,
		AuthorizeSubscribe: authorizeSubscribe,
	}

	server.ListenAndServe()

	return
}

About

An MQTT broker library for Golang, using RabbitMQ as backend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages