mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
28 lines
585 B
Go
28 lines
585 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/v2rayA/v2rayA/common"
|
|
"github.com/v2rayA/v2rayA/db/configure"
|
|
"github.com/v2rayA/v2rayA/service"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func PutPorts(ctx *gin.Context) {
|
|
var data configure.Ports
|
|
err := ctx.ShouldBindJSON(&data)
|
|
if err != nil {
|
|
common.ResponseError(ctx, logError(nil, "bad request"))
|
|
return
|
|
}
|
|
err = service.SetPorts(&data)
|
|
if err != nil {
|
|
common.ResponseError(ctx, logError(err))
|
|
return
|
|
}
|
|
common.ResponseSuccess(ctx, nil)
|
|
}
|
|
|
|
func GetPorts(ctx *gin.Context) {
|
|
common.ResponseSuccess(ctx, service.GetPortsDefault())
|
|
}
|