diff --git a/common/constants.go b/common/constants.go index 4196f24..1f5425d 100644 --- a/common/constants.go +++ b/common/constants.go @@ -3,5 +3,6 @@ package common const ( SERVICENAME = "casaos" VERSION = "0.4.4" - BODY = " " + BODY = "" + RANW_NAME = "IceWhale-RemoteAccess" ) diff --git a/route/v1/zerotier.go b/route/v1/zerotier.go index a1b06c9..ce336e3 100644 --- a/route/v1/zerotier.go +++ b/route/v1/zerotier.go @@ -6,6 +6,7 @@ import ( "net/http" "strings" + "github.com/IceWhaleTech/CasaOS/common" "github.com/IceWhaleTech/CasaOS/pkg/utils/httper" "github.com/gin-gonic/gin" "github.com/tidwall/gjson" @@ -91,7 +92,7 @@ func CheckNetwork(c *gin.Context) { return } name := gjson.GetBytes(res, "name").Str - if name == "icewhale-casaos" { + if name == common.RANW_NAME { fmt.Println(string(res)) networkId = gjson.GetBytes(res, "id").Str break @@ -156,7 +157,7 @@ func JoinAndUpdateNet(address, networkId string) { } func CreateNet(address string) string { body := `{ - "name": "icewhale-casaos", + "name": "` + common.RANW_NAME + `", "private": false, "v4AssignMode": { "zt": true diff --git a/route/v2/zerotier.go b/route/v2/zerotier.go index 7278300..03d8ae4 100644 --- a/route/v2/zerotier.go +++ b/route/v2/zerotier.go @@ -6,6 +6,7 @@ import ( "github.com/IceWhaleTech/CasaOS-Common/utils" "github.com/IceWhaleTech/CasaOS/codegen" + "github.com/IceWhaleTech/CasaOS/common" "github.com/IceWhaleTech/CasaOS/pkg/utils/httper" "github.com/labstack/echo/v4" "github.com/tidwall/gjson" @@ -55,7 +56,7 @@ func (s *CasaOS) GetZerotierInfo(ctx echo.Context) error { return ctx.JSON(http.StatusInternalServerError, codegen.BaseResponse{Message: utils.Ptr(err.Error())}) } name := gjson.GetBytes(res, "name").Str - if name == "icewhale-casaos" { + if name == common.RANW_NAME { via := gjson.GetBytes(res, "routes.0.via").Str info.Id = utils.Ptr(gjson.GetBytes(res, "id").Str) info.Name = &name