chore: code style (#44)

* some code refactor

* service

* chore: code style

---------

Co-authored-by: naiba <[email protected]>
This commit is contained in:
UUBulb
2024-07-23 23:20:55 +08:00
committed by GitHub
co-authored by naiba
parent a99bf7066b
commit c0288971d8
5 changed files with 57 additions and 67 deletions
+4 -1
View File
@@ -38,6 +38,7 @@ import (
pb "github.com/nezhahq/agent/proto"
)
// Agent 运行时参数。如需添加新参数,记得同时在 service.go 中添加
type AgentCliParam struct {
SkipConnectionCount bool // 跳过连接数检查
SkipProcsCount bool // 跳过进程数量检查
@@ -432,7 +433,9 @@ func reportState() {
// doSelfUpdate 执行更新检查 如果更新成功则会结束进程
func doSelfUpdate(useLocalVersion bool) {
<-monitor.Sync
if monitor.CachedCountry == "" {
return
}
v := semver.MustParse("0.1.0")
if useLocalVersion {
v = semver.MustParse(version)
+1
View File
@@ -86,6 +86,7 @@ func serviceActions(cmd *cobra.Command, args []string) {
{agentCliParam.DisableForceUpdate, "--disable-force-update", ""},
{agentCliParam.UseIPv6CountryCode, "--use-ipv6-countrycode", ""},
{agentConfig.GPU, "--gpu", ""},
{agentCliParam.UseGiteeToUpgrade, "--gitee", ""},
{agentCliParam.IPReportPeriod != 30*60, "-u", fmt.Sprint(agentCliParam.IPReportPeriod)},
}