mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 07:06:36 +08:00
fix lint
This commit is contained in:
+5
-3
@@ -1,3 +1,4 @@
|
||||
// Command agent runs the OpenFlare edge agent daemon.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -95,8 +96,8 @@ func main() {
|
||||
heartbeatService := heartbeat.New(client)
|
||||
updateService := updater.New()
|
||||
runner := &agent.Runner{
|
||||
Config: cfg,
|
||||
StateStore: stateStore,
|
||||
Config: cfg,
|
||||
StateStore: stateStore,
|
||||
HeartbeatCycle: &heartbeat.Cycle{
|
||||
Config: cfg,
|
||||
StateStore: stateStore,
|
||||
@@ -112,7 +113,6 @@ func main() {
|
||||
}
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
geoIPUpdater := &geoipupdate.Updater{
|
||||
MMDBPath: cfg.MMDBPath,
|
||||
DownloadURL: cfg.MMDBDownloadURL,
|
||||
@@ -123,7 +123,9 @@ func main() {
|
||||
|
||||
if err = runner.Run(ctx); err != nil && err != context.Canceled {
|
||||
slog.Error("agent process exited with error", "error", err)
|
||||
stop()
|
||||
os.Exit(1)
|
||||
}
|
||||
stop()
|
||||
slog.Info("agent process stopped")
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,3 +1,4 @@
|
||||
// Command flared runs the OpenFlare tunnel client daemon.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -41,7 +42,7 @@ func main() {
|
||||
frpcManager := frpc.NewManager(cfg)
|
||||
_ = frpcManager.LoadState()
|
||||
|
||||
slog.Info("detected frpc version", "version", frpcManager.GetVersion())
|
||||
slog.Info("detected frpc version", "version", frpcManager.GetVersion(context.Background()))
|
||||
|
||||
httpClient := httpclient.New(cfg.ServerURL, cfg.InitialAuthToken(), cfg.RequestTimeout.Duration())
|
||||
wsClient := wsclient.New(cfg.ServerURL, cfg.InitialAuthToken(), cfg.RequestTimeout.Duration())
|
||||
@@ -52,20 +53,21 @@ func main() {
|
||||
runner := &flared.Runner{
|
||||
Config: cfg,
|
||||
FrpcManager: frpcManager,
|
||||
HttpClient: httpClient,
|
||||
HTTPClient: httpClient,
|
||||
WebSocketService: wsClient,
|
||||
HeartbeatService: heartbeatService,
|
||||
SyncService: syncService,
|
||||
}
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
slog.Info("flared process started")
|
||||
|
||||
if err := runner.Run(ctx); err != nil && err != context.Canceled {
|
||||
slog.Error("flared process exited with error", "error", err)
|
||||
stop()
|
||||
os.Exit(1)
|
||||
}
|
||||
stop()
|
||||
slog.Info("flared process stopped")
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,3 +1,4 @@
|
||||
// Command relay runs the OpenFlare relay node daemon.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -44,7 +45,7 @@ func main() {
|
||||
|
||||
frpsManager := frps.NewManager(cfg.FrpsPath, cfg.DataDir, cfg.InitialAuthToken())
|
||||
|
||||
slog.Info("detected frps version", "version", frpsManager.GetVersion())
|
||||
slog.Info("detected frps version", "version", frpsManager.GetVersion(context.Background()))
|
||||
|
||||
httpClient := httpclient.New(cfg.ServerURL, cfg.InitialAuthToken(), cfg.RequestTimeout.Duration())
|
||||
wsClient := wsclient.New(cfg.ServerURL, cfg.InitialAuthToken(), cfg.RequestTimeout.Duration())
|
||||
@@ -53,19 +54,20 @@ func main() {
|
||||
Config: cfg,
|
||||
StateStore: stateStore,
|
||||
FrpsManager: frpsManager,
|
||||
HttpClient: httpClient,
|
||||
HTTPClient: httpClient,
|
||||
WebSocketService: wsClient,
|
||||
HeartbeatService: heartbeat.New(httpClient, frpsManager, cfg, stateStore),
|
||||
}
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
slog.Info("relay process started")
|
||||
|
||||
if err := runner.Run(ctx); err != nil && err != context.Canceled {
|
||||
slog.Error("relay process exited with error", "error", err)
|
||||
stop()
|
||||
os.Exit(1)
|
||||
}
|
||||
stop()
|
||||
slog.Info("relay process stopped")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user