Add zertier (#1124)

Signed-off-by: link <a624669980@163.com>
This commit is contained in:
link 2023-05-25 12:14:32 +08:00 committed by GitHub
parent 50816c68b0
commit dda15b0821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -24,6 +24,7 @@ import (
"github.com/IceWhaleTech/CasaOS/pkg/samba"
"github.com/IceWhaleTech/CasaOS/pkg/utils/encryption"
"github.com/IceWhaleTech/CasaOS/pkg/utils/file"
v1 "github.com/IceWhaleTech/CasaOS/route/v1"
"github.com/IceWhaleTech/CasaOS/service"
"go.uber.org/zap"
)
@ -31,6 +32,7 @@ import (
func InitFunction() {
go InitNetworkMount()
go InitInfo()
go InitZerotier()
}
func InitInfo() {
@ -98,3 +100,6 @@ func InitNetworkMount() {
logger.Error("mount storage err", zap.Any("err", err))
}
}
func InitZerotier() {
v1.CheckNetwork()
}

View file

@ -40,7 +40,7 @@ func InitV1Router() *gin.Engine {
})
r.GET("/v1/recover/:type", v1.GetRecoverStorage)
v1Group := r.Group("/v1")
r.Any("/v1/test", v1.CheckNetwork)
// r.Any("/v1/test", v1.CheckNetwork)
v1Group.Use(jwt.ExceptLocalhost(func() (*ecdsa.PublicKey, error) { return external.GetPublicKey(config.CommonInfo.RuntimePath) }))
{

View file

@ -75,7 +75,8 @@ func copyHeaders(destination, source http.Header) {
}
}
func CheckNetwork(c *gin.Context) {
func CheckNetwork() {
//先获取所有已创建的网络
respBody, err := httper.ZTGet("/controller/network")
if err != nil {