adapter

package
v0.0.0-...-4b8ecad Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdaptUDP

func AdaptUDP(adapter Adapter)

Register a new adapter for UDP

func AdaptWS

func AdaptWS(adapter Adapter)

Register a new adapter for websocket/sl (all safe protocols)

func ReceiveUDP

func ReceiveUDP(ID string, event pipes.Event, msg []byte)

Handles receiving messages from the target and passes them to the adapter

func ReceiveWeb

func ReceiveWeb(ID string, event pipes.Event, msg []byte)

Handles receiving messages from the target and passes them to the adapter

func RemoveUDP

func RemoveUDP(ID string)

Remove a UDP adapter

func RemoveWS

func RemoveWS(ID string)

Remove a websocket/sl adapter

func SetupCaching

func SetupCaching()

Types

type Adapter

type Adapter struct {
	ID    string      // Identifier of the client
	Mutex *sync.Mutex // Mutex to prevent concurrent sending (WHY DO I NEED TO DO THIS??)
	Data  interface{} // Custom data (not required)

	// Functions
	Receive func(*Context) error
}

type Context

type Context struct {
	Event   *pipes.Event
	Message []byte
	Adapter *Adapter
}

Jump to

Keyboard shortcuts

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