diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-03-17 01:01:14 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-03-17 01:01:14 +0300 |
| commit | bc56e637376142c370c31b17558fc3778a863bd2 (patch) | |
| tree | c79da826c4dc58ca6b024a419959ed3475599a10 /web/controller | |
| parent | a3e562896178fadc3df5a921669e75824180ccf8 (diff) | |
pack1
Diffstat (limited to 'web/controller')
| -rw-r--r-- | web/controller/server.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/web/controller/server.go b/web/controller/server.go index 2dd40a0a..673a96d8 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -34,6 +34,8 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.Use(a.checkLogin) g.POST("/status", a.status) g.POST("/getXrayVersion", a.getXrayVersion) + g.POST("/stopXrayService", a.stopXrayService) + g.POST("/restartXrayService", a.restartXrayService) g.POST("/installXray/:version", a.installXray) } @@ -83,3 +85,23 @@ func (a *ServerController) installXray(c *gin.Context) { err := a.serverService.UpdateXray(version) jsonMsg(c, I18n(c, "install")+" xray", err) } + +func (a *ServerController) stopXrayService(c *gin.Context) { + a.lastGetStatusTime = time.Now() + err := a.serverService.StopXrayService() + if err != nil { + jsonMsg(c, "", err) + return + } + jsonMsg(c, "Xray stoped",err) + +} +func (a *ServerController) restartXrayService(c *gin.Context) { + err := a.serverService.RestartXrayService() + if err != nil { + jsonMsg(c, "", err) + return + } + jsonMsg(c, "Xray restarted",err) + +}
\ No newline at end of file |
