server

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleRequests

func HandleRequests(d bool)

func WriteToFile

func WriteToFile(filename string, data string) error

Types

type Client

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

var clients = make(map[*websocket.Conn]bool) // connected clients

type Config

type Config struct {
	Tokens []struct {
		CaptainID string `json:"captain_id"`
		Token     string `json:"token"`
	} `json:"tokens"`
	Servers []struct {
		Name     string `json:"name"`
		Address  string `json:"address"`
		Requires []struct {
			Command string `json:"command"`
		} `json:"requires"`
	} `json:"servers"`
	Host    string `json:"host"`
	Port    string `json:"port"`
	SSLMode string `json:"ssl_mode"`
}

func LoadConfiguration

func LoadConfiguration(file string) Config

type Origin

type Origin struct {
	ID     string
	Server string
	Token  string
}

type SocketRequest

type SocketRequest struct {
	Token  string `json:"token"`
	Action string `json:"action"`
}

Define our message object

type SocketResponse

type SocketResponse struct {
	Token  string `json:"token"`
	TaskID string `json:"task_id"`
}

type Task

type Task struct {
	gorm.Model
	CaptainID int
	ProcessID int
	Command   string
	Status    string
	Response  string
	Origin    string
	Token     string
}

Jump to

Keyboard shortcuts

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