Documentation
¶
Index ¶
- Variables
- func EncodePrivate(privKey *ecdsa.PrivateKey) (string, error)
- func HysteriaPortForwardNeedsRepair(status HysteriaPortForwardStatus) bool
- func ResolveMachineNodeConfigs(ctx context.Context, cfg *conf.Conf) error
- func SetHysteriaPortForwardDisabled()
- func SetRealtimeHealthSnapshot(snapshot RealtimeHealthSnapshot)
- type ControlPlane
- type ControlPlaneFactory
- type ControlPlaneRealtimeBootstrap
- type ControlPlaneUnifiedReporter
- type Controller
- type HysteriaPortForwardRuleSpec
- type HysteriaPortForwardStatus
- func CleanupHysteriaPortForward(ctx context.Context) HysteriaPortForwardStatus
- func GetHysteriaPortForwardStatusSnapshot() HysteriaPortForwardStatus
- func InspectHysteriaPortForward(ctx context.Context, infos []*panel.NodeInfo) HysteriaPortForwardStatus
- func RepairHysteriaPortForward(ctx context.Context, infos []*panel.NodeInfo) HysteriaPortForwardStatus
- type HysteriaPortForwardToolStatus
- type Lego
- type MachineOptions
- type MachinePanelNode
- type MachineRealtimeManager
- type Node
- func (n *Node) ActiveConfigs() []conf.NodeConfig
- func (n *Node) Close() error
- func (n *Node) Failures() []NodeFailure
- func (n *Node) Reconcile(ctx context.Context, desired []conf.NodeConfig, realtime conf.RealtimeConfig, ...) (*ReconcileResult, error)
- func (n *Node) SetAutoHY2PortForward(enabled bool)
- func (n *Node) Start(nodes []conf.NodeConfig, core *core.V2Core) error
- type NodeFailure
- type RealtimeBootstrap
- type RealtimeClient
- type RealtimeHealthSnapshot
- type RealtimeOptions
- type RealtimeRuntimeSnapshot
- type ReconcileResult
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrControlPlaneUnifiedReportUnsupported = errors.New("control plane unified report unsupported")
Functions ¶
func EncodePrivate ¶
func EncodePrivate(privKey *ecdsa.PrivateKey) (string, error)
func HysteriaPortForwardNeedsRepair ¶ added in v0.3.22
func HysteriaPortForwardNeedsRepair(status HysteriaPortForwardStatus) bool
func SetHysteriaPortForwardDisabled ¶ added in v0.3.22
func SetHysteriaPortForwardDisabled()
func SetRealtimeHealthSnapshot ¶
func SetRealtimeHealthSnapshot(snapshot RealtimeHealthSnapshot)
Types ¶
type ControlPlane ¶
type ControlPlane interface {
GetNodeInfo(ctx context.Context) (*panel.NodeInfo, error)
GetUserList(ctx context.Context) ([]panel.UserInfo, error)
GetUserDelta(ctx context.Context, since int64) (*panel.UserDeltaBody, error)
GetUserAlive(ctx context.Context) (map[int]int, error)
CachedAliveMap() map[int]int
CachedAliveSnapshot() *panel.AliveMap
ReportUserTraffic(ctx context.Context, userTraffic []panel.UserTraffic) error
ReportNodeOnlineUsers(ctx context.Context, data *map[int][]string) error
}
ControlPlane defines the panel-facing operations used by node controllers. It lets us swap panel implementations without touching controller logic.
type ControlPlaneFactory ¶
type ControlPlaneFactory interface {
New(nodeConfig *conf.NodeConfig) (ControlPlane, error)
}
type ControlPlaneRealtimeBootstrap ¶
type ControlPlaneRealtimeBootstrap interface {
GetRealtimeBootstrap(ctx context.Context) (*RealtimeBootstrap, error)
}
ControlPlaneRealtimeBootstrap exposes optional realtime bootstrap hints (e.g. ws_url from handshake).
type ControlPlaneUnifiedReporter ¶
type ControlPlaneUnifiedReporter interface {
ReportSnapshot(ctx context.Context, userTraffic []panel.UserTraffic, online map[int][]string) error
}
ControlPlaneUnifiedReporter exposes optional unified reporting capability.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(api *panel.Client, conf *conf.NodeConfig, info *panel.NodeInfo, realtime conf.RealtimeConfig) *Controller
NewController return a Node controller with default parameters.
func NewControllerWithControlPlane ¶
func NewControllerWithControlPlane(controlPlane ControlPlane, conf *conf.NodeConfig, info *panel.NodeInfo, realtime conf.RealtimeConfig) *Controller
NewControllerWithControlPlane return a Node controller with a custom control plane.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close implement the Close() function of the service interface
func (*Controller) Start ¶
func (c *Controller) Start(x *core.V2Core) error
Start implement the Start() function of the service interface
func (*Controller) StartReplacing ¶ added in v0.3.23
func (c *Controller) StartReplacing(x *core.V2Core, old *Controller) (bool, error)
type HysteriaPortForwardRuleSpec ¶ added in v0.3.22
type HysteriaPortForwardStatus ¶ added in v0.3.22
type HysteriaPortForwardStatus struct {
Enabled bool `json:"enabled"`
RunningAsRoot bool `json:"running_as_root"`
UpdatedAt string `json:"updated_at,omitempty"`
ExpectedRules []HysteriaPortForwardRuleSpec `json:"expected_rules"`
Tools []HysteriaPortForwardToolStatus `json:"tools"`
Errors []string `json:"errors,omitempty"`
}
func CleanupHysteriaPortForward ¶ added in v0.3.22
func CleanupHysteriaPortForward(ctx context.Context) HysteriaPortForwardStatus
func GetHysteriaPortForwardStatusSnapshot ¶ added in v0.3.22
func GetHysteriaPortForwardStatusSnapshot() HysteriaPortForwardStatus
func InspectHysteriaPortForward ¶ added in v0.3.22
func InspectHysteriaPortForward(ctx context.Context, infos []*panel.NodeInfo) HysteriaPortForwardStatus
func RepairHysteriaPortForward ¶ added in v0.3.22
func RepairHysteriaPortForward(ctx context.Context, infos []*panel.NodeInfo) HysteriaPortForwardStatus
type HysteriaPortForwardToolStatus ¶ added in v0.3.22
type HysteriaPortForwardToolStatus struct {
Tool string `json:"tool"`
Available bool `json:"available"`
Current []string `json:"current"`
Expected []string `json:"expected"`
Missing []string `json:"missing"`
Extra []string `json:"extra"`
StaleChain bool `json:"stale_chain"`
Error string `json:"error,omitempty"`
}
type Lego ¶
type Lego struct {
// contains filtered or unexported fields
}
func (*Lego) CreateCert ¶
func (*Lego) SetProvider ¶
type MachineOptions ¶
type MachineOptions struct {
ContinueOnError bool
}
type MachinePanelNode ¶
type MachineRealtimeManager ¶ added in v0.3.22
type MachineRealtimeManager struct {
// contains filtered or unexported fields
}
func NewMachineRealtimeManager ¶ added in v0.3.22
func NewMachineRealtimeManager(parent context.Context, profiles []conf.MachineProfileConfig, fallback conf.RealtimeConfig, onReload func()) *MachineRealtimeManager
func (*MachineRealtimeManager) Close ¶ added in v0.3.22
func (m *MachineRealtimeManager) Close()
func (*MachineRealtimeManager) Start ¶ added in v0.3.22
func (m *MachineRealtimeManager) Start()
type Node ¶
func New ¶
func New(nodes []conf.NodeConfig, realtime conf.RealtimeConfig) (*Node, error)
func NewMachine ¶
func NewMachine(nodes []conf.NodeConfig, realtime conf.RealtimeConfig, opts MachineOptions) (*Node, error)
func (*Node) ActiveConfigs ¶
func (n *Node) ActiveConfigs() []conf.NodeConfig
func (*Node) Failures ¶
func (n *Node) Failures() []NodeFailure
func (*Node) Reconcile ¶
func (n *Node) Reconcile(ctx context.Context, desired []conf.NodeConfig, realtime conf.RealtimeConfig, coreInstance *core.V2Core, opts MachineOptions) (*ReconcileResult, error)
func (*Node) SetAutoHY2PortForward ¶ added in v0.3.4
type NodeFailure ¶
type NodeFailure struct {
Config conf.NodeConfig
Err error
}
func FetchNodeInfos ¶ added in v0.3.22
func FetchNodeInfos(ctx context.Context, configs []conf.NodeConfig, opts MachineOptions) ([]*panel.NodeInfo, []NodeFailure, error)
FetchNodeInfos loads panel node configs without starting controllers or core.
type RealtimeBootstrap ¶
type RealtimeClient ¶
type RealtimeClient struct {
// contains filtered or unexported fields
}
func NewRealtimeClient ¶
func NewRealtimeClient(parent context.Context, opts RealtimeOptions, onMessage func(realtimeMessage)) *RealtimeClient
func (*RealtimeClient) Close ¶
func (c *RealtimeClient) Close()
func (*RealtimeClient) Send ¶
func (c *RealtimeClient) Send(message realtimeMessage)
func (*RealtimeClient) Start ¶
func (c *RealtimeClient) Start()
type RealtimeHealthSnapshot ¶
type RealtimeHealthSnapshot struct {
Status string `json:"status,omitempty"`
Ready bool `json:"ready"`
Version string `json:"version,omitempty"`
ConfigPath string `json:"config_path,omitempty"`
StartedAt string `json:"started_at,omitempty"`
UptimeSeconds int64 `json:"uptime_seconds,omitempty"`
LastReloadAt string `json:"last_reload_at,omitempty"`
NodeCount int `json:"node_count,omitempty"`
RealtimeEnabled bool `json:"realtime_enabled"`
HealthPort int `json:"health_port,omitempty"`
Goroutines int `json:"goroutines,omitempty"`
Runtime RealtimeRuntimeSnapshot `json:"runtime"`
UpdatedAt string `json:"updated_at,omitempty"`
}
func GetRealtimeHealthSnapshot ¶
func GetRealtimeHealthSnapshot() *RealtimeHealthSnapshot
type RealtimeOptions ¶
type RealtimeRuntimeSnapshot ¶
type ReconcileResult ¶
type User ¶
type User struct {
Email string `json:"Email"`
Registration *registration.Resource `json:"Registration"`
KeyEncoded string `json:"Key"`
// contains filtered or unexported fields
}
func (*User) DecodePrivate ¶
func (u *User) DecodePrivate(pemEncodedPriv string) (*ecdsa.PrivateKey, error)
func (*User) GetPrivateKey ¶
func (u *User) GetPrivateKey() crypto.PrivateKey
func (*User) GetRegistration ¶
func (u *User) GetRegistration() *registration.Resource