engine

package
v0.0.0-...-b380bb8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package engine manages one embedded Xray instance and its saved configuration.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConflict = errors.New("Xray configuration changed; reload before saving or applying")
	ErrInvalid  = errors.New("invalid Xray configuration")
	ErrClosed   = errors.New("Xray module is closed")
)

Functions

This section is empty.

Types

type Engine

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

func Open

func Open(dir string) (*Engine, error)

func (*Engine) Apply

func (e *Engine) Apply(revision uint64) (Snapshot, error)

Apply starts the draft, replacing the running core if necessary. On failure, the previous applied configuration stays on disk and the old core is restored.

func (*Engine) Close

func (e *Engine) Close() error

func (*Engine) Save

func (e *Engine) Save(revision uint64, raw json.RawMessage) (Snapshot, error)

func (*Engine) Snapshot

func (e *Engine) Snapshot() Snapshot

func (*Engine) Stop

func (e *Engine) Stop(revision uint64) (Snapshot, error)

type Snapshot

type Snapshot struct {
	Config   json.RawMessage `json:"config"`
	Revision uint64          `json:"revision"`
	Enabled  bool            `json:"enabled"`
	Running  bool            `json:"running"`
	Pending  bool            `json:"pending"`
	Error    string          `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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