listener

package
v0.0.0-...-6789dc4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 4 Imported by: 2

Documentation

Overview

Package listener has code to listen for device connections and setup sessions for them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceListener

type DeviceListener struct {
	net.Listener
}

DeviceListener listens and setup sessions from device connections.

func DeviceListen

func DeviceListen(lst net.Listener, cfg DeviceListenerConfig) (*DeviceListener, error)

DeviceListen creates a DeviceListener for device connections based on config. If lst is not nil DeviceListen just wraps it with a TLS layer instead of starting creating a new listener.

func (*DeviceListener) AcceptLoop

func (dl *DeviceListener) AcceptLoop(session func(net.Conn) error, resource SessionResourceManager, logger logger.Logger) error

AcceptLoop accepts connections and starts sessions for them.

type DeviceListenerConfig

type DeviceListenerConfig interface {
	// Addr to listen on.
	Addr() string
	// TLS config
	TLSServerConfig() *tls.Config
}

A DeviceListenerConfig offers the DeviceListener configuration.

type NopSessionResourceManager

type NopSessionResourceManager struct{}

NOP SessionResourceManager.

func (*NopSessionResourceManager) ConsumeConn

func (r *NopSessionResourceManager) ConsumeConn()

type SessionResourceManager

type SessionResourceManager interface {
	ConsumeConn()
}

SessionResourceManager allows to limit resource usage tracking connections.

Jump to

Keyboard shortcuts

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