Documentation
¶
Overview ¶
Package nodeagent runs xray-core on a node and keeps it aligned with the configuration the panel pushes.
Index ¶
- type Agent
- type Counter
- type SystemSnapshot
- type Traffic
- type Xray
- func (x *Xray) Apply(ctx context.Context, config []byte, hash string) error
- func (x *Xray) CollectTraffic(ctx context.Context) (*Traffic, error)
- func (x *Xray) ConfigHash() string
- func (x *Xray) LoadPersistedHash()
- func (x *Xray) Logs(n int) []string
- func (x *Xray) Running() bool
- func (x *Xray) Start(ctx context.Context) error
- func (x *Xray) StartedAt() time.Time
- func (x *Xray) Stop()
- func (x *Xray) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SystemSnapshot ¶
type SystemSnapshot struct {
Hostname string
OS string
Arch string
Kernel string
CPUCount int
CPUModel string
TotalRAMBytes uint64
UsedRAMBytes uint64
CPUUsage float64
LoadAvg1 float64
}
SystemSnapshot is the host telemetry the agent reports with each heartbeat.
func Snapshot ¶
func Snapshot() SystemSnapshot
type Xray ¶
type Xray struct {
// contains filtered or unexported fields
}
Xray supervises the xray-core process.
func (*Xray) Apply ¶
Apply writes a new configuration and restarts xray. The previous config is kept so a rejected document can be rolled back without contacting the panel.
func (*Xray) CollectTraffic ¶
CollectTraffic reads and resets the counters, so every call returns the delta since the previous one. Reading with reset is what keeps the agent stateless.
func (*Xray) ConfigHash ¶
func (*Xray) LoadPersistedHash ¶
func (x *Xray) LoadPersistedHash()
LoadPersistedHash restores the hash of the config left on disk by a previous run, so a restarted agent can tell the panel it is already up to date.