cmd

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Crossbar is a websocket relay Copyright (C) 2019 Timothy Drysdale <timothy.d.drysdale@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func HandleClients

func HandleClients(closed <-chan struct{}, wg *sync.WaitGroup, topics *topicDirectory, clientActionsChan chan clientAction)

func HandleConnections

func HandleConnections(closed <-chan struct{}, wg *sync.WaitGroup, clientActionsChan chan clientAction, messagesFromMe chan message, config Config)

Types

type AuthMessage

type AuthMessage struct {
	Topic      string `json:"topic"`
	Token      string `json:"token"`
	Authorised bool   `json:"authorised"`
	Reason     string `json:"reason"`
}

Auth message to send on successful connection or not ...

type Client

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

Client is a middleperson between the websocket connection and the hub.

type ClientReport

type ClientReport struct {
	Topic string `json:"topic"`

	Broadcaster bool `json:"broadcaster"`

	Connected string `json:"connected"`

	RemoteAddr string `json:"remoteAddr"`

	UserAgent string `json:"userAgent"`

	Stats RxTx `json:"stats"`
}

Client report omits non-serialisable internal references

type Config

type Config struct {
	Addr     string
	Secret   string
	Audience string
}

let configuration be passed as argument to permit testing

type Frames

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

type Hub

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

Hub maintains the set of active clients and broadcasts messages to the clients.

type ReportStats

type ReportStats struct {
	Last string `json:"last"` //how many seconds ago...

	Size float64 `json:"size"`

	Fps float64 `json:"fps"`
}

type RxTx

type RxTx struct {
	Tx ReportStats `json:"tx"`
	Rx ReportStats `json:"rx"`
}

type Stats

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

Jump to

Keyboard shortcuts

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