auth

package
v0.0.0-...-5452022 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateAgent

func CreateOrUpdateAgent(db *surrealdb.DB, agent_name string, config []byte) (err error)

create a new agent or update agent entry with the agent name and YAML configuration.

func INIT

func INIT(db *surrealdb.DB, api_user, api_user_pass, agent_secret string) (err error)

create user table and data if doesn't exist and input agent secrets into database

func RegisterAgent

func RegisterAgent(c *gin.Context, db *surrealdb.DB)

register a new agent

Types

type Agent

type Agent struct {
	ID     *models.RecordID `json:"id,omitempty"`
	Name   string           `json:"name"`
	Config []byte           `json:"agent_config"` // yaml agent config
}

type AgentConfig

type AgentConfig struct {
	OS       string   `yaml:"os"`      // agent os
	HostName string   `yaml:"name"`    // agent hostname
	Streams  []string `yaml:"streams"` // data streams
}

type AgentLog

type AgentLog struct {
	ID      *models.RecordID            `json:"id,omitempty"`
	Name    string                      `json:"name"`     // unique hash of log (this prevents duplicates)
	LogData map[interface{}]interface{} `json:"log_data"` // log data

}

type AgentRegister

type AgentRegister struct {
	Name   string `json:"name"`   // agent hostname
	Config string `json:"config"` // base64 encoded yaml configuration
}

---- api input types

type AgentSecret

type AgentSecret struct {
	ID   *models.RecordID `json:"id,omitempty"`
	Name string           `json:"name"` // key for enrolling agent
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error" example:"Invalid input"`
}

--- api output types ---

type Result

type Result struct {
	Result string `json:"result" example:"ok"`
}

type User

type User struct {
	ID       *models.RecordID `json:"id,omitempty"`
	Name     string           `json:"name"`
	Password string           `json:"password"` // hashed password
}

Jump to

Keyboard shortcuts

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