backend

package
v0.0.0-...-84d3d55 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	Add    Action = "add"
	Delete        = "delete"
)

type Backend

type Backend struct {
	Config                BackendConfig
	Mqtt                  *utils.MqttConnection
	Srv                   *http3.Server
	UplinkConnectionMutex sync.Mutex
	UplinkConnections     map[string]*WaitForClose
	ConnectionPool        *ConnectionPool
}

func NewBackend

func NewBackend(config BackendConfig) (*Backend, error)

func (*Backend) DeleteUplinkConnection

func (bd *Backend) DeleteUplinkConnection(remoteAddr string)

func (*Backend) DeleteUplinkConnectionWithLock

func (bd *Backend) DeleteUplinkConnectionWithLock(remoteAddr string)

func (*Backend) Start

func (bd *Backend) Start() error

func (*Backend) StartBackendConfigStream

func (bd *Backend) StartBackendConfigStream() error

func (*Backend) Stop

func (bd *Backend) Stop()

type BackendConfig

type BackendConfig struct {
	BrokerUrl           string
	StatusTopic         *string
	BaseConnectionTopic *string
	RefreshFreq         time.Duration
	MuxEndPointUrl      string
	Listen              string
	CertFile            string
	KeyFile             string
	CloseAfterInactive  time.Duration
	MqttCfg             *mqtt.ClientOptions
}

type Connection

type Connection struct {
	Client   http.Client  `json:"-"`
	Creating sync.RWMutex `json:"-"`
	Schema   string
	Host     string
	IsQuic   bool
	Request  int
}

func (*Connection) Do

func (c *Connection) Do(req *http.Request) (*http.Response, error)

type ConnectionPool

type ConnectionPool struct {
	// contains filtered or unexported fields
}

func NewConnectionPool

func NewConnectionPool(fns ...EventFn) *ConnectionPool

func (*ConnectionPool) Setup

func (cp *ConnectionPool) Setup(schema string, host string) (*Connection, error)

type EventFn

type EventFn = func(Action, string, *Connection)

type WaitForClose

type WaitForClose struct {
	Request     http.Request // First request that started the close.
	Backend     *Backend
	LastRequest time.Time
	// RemoteAddr string
	Requests uint64
}

Jump to

Keyboard shortcuts

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