Documentation ¶
Index ¶
- type GizmoHook
- func (gh *GizmoHook) ID() string
- func (gh *GizmoHook) OnACLCheck(cl *mqtt.Client, topic string, write bool) bool
- func (gh *GizmoHook) OnConnect(cl *mqtt.Client, pk packets.Packet) error
- func (gh *GizmoHook) OnConnectAuthenticate(cl *mqtt.Client, pk packets.Packet) bool
- func (gh *GizmoHook) OnDisconnect(cl *mqtt.Client, err error, expire bool)
- func (gh *GizmoHook) OnSessionEstablished(cl *mqtt.Client, pk packets.Packet)
- func (gh *GizmoHook) OnStarted()
- func (gh *GizmoHook) OnSubscribed(cl *mqtt.Client, pk packets.Packet, reasonCodes []byte)
- func (gh *GizmoHook) Provides(b byte) bool
- type Option
- type Server
- type StopHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GizmoHook ¶ added in v0.0.12
type GizmoHook struct { mqtt.HookBase // contains filtered or unexported fields }
GizmoHook handles all the custom logic for Gizmo
func (*GizmoHook) OnACLCheck ¶ added in v0.0.12
OnACLCheck gets called to work out if a client should be allowed to do things or not. The first check that we make is if the client is in either 127.0.0.0/8 (the server itself) or 100.64.0.0/24 (the FMS netblock). If either of these is true than the result is returned immediately as success. Otherwise the actual team number is checked to make sure it corresponds to the one in the topic.
func (*GizmoHook) OnConnect ¶ added in v0.1.2
OnConnect fires when a client connects, and we use this to forcibly clear all state for clients connecting to the server.
func (*GizmoHook) OnConnectAuthenticate ¶ added in v0.0.12
OnConnectAuthenticate allows anyone to connect, but what they can then do is pretty heavily limited by the OnACLCheck below.
func (*GizmoHook) OnDisconnect ¶ added in v0.0.12
OnDisconnect fires when a client is disconnected for any reason.
func (*GizmoHook) OnSessionEstablished ¶ added in v0.0.12
OnSessionEstablished happens after a client is completely connected and ready to send and receive data.
func (*GizmoHook) OnStarted ¶ added in v0.0.12
func (gh *GizmoHook) OnStarted()
OnStarted happens after the listeners are bound and the server is ready to process connections.
func (*GizmoHook) OnSubscribed ¶ added in v0.1.2
OnSubscribed logs subscriptions as they come in for a given client. Useful for debugging and normally a noop.
type Option ¶
Option enables variadic option passing to the server on startup.
func WithStartupWG ¶
WithStartupWG allows a waitgroup to be passed in so the server can notify when its finished with startup tasks to allow a nice message to be printed to the console.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server binds the server's methods
func (*Server) Publish ¶ added in v0.1.6
Publish is a passthrough to the underlying server's publish function.
func (*Server) Serve ¶
Serve binds and serves mqtt on the bound socket. An error will be returned if the srever cannot initialize.