Feat: remote test ping and ping-back

This commit is contained in:
HFO4
2020-02-27 11:17:59 +08:00
parent f1ef21e195
commit bd643fa2d5
9 changed files with 129 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/HFO4/cloudreve/pkg/filesystem/driver/local"
"github.com/HFO4/cloudreve/pkg/filesystem/fsctx"
"github.com/HFO4/cloudreve/pkg/serializer"
"github.com/HFO4/cloudreve/service/admin"
"github.com/HFO4/cloudreve/service/explorer"
"github.com/gin-gonic/gin"
"net/url"
@@ -146,3 +147,14 @@ func SlaveDelete(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// SlavePing 从机测试
func SlavePing(c *gin.Context) {
var service admin.SlavePingService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Test()
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}