Add --ipv6-countrycode runtime parameter to set the region flag using IPv6 by default (#36)
* Update main.go Add --ipv6-countrycode runtime parameter to set the region flag using IPv6 by default. * Update service.go Add --ipv6-countrycode runtime parameter to set the region flag using IPv6 by default. * Update myip.go Add --ipv6-countrycode runtime parameter to set the region flag using IPv6 by default. * chore: rename --------- Co-authored-by: naiba <[email protected]>
This commit is contained in:
+3
-1
@@ -53,6 +53,7 @@ type AgentCliParam struct {
|
||||
InsecureTLS bool // 是否禁用证书检查
|
||||
Version bool // 当前版本号
|
||||
IPReportPeriod uint32 // 上报IP间隔
|
||||
UseIPv6CountryCode bool // 默认优先展示IPv6旗帜
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -149,6 +150,7 @@ func init() {
|
||||
agentCmd.PersistentFlags().BoolVar(&agentCliParam.DisableCommandExecute, "disable-command-execute", false, "禁止在此机器上执行命令")
|
||||
agentCmd.PersistentFlags().BoolVar(&agentCliParam.DisableAutoUpdate, "disable-auto-update", false, "禁用自动升级")
|
||||
agentCmd.PersistentFlags().BoolVar(&agentCliParam.DisableForceUpdate, "disable-force-update", false, "禁用强制升级")
|
||||
agentCmd.PersistentFlags().BoolVar(&agentCliParam.UseIPv6CountryCode, "use-ipv6-countrycode", false, "使用IPv6的位置上报")
|
||||
agentCmd.PersistentFlags().BoolVar(&agentConfig.GPU, "gpu", false, "启用GPU监控")
|
||||
agentCmd.PersistentFlags().Uint32VarP(&agentCliParam.IPReportPeriod, "ip-report-period", "u", 30*60, "本地IP更新间隔, 上报频率依旧取决于report-delay的值")
|
||||
agentCmd.Flags().BoolVarP(&agentCliParam.Version, "version", "v", false, "查看当前版本号")
|
||||
@@ -217,7 +219,7 @@ func run() {
|
||||
// 上报服务器信息
|
||||
go reportState()
|
||||
// 更新IP信息
|
||||
go monitor.UpdateIP(agentCliParam.IPReportPeriod)
|
||||
go monitor.UpdateIP(agentCliParam.UseIPv6CountryCode, agentCliParam.IPReportPeriod)
|
||||
|
||||
// 定时检查更新
|
||||
if _, err := semver.Parse(version); err == nil && !agentCliParam.DisableAutoUpdate {
|
||||
|
||||
@@ -86,6 +86,7 @@ func serviceActions(cmd *cobra.Command, args []string) {
|
||||
{agentCliParam.DisableCommandExecute, "--disable-command-execute", ""},
|
||||
{agentCliParam.DisableAutoUpdate, "--disable-auto-update", ""},
|
||||
{agentCliParam.DisableForceUpdate, "--disable-force-update", ""},
|
||||
{agentCliParam.UseIPv6CountryCode, "--use-ipv6-countrycode", ""},
|
||||
{agentConfig.GPU, "--gpu", ""},
|
||||
{agentCliParam.IPReportPeriod != 30*60, "-u", fmt.Sprint(agentCliParam.IPReportPeriod)},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user