agent

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolMajor = 2
	ProtocolMinor = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigApplier

type ConfigApplier interface {
	Apply(ctx context.Context, snapshot ConfigSnapshot) error
}

type ConfigSnapshot

type ConfigSnapshot struct {
	AgentProtocolVersion ProtocolVersion `json:"agent_protocol_version"`
	NodeID               string          `json:"node_id"`
	ConfigVersion        int             `json:"config_version"`
	ConfigHash           string          `json:"config_hash"`
	Rules                []RuleConfig    `json:"rules"`
}

type MetricsPayload

type MetricsPayload struct {
	TCPConnections       int64                  `json:"tcp_connections"`
	UDPPacketsPerSecond  int64                  `json:"udp_packets_per_second"`
	BandwidthBps         int64                  `json:"bandwidth_bps"`
	CPUPercent           float64                `json:"cpu_percent"`
	RAMUsedBytes         uint64                 `json:"ram_used_bytes"`
	RAMTotalBytes        uint64                 `json:"ram_total_bytes"`
	UploadBytes          int64                  `json:"upload_bytes"`
	DownloadBytes        int64                  `json:"download_bytes"`
	UptimeSeconds        int64                  `json:"uptime_seconds"`
	BootTime             string                 `json:"boot_time"`
	AppliedConfigVersion int                    `json:"applied_config_version"`
	Targets              []TargetMetricsPayload `json:"targets"`
	TrafficReportID      string                 `json:"traffic_report_id,omitempty"`
	TrafficDeltas        []RuleTrafficDelta     `json:"traffic_deltas,omitempty"`
}

type MetricsProvider

type MetricsProvider interface {
	AgentMetrics() MetricsPayload
}

type NodeRuntime

type NodeRuntime struct {
	// contains filtered or unexported fields
}

func NewMonitorRuntime

func NewMonitorRuntime(config RuntimeConfig) *NodeRuntime

func NewNodeRuntime

func NewNodeRuntime(config RuntimeConfig, applier ConfigApplier) *NodeRuntime

func (*NodeRuntime) Run

func (runtime *NodeRuntime) Run(ctx context.Context) error

type ProtocolVersion

type ProtocolVersion struct {
	Major int `json:"major"`
	Minor int `json:"minor"`
}

func CurrentProtocolVersion

func CurrentProtocolVersion() ProtocolVersion

func (ProtocolVersion) Accepts

func (server ProtocolVersion) Accepts(agent ProtocolVersion) bool

type RuleConfig

type RuleConfig struct {
	ID               string                `json:"id"`
	ConfigVersion    int                   `json:"config_version"`
	Enabled          bool                  `json:"enabled"`
	ForwardingType   domain.ForwardingType `json:"forwarding_type"`
	Protocol         domain.Protocol       `json:"protocol"`
	NodeIDs          []string              `json:"node_ids,omitempty"`
	NodeGroupIDs     []string              `json:"node_group_ids,omitempty"`
	ListenIP         string                `json:"listen_ip"`
	Port             int                   `json:"port"`
	MatchType        string                `json:"match_type"`
	SNIHostname      string                `json:"sni_hostname,omitempty"`
	ProxyProtocolIn  string                `json:"proxy_protocol_in"`
	ProxyProtocolOut string                `json:"proxy_protocol_out"`
	Upstream         RuleUpstreamConfig    `json:"upstream"`
}

type RuleTrafficDelta added in v0.1.18

type RuleTrafficDelta struct {
	RuleID         string `json:"rule_id"`
	UploadBytes    int64  `json:"upload_bytes"`
	DownloadBytes  int64  `json:"download_bytes"`
	TCPConnections int64  `json:"tcp_connections"`
	UDPPackets     int64  `json:"udp_packets"`
}

type RuleUpstreamConfig

type RuleUpstreamConfig struct {
	Type        string                 `json:"type"`
	Target      *TargetEndpoint        `json:"target,omitempty"`
	TargetGroup []TargetPriorityBucket `json:"target_group,omitempty"`
}

type RuntimeConfig

type RuntimeConfig struct {
	AppName             string
	ControlPlaneURL     string
	AgentID             string
	RegistrationToken   string
	AgentCredential     string
	AgentCredentialFile string
	ServiceName         string
	InstallDir          string
	LogLevel            string
	// contains filtered or unexported fields
}

func LoadRuntimeConfig

func LoadRuntimeConfig() (RuntimeConfig, error)

func LoadRuntimeConfigFromArgs

func LoadRuntimeConfigFromArgs(args []string) (RuntimeConfig, error)

type TargetEndpoint

type TargetEndpoint struct {
	ID      string `json:"id"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	Enabled bool   `json:"enabled"`
}

type TargetMetricsPayload

type TargetMetricsPayload struct {
	RuleID              string `json:"rule_id"`
	TargetID            string `json:"target_id"`
	TCPConnections      int64  `json:"tcp_connections"`
	UDPPacketsPerSecond int64  `json:"udp_packets_per_second"`
	BandwidthBps        int64  `json:"bandwidth_bps"`
	UploadBytes         int64  `json:"upload_bytes"`
	DownloadBytes       int64  `json:"download_bytes"`
	LatencyMS           int64  `json:"latency_ms"`
}

type TargetPriorityBucket

type TargetPriorityBucket struct {
	Priority int              `json:"priority"`
	Targets  []TargetEndpoint `json:"targets"`
}

Jump to

Keyboard shortcuts

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