mux

package
v0.0.0-...-1c1b3bb Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mux provides a service to split incoming directip messages to backend HTTP services. The mux stores a list of targets and each target has a pattern for an IMEI. If the IMEI of the incoming message matches with the given regurlar expression, the mux will send an HTTP request with a JSON message to the configured backend.

Every target service will receive a sbd.InformationElements as a JSON representation in its POST body. Please take into account that this service and package does not parse the payload which is of type []byte. Many devices use the payload to transfer specific types of data. Your backend service has to know how to handle these types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distributer

type Distributer interface {
	WithTargets(targets Targets) error
	Targets() Targets
	Handle(data *sbd.InformationBucket) error
	Close()
}

A Distributer can handle the SBD data and dispatches them to the targets. When the targets are reconfigured, the can be set vith WithTargets.

func New

func New(numworkers int, log zerolog.Logger) Distributer

New creates a new Distributor with the given number of workers

type Target

type Target struct {
	ID          string            `yaml:"id,omitempty"`
	IMEIPattern string            `yaml:"imeipattern"`
	Backend     string            `yaml:"backend"`
	SkipTLS     bool              `yaml:"skiptls,omitempty"`
	Header      map[string]string `yaml:"header"`
	// contains filtered or unexported fields
}

A Target stores the configuration of a backend service where the SBD data should be pushed.

type Targets

type Targets []Target

Targets is a list of Target's

Jump to

Keyboard shortcuts

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