node

package
v3.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MPL-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePrivate

func EncodePrivate(privKey *ecdsa.PrivateKey) (string, error)

Types

type Controller

type Controller struct {
	*conf.Options
	// contains filtered or unexported fields
}

func NewController

func NewController(server vCore.Core, api apiclient.NodeAPI, config *conf.Options) *Controller

NewController return a Node controller with default parameters.

func (*Controller) Close

func (c *Controller) Close() error

Close implement the Close() function of the service interface

func (*Controller) SetPluginSupervisor

func (c *Controller) SetPluginSupervisor(supervisor *plugin.Supervisor)

func (*Controller) SpeedChecker

func (c *Controller) SpeedChecker() error

func (*Controller) Start

func (c *Controller) Start() error

Start implement the Start() function of the service interface

type Lego

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

func NewLego

func NewLego(config *conf.CertConfig) (*Lego, error)

func (*Lego) CheckCert

func (l *Lego) CheckCert(file []byte) (bool, error)

func (*Lego) CreateCert

func (l *Lego) CreateCert() (err error)

func (*Lego) RenewCert

func (l *Lego) RenewCert() error

func (*Lego) SetProvider

func (l *Lego) SetProvider() error

type Node

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

func New

func New() *Node

func (*Node) Close

func (n *Node) Close()

func (*Node) Start

func (n *Node) Start(nodes []conf.NodeConfig, core vCore.Core) error

type RemoteLogHook

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

func NewRemoteLogHook

func NewRemoteLogHook(client apiclient.NodeAPI, tag string) *RemoteLogHook

func (*RemoteLogHook) Close

func (h *RemoteLogHook) Close()

func (*RemoteLogHook) Fire

func (h *RemoteLogHook) Fire(entry *log.Entry) error

func (*RemoteLogHook) Levels

func (h *RemoteLogHook) Levels() []log.Level

type SyncConfig

type SyncConfig struct {
	// WebSocket 閰嶇疆
	EnableWebSocket     bool          `json:"EnableWebSocket"`
	WSEndpoint          string        `json:"WSEndpoint"`
	WSEndpointFallbacks []string      `json:"WSEndpointFallbacks,omitempty"`
	ReconnectInterval   time.Duration `json:"ReconnectInterval"`
	MaxReconnectTries   int           `json:"MaxReconnectTries"` // 0 = 鏃犻檺閲嶈瘯

	// 蹇冭烦閰嶇疆
	PingInterval time.Duration `json:"PingInterval"`
	PongTimeout  time.Duration `json:"PongTimeout"`

	// 娑堟伅閰嶇疆
	AckTimeout time.Duration `json:"AckTimeout"`
	BufferSize int           `json:"BufferSize"`
	AckRetries int           `json:"AckRetries"`

	// 闄嶇骇閰嶇疆
	EnableFallback   bool          `json:"EnableFallback"`
	FallbackInterval time.Duration `json:"FallbackInterval"`
}

SyncConfig 鍚屾閰嶇疆

func DefaultSyncConfig

func DefaultSyncConfig() *SyncConfig

DefaultSyncConfig 榛樿鍚屾閰嶇疆

type SyncManager

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

SyncManager 鍚屾绠$悊鍣?

func NewSyncManager

func NewSyncManager(client apiclient.NodeAPI, controller *Controller, config *SyncConfig) *SyncManager

NewSyncManager 鍒涘缓鍚屾绠$悊鍣?

func (*SyncManager) Close

func (sm *SyncManager) Close() error

Close 鍏抽棴鍚屾绠$悊鍣?

func (*SyncManager) IsConnected

func (sm *SyncManager) IsConnected() bool

IsConnected 鏄惁宸茶繛鎺?

func (*SyncManager) Start

func (sm *SyncManager) Start() error

Start 鍚姩鍚屾绠$悊鍣?

func (*SyncManager) Stats

func (sm *SyncManager) Stats() *SyncStats

Stats 鑾峰彇缁熻淇℃伅

type SyncState

type SyncState int32

SyncState 鍚屾鐘舵€?

const (
	SyncStateDisconnected SyncState = iota
	SyncStateConnecting
	SyncStateConnected
	SyncStateFallback
	SyncStateClosed
)

func (SyncState) String

func (s SyncState) String() string

type SyncStats

type SyncStats struct {
	MessagesReceived int64
	MessagesSent     int64
	ReconnectCount   int64
	LastConnectedAt  time.Time
	LastMessageAt    time.Time
	CurrentLatency   int64 // ms
}

SyncStats 鍚屾缁熻

type User

type User struct {
	Email        string                 `json:"Email"`
	Registration *registration.Resource `json:"Registration"`

	KeyEncoded string `json:"Key"`
	// contains filtered or unexported fields
}

func NewLegoUser

func NewLegoUser(path string, email string) (*User, error)

func (*User) DecodePrivate

func (u *User) DecodePrivate(pemEncodedPriv string) (*ecdsa.PrivateKey, error)

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetPrivateKey

func (u *User) GetPrivateKey() crypto.PrivateKey

func (*User) GetRegistration

func (u *User) GetRegistration() *registration.Resource

func (*User) Load

func (u *User) Load(path string) error

func (*User) Save

func (u *User) Save(path string) error

Jump to

Keyboard shortcuts

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