diff --git a/config/config.go b/config/config.go index 6de70f7..9fb5bf5 100644 --- a/config/config.go +++ b/config/config.go @@ -4,12 +4,9 @@ import ( "flag" "fmt" "log/slog" - "net" "os" - "strings" "github.com/spf13/viper" - "joylink.club/bj-rtsts-server/dto" ) const ( @@ -148,23 +145,6 @@ func (c *RsspConfig) CheckAddress(srcAddr uint16, dstAddr uint16) bool { var Config AppConfig -var SimulationId_prefix = (func() string { - ip := "127.0.0.1" - addrList, err := net.InterfaceAddrs() - if err != nil { - panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()}) - } - for _, address := range addrList { - if ipNet, ok := address.(*net.IPNet); ok && !ipNet.IP.IsLoopback() { - if ipNet.IP.To4() != nil { - ip = ipNet.IP.String() - } - } - } - ipArr := strings.Split(ip, ".") - return ipArr[2] + "_" + ipArr[3] -})() - // 获取配置文件名称,从运行flag参数config中获取,若未提供,使用默认'dev' func getConfigName() string { configName := "" diff --git a/ts/test_simulation_manage.go b/ts/test_simulation_manage.go index abf340f..1130faf 100644 --- a/ts/test_simulation_manage.go +++ b/ts/test_simulation_manage.go @@ -143,8 +143,6 @@ func stopThirdParty(s *memory.VerifySimulation) { } func createSimulationId(projectId int32) string { - // // 当前服务器IP + 端口 + 项目 - // return config.SimulationId_prefix + "_" + strconv.Itoa(config.Config.Server.Port) + "_" + strconv.Itoa(int(projectId)) // MQTT客户端id+项目 return mqtt.GetClientId() + "_" + strconv.Itoa(int(projectId)) }