add api checkOutbound #761
This commit is contained in:
@@ -97,6 +97,8 @@ func (a *APIHandler) getHandler(c *gin.Context) {
|
||||
a.ApiService.GetTokens(c)
|
||||
case "singbox-config":
|
||||
a.ApiService.GetSingboxConfig(c)
|
||||
case "checkOutbound":
|
||||
a.ApiService.GetCheckOutbound(c)
|
||||
default:
|
||||
jsonMsg(c, "failed", common.NewError("unknown action: ", action))
|
||||
}
|
||||
|
||||
@@ -396,3 +396,10 @@ func (a *ApiService) GetSingboxConfig(c *gin.Context) {
|
||||
c.Header("Content-Disposition", "attachment; filename=config_"+time.Now().Format("20060102-150405")+".json")
|
||||
c.Writer.Write(rawConfig)
|
||||
}
|
||||
|
||||
func (a *ApiService) GetCheckOutbound(c *gin.Context) {
|
||||
tag := c.Query("tag")
|
||||
link := c.Query("link")
|
||||
result := a.ConfigService.CheckOutbound(tag, link)
|
||||
jsonObj(c, result, nil)
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@ func (a *APIv2Handler) getHandler(c *gin.Context) {
|
||||
a.ApiService.GetKeypairs(c)
|
||||
case "getdb":
|
||||
a.ApiService.GetDb(c)
|
||||
case "checkOutbound":
|
||||
a.ApiService.GetCheckOutbound(c)
|
||||
default:
|
||||
jsonMsg(c, "failed", common.NewError("unknown action: ", action))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user