net

package
v0.0.0-...-80ab217 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 8 Imported by: 8

Documentation

Overview

Package net implements the MQTT network layer on top of the standard library "net" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Websocket

func Websocket(handle func(Conn)) http.Handler

Websocket returns an http.Handler that exposes MQTT over websockets.

Types

type Conn

type Conn interface {
	Close() error
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	NetConn() net.Conn
	Transport() string
	Send(pkt packet.ControlPacket) error
	Receive() (packet.ControlPacket, error)
	SetReadTimeout(d time.Duration)
}

Conn wraps net.Conn with mqtt-specific functions.

func Dial

func Dial(network, address string) (Conn, error)

Dial connects to the address on the named network; see net.Dial for details.

func DialContext

func DialContext(ctx context.Context, network, address string) (Conn, error)

DialContext acts like Dial but takes a context.

func NewConn

func NewConn(inner net.Conn, transport string) Conn

NewConn creates a Conn that wraps an inner Conn.

type Listener

type Listener interface {
	Accept() (Conn, error)
	Close() error
	Addr() net.Addr
}

Listener wraps net.Listener with MQTT-specific functions.

func Listen

func Listen(network, address string) (Listener, error)

Listen on the local network address.

func NewListener

func NewListener(inner net.Listener, transport string) Listener

NewListener creates a Listener that accepts connections from an inner Listener.

Jump to

Keyboard shortcuts

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