Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Mar 29, 2023
1 parent f6b9d3b commit 898d4e7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/controller/trojan.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"
"trojan/core"
"trojan/trojan"
websocket "trojan/util"
"trojan/util"
)

// Start 启动trojan
Expand Down Expand Up @@ -71,16 +71,16 @@ func GetLogLevel() *ResponseBody {
// Log 通过ws查看trojan实时日志
func Log(c *gin.Context) {
var (
wsConn *websocket.WsConnection
wsConn *util.WsConnection
err error
)
if wsConn, err = websocket.InitWebsocket(c.Writer, c.Request); err != nil {
if wsConn, err = util.InitWebsocket(c.Writer, c.Request); err != nil {
fmt.Println(err)
return
}
defer wsConn.WsClose()
param := c.DefaultQuery("line", "300")
if !websocket.IsInteger(param) {
if !util.IsInteger(param) {
fmt.Println("invalid param: " + param)
return
}
Expand All @@ -89,7 +89,7 @@ func Log(c *gin.Context) {
} else {
param = "-n " + param
}
result, err := websocket.LogChan("trojan", param, wsConn.CloseChan)
result, err := util.LogChan("trojan", param, wsConn.CloseChan)
if err != nil {
fmt.Println(err)
return
Expand Down

0 comments on commit 898d4e7

Please sign in to comment.