mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
36 lines
777 B
Go
36 lines
777 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/v2rayA/v2rayA/common"
|
|
"github.com/v2rayA/v2rayA/core/routingA"
|
|
"github.com/v2rayA/v2rayA/db/configure"
|
|
)
|
|
|
|
func GetRoutingA(ctx *gin.Context) {
|
|
common.ResponseSuccess(ctx, gin.H{
|
|
"routingA": configure.GetRoutingA(),
|
|
})
|
|
}
|
|
func PutRoutingA(ctx *gin.Context) {
|
|
var data struct {
|
|
RoutingA string `json:"routingA"`
|
|
}
|
|
err := ctx.ShouldBindJSON(&data)
|
|
if err != nil {
|
|
common.ResponseError(ctx, logError(err, "bad request"))
|
|
return
|
|
}
|
|
_, err = routingA.Parse(data.RoutingA)
|
|
if err != nil {
|
|
common.ResponseError(ctx, logError(err))
|
|
return
|
|
}
|
|
err = configure.SetRoutingA(&data.RoutingA)
|
|
if err != nil {
|
|
common.ResponseError(ctx, logError(err))
|
|
return
|
|
}
|
|
common.ResponseSuccess(ctx, nil)
|
|
}
|