mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
29 lines
552 B
Go
29 lines
552 B
Go
package controller
|
|
|
|
import (
|
|
"V2RayA/persistence/configure"
|
|
"V2RayA/service"
|
|
"V2RayA/tools"
|
|
"github.com/json-iterator/go"
|
|
"errors"
|
|
"github.com/gin-gonic/gin"
|
|
"time"
|
|
)
|
|
|
|
func GetPingLatency(ctx *gin.Context) {
|
|
var wt []configure.Which
|
|
err := jsoniter.Unmarshal([]byte(ctx.Query("whiches")), &wt)
|
|
if err != nil {
|
|
tools.ResponseError(ctx, errors.New("参数有误"))
|
|
return
|
|
}
|
|
wt, err = service.Ping(wt, 5, 5*time.Second)
|
|
if err != nil {
|
|
tools.ResponseError(ctx, err)
|
|
return
|
|
}
|
|
tools.ResponseSuccess(ctx, gin.H{
|
|
"whiches": wt,
|
|
})
|
|
}
|