server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 25 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 `gorm:"index"`
	// ArgsJSON persists the argv for the new array protocol so queued/resumed
	// tasks reconstruct exactly (the human-readable Command stays display-only).
	ArgsJSON string `json:"-"`
	// Args and Payload are decoded from the request body only (never persisted).
	Args    []string `json:"args" gorm:"-"`
	Payload string   `json:"payload" gorm:"-"`
}

Jump to

Keyboard shortcuts

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