[agent-go] - bug fixs
This commit is contained in:
@@ -322,9 +322,18 @@ func uniformAgentServerName(agentInfo *a_status.AgentInfo, agentServerInfo *a_ag
|
||||
|
||||
var numS string
|
||||
if agentServerInfo.ServerIPInV4 != "" {
|
||||
// 使用IP最为Agent的序号代码
|
||||
split := strings.Split(agentServerInfo.ServerIPInV4, ".")
|
||||
numS = split[3]
|
||||
|
||||
// 归一化长度为 003 123 234
|
||||
parseInt, err := strconv.ParseInt(numS, 10, 64)
|
||||
if err != nil {
|
||||
log.WarnF("parse server ip to int error ! => %v", err)
|
||||
}
|
||||
numS = fmt.Sprintf("%03d", parseInt)
|
||||
} else {
|
||||
// 没有IP信息,随机生成一个
|
||||
// Seed the random number generator
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user