client

package
v0.0.0-...-d65772c Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Socket          *websocket.Conn
	Send            chan *SendMessage
	Received        chan *ReceiveMessage
	StopHostPolling chan bool
}

func (*Client) Read

func (client *Client) Read()

Read from websocket

func (*Client) Write

func (client *Client) Write()

Write to websocket

type ErrorMessage

type ErrorMessage struct {
	Host  string
	Error string
	Name  string
}

type HostsController

type HostsController struct {
	Info *config.DashboardInfo

	Drivers map[string]*driver.Driver
	// ReadOnlyHosts : restrict pinging every other server except these
	ReadOnlyHosts []string
	// ClientConnected : shows that a client is connected
	ClientConnected bool
	Client          chan *Client
	Received        chan *ReceiveMessage
	StopPolling     chan bool
	// contains filtered or unexported fields
}

func NewHostsController

func NewHostsController(cfg *config.Config) *HostsController

NewHostsController : initialze host controller with config file

func (*HostsController) Poll

func (hosts *HostsController) Poll(client *Client)

func (*HostsController) Run

func (hosts *HostsController) Run()

func (*HostsController) ServeHTTP

func (hosts *HostsController) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Message

type Message struct {
	Host     string
	Name     string
	Platform string
	Data     interface{}
}

type ReceiveMessage

type ReceiveMessage struct {
	FilterBy string
}

ReceiveMessage : specify the host to filter by

type SendMessage

type SendMessage struct {
	Error   bool
	Message interface{}
}

Jump to

Keyboard shortcuts

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