daemon

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package daemon manages router instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteInstance

func DeleteInstance(id string) error

DeleteInstance removes instance metadata from disk.

func GenerateAdminToken

func GenerateAdminToken() string

GenerateAdminToken generates a random admin token for secure API access.

func GenerateInstanceID

func GenerateInstanceID() string

GenerateInstanceID generates a unique instance ID.

func InstancesDir

func InstancesDir() (string, error)

InstancesDir returns the directory for instance files.

func IsRunning

func IsRunning(meta *InstanceMetadata) bool

IsRunning checks if an instance is still running.

func ReadPIDFile

func ReadPIDFile(path string) (int, error)

ReadPIDFile reads a PID from a file.

func SaveInstance

func SaveInstance(meta *InstanceMetadata) error

SaveInstance saves instance metadata to disk.

func UpdateActiveProfile

func UpdateActiveProfile(id string, profile string) error

UpdateActiveProfile updates the active profile for an instance.

func WritePIDFile

func WritePIDFile(path string) error

WritePIDFile writes the current process PID to a file.

Types

type InstanceMetadata

type InstanceMetadata struct {
	ID            string    `json:"id"`
	Port          int       `json:"port"`
	PID           int       `json:"pid"`
	ConfigType    string    `json:"configType"`
	ConfigPath    string    `json:"configPath"`
	ProjectRoot   string    `json:"projectRoot"`
	StartTime     time.Time `json:"startTime"`
	ActiveProfile string    `json:"activeProfile,omitempty"` // Current active profile name
	AdminToken    string    `json:"adminToken,omitempty"`    // Admin API token for runtime management
}

InstanceMetadata represents metadata for a running instance.

func ListInstances

func ListInstances() ([]*InstanceMetadata, error)

ListInstances lists all instances.

func LoadInstance

func LoadInstance(id string) (*InstanceMetadata, error)

LoadInstance loads instance metadata from disk.

Jump to

Keyboard shortcuts

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