Versions in this module Expand all Collapse all v1 v1.0.1 Aug 28, 2026 v1.0.0 Aug 28, 2026 Changes in this version + const VerifyPortBase + var IranDirectDomains = []string + var IranDirectIPRanges = []string + func EnsureSingBoxBinary() (string, error) + func FormatBytes(b int64) string + func FormatSpeed(bytesPerSec int64) string + func VerifyNodeReal(ctx context.Context, node *model.ProxyNode, testURL string, ...) (time.Duration, error) + type Engine struct + func NewEngine(cfg *config.AppConfig) *Engine + func (e *Engine) FailoverToNext() + func (e *Engine) GetCurrentNode() *model.ProxyNode + func (e *Engine) GetStats() *TrafficStats + func (e *Engine) StartNode(ctx context.Context, node *model.ProxyNode, mode model.ConnectionMode, ...) error + func (e *Engine) Stop() error + type SingBoxConfig struct + DNS map[string]interface{} + Experimental map[string]interface{} + Inbounds []map[string]interface{} + Log map[string]interface{} + Outbounds []map[string]interface{} + Route map[string]interface{} + func GenerateConfig(node *model.ProxyNode, mode model.ConnectionMode, ...) (*SingBoxConfig, error) + func (c *SingBoxConfig) ToJSON() ([]byte, error) + type SystemProxyController struct + func NewSystemProxyController(httpPort, socksPort int) *SystemProxyController + func (s *SystemProxyController) Disable() error + func (s *SystemProxyController) Enable() error + type TrafficStats struct + BytesDownload int64 + BytesUpload int64 + DownloadSpeed int64 + UploadSpeed int64 + func NewTrafficStats() *TrafficStats + func (s *TrafficStats) AddDownload(n int64) + func (s *TrafficStats) AddUpload(n int64) + func (s *TrafficStats) SetTotals(download, upload int64) + func (s *TrafficStats) Snapshot() (uploadTotal, downloadTotal, upSpeed, downSpeed int64) + func (s *TrafficStats) Tick() + type Watchdog struct + FailThreshold int + Interval time.Duration + OnFailover func(reason string) + OnHealthUpdate func(latency time.Duration, ok bool) + ProxyURL string + TestURL string + func NewWatchdog(intervalSec int, socksPort int, testURL string) *Watchdog + func (w *Watchdog) Start(ctx context.Context) + func (w *Watchdog) Stop()