@@ -73,7 +73,7 @@ func (h *SSEHandler) HandleTunnelSSE(c *gin.Context) {
7373 clientID := uuid .New ().String ()
7474
7575 // 发送连接成功消息(使用标准SSE格式)
76- c .Writer .Write ([]byte ("data: " + `{"type":"connected","message":"连接成功 "}` + "\n \n " ))
76+ c .Writer .Write ([]byte ("data: " + `{"type":"connected","message":"Connected "}` + "\n \n " ))
7777 c .Writer .Flush ()
7878
7979 // log.Infof("前端请求隧道SSE订阅,tunnelID=%s clientID=%s remote=%s", tunnelID, clientID, c.ClientIP())
@@ -101,12 +101,12 @@ func (h *SSEHandler) HandleTestSSEEndpoint(c *gin.Context) {
101101 APIKey string `json:"apiKey"`
102102 }
103103 if err := c .ShouldBindJSON (& req ); err != nil {
104- c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "无效的JSON " })
104+ c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "Invalid JSON " })
105105 return
106106 }
107107
108108 if req .URL == "" || req .APIPath == "" || req .APIKey == "" {
109- c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "缺少必要参数 " })
109+ c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "Missing required parameters " })
110110 return
111111 }
112112
@@ -127,35 +127,35 @@ func (h *SSEHandler) HandleTestSSEEndpoint(c *gin.Context) {
127127
128128 request , err := http .NewRequestWithContext (ctx , http .MethodGet , sseURL , nil )
129129 if err != nil {
130- h .loggerErrorGin (c , "构建请求失败 " , err )
130+ h .loggerErrorGin (c , "Failed to create request " , err )
131131 return
132132 }
133133 request .Header .Set ("X-API-Key" , req .APIKey )
134134 request .Header .Set ("Accept" , "text/event-stream" )
135135
136136 resp , err := client .Do (request )
137137 if err != nil {
138- h .loggerErrorGin (c , "连接失败 " , err )
138+ h .loggerErrorGin (c , "Connection failed " , err )
139139 return
140140 }
141141 defer resp .Body .Close ()
142142
143143 if resp .StatusCode != http .StatusOK {
144- msg := fmt .Sprintf ("NodePass SSE返回状态码 : %d" , resp .StatusCode )
144+ msg := fmt .Sprintf ("NodePass SSE returned status code : %d" , resp .StatusCode )
145145 h .writeErrorGin (c , msg )
146146 return
147147 }
148148
149149 // 简单验证 Content-Type
150150 if ct := resp .Header .Get ("Content-Type" ); ct != "text/event-stream" && ct != "text/event-stream; charset=utf-8" {
151- h .writeErrorGin (c , "响应Content-Type不是SSE流 " )
151+ h .writeErrorGin (c , "Response Content-Type is not SSE stream " )
152152 return
153153 }
154154
155155 // 成功
156156 c .JSON (http .StatusOK , gin.H {
157157 "success" : true ,
158- "message" : "连接测试成功 " ,
158+ "message" : "Connection test successful " ,
159159 "details" : gin.H {
160160 "url" : req .URL ,
161161 "apiPath" : req .APIPath ,
@@ -229,7 +229,7 @@ func (h *SSEHandler) updateLogCleanupConfig(c *gin.Context) {
229229 if err := c .ShouldBindJSON (& req ); err != nil {
230230 c .JSON (http .StatusBadRequest , gin.H {
231231 "success" : false ,
232- "error" : "请求格式错误 : " + err .Error (),
232+ "error" : "Invalid request format : " + err .Error (),
233233 })
234234 return
235235 }
@@ -253,7 +253,7 @@ func (h *SSEHandler) updateLogCleanupConfig(c *gin.Context) {
253253 if interval , err := time .ParseDuration (* req .CleanupInterval ); err != nil {
254254 c .JSON (http .StatusBadRequest , gin.H {
255255 "success" : false ,
256- "error" : "清理间隔格式错误 : " + err .Error (),
256+ "error" : "Invalid cleanup interval format : " + err .Error (),
257257 })
258258 return
259259 } else {
@@ -293,23 +293,23 @@ func (h *SSEHandler) updateLogCleanupConfig(c *gin.Context) {
293293 if retentionDays < 1 {
294294 c .JSON (http .StatusBadRequest , gin.H {
295295 "success" : false ,
296- "error" : "保留天数必须大于0 " ,
296+ "error" : "Retention days must be greater than 0 " ,
297297 })
298298 return
299299 }
300300
301301 if cleanupInterval < time .Hour {
302302 c .JSON (http .StatusBadRequest , gin.H {
303303 "success" : false ,
304- "error" : "清理间隔不能小于1小时 " ,
304+ "error" : "Cleanup interval cannot be less than 1 hour " ,
305305 })
306306 return
307307 }
308308
309309 if maxRecordsPerDay < 0 {
310310 c .JSON (http .StatusBadRequest , gin.H {
311311 "success" : false ,
312- "error" : "每日最大记录数不能为负数 " ,
312+ "error" : "Max records per day cannot be negative " ,
313313 })
314314 return
315315 }
@@ -319,7 +319,7 @@ func (h *SSEHandler) updateLogCleanupConfig(c *gin.Context) {
319319
320320 c .JSON (http .StatusOK , gin.H {
321321 "success" : true ,
322- "message" : "日志清理配置已更新 " ,
322+ "message" : "Log cleanup configuration updated " ,
323323 "data" : gin.H {
324324 "retentionDays" : retentionDays ,
325325 "cleanupInterval" : cleanupInterval .String (),
@@ -337,7 +337,7 @@ func (h *SSEHandler) HandleTriggerLogCleanup(c *gin.Context) {
337337
338338 c .JSON (http .StatusOK , gin.H {
339339 "success" : true ,
340- "message" : "日志清理任务已启动,将在后台执行 " ,
340+ "message" : "Log cleanup task started, will execute in background " ,
341341 })
342342}
343343
@@ -350,12 +350,12 @@ func (h *SSEHandler) HandleTestSSEEndpointWithVersion(c *gin.Context) {
350350 APIKey string `json:"apiKey"`
351351 }
352352 if err := c .ShouldBindJSON (& req ); err != nil {
353- c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "无效的JSON " })
353+ c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "Invalid JSON " })
354354 return
355355 }
356356
357357 if req .URL == "" || req .APIPath == "" || req .APIKey == "" {
358- c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "缺少必要参数 " })
358+ c .JSON (http .StatusBadRequest , gin.H {"success" : false , "error" : "Missing required parameters " })
359359 return
360360 }
361361
@@ -375,28 +375,28 @@ func (h *SSEHandler) HandleTestSSEEndpointWithVersion(c *gin.Context) {
375375
376376 request , err := http .NewRequestWithContext (ctx , http .MethodGet , sseURL , nil )
377377 if err != nil {
378- h .loggerErrorGin (c , "构建请求失败 " , err )
378+ h .loggerErrorGin (c , "Failed to create request " , err )
379379 return
380380 }
381381 request .Header .Set ("X-API-Key" , req .APIKey )
382382 request .Header .Set ("Accept" , "text/event-stream" )
383383
384384 resp , err := client .Do (request )
385385 if err != nil {
386- h .loggerErrorGin (c , "连接失败 " , err )
386+ h .loggerErrorGin (c , "Connection failed " , err )
387387 return
388388 }
389389 defer resp .Body .Close ()
390390
391391 if resp .StatusCode != http .StatusOK {
392- msg := fmt .Sprintf ("NodePass SSE返回状态码 : %d" , resp .StatusCode )
392+ msg := fmt .Sprintf ("NodePass SSE returned status code : %d" , resp .StatusCode )
393393 h .writeErrorGin (c , msg )
394394 return
395395 }
396396
397397 // 简单验证 Content-Type
398398 if ct := resp .Header .Get ("Content-Type" ); ct != "text/event-stream" && ct != "text/event-stream; charset=utf-8" {
399- h .writeErrorGin (c , "响应Content-Type不是SSE流 " )
399+ h .writeErrorGin (c , "Response Content-Type is not SSE stream " )
400400 return
401401 }
402402
@@ -419,7 +419,7 @@ func (h *SSEHandler) HandleTestSSEEndpointWithVersion(c *gin.Context) {
419419 "connected" : true ,
420420 "version" : "unknown" ,
421421 "canAdd" : false ,
422- "message" : "连接成功但无法获取版本信息,可能是低版本主控( < 1.10.0) " ,
422+ "message" : "Connected successfully but cannot get version info, possibly an older version controller ( < 1.10.0) " ,
423423 })
424424 return
425425 }
@@ -519,7 +519,7 @@ func (h *SSEHandler) HandleNodePassSSEProxy(c *gin.Context) {
519519 c .Header ("Access-Control-Allow-Origin" , "*" )
520520
521521 // 发送连接成功消息
522- fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"connected","message":"NodePass SSE代理连接成功 "}` )
522+ fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"connected","message":"NodePass SSE proxy connected successfully "}` )
523523 c .Writer .Flush ()
524524
525525 // 构造NodePass SSE URL
@@ -543,7 +543,7 @@ func (h *SSEHandler) HandleNodePassSSEProxy(c *gin.Context) {
543543 request , err := http .NewRequestWithContext (ctx , http .MethodGet , sseURL , nil )
544544 if err != nil {
545545 log .Errorf ("[NodePass SSE Proxy] 创建请求失败: %v" , err )
546- fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"创建请求失败 "}` )
546+ fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"Failed to create request "}` )
547547 c .Writer .Flush ()
548548 return
549549 }
@@ -557,15 +557,15 @@ func (h *SSEHandler) HandleNodePassSSEProxy(c *gin.Context) {
557557 resp , err := client .Do (request )
558558 if err != nil {
559559 log .Errorf ("[NodePass SSE Proxy] 连接失败: %v" , err )
560- fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"连接NodePass失败 "}` )
560+ fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"Failed to connect to NodePass "}` )
561561 c .Writer .Flush ()
562562 return
563563 }
564564 defer resp .Body .Close ()
565565
566566 if resp .StatusCode != http .StatusOK {
567567 log .Errorf ("[NodePass SSE Proxy] NodePass返回状态码: %d" , resp .StatusCode )
568- fmt .Fprintf (c .Writer , "data: %s\n \n " , fmt .Sprintf (`{"type":"error","message":"NodePass返回状态码 : %d"}` , resp .StatusCode ))
568+ fmt .Fprintf (c .Writer , "data: %s\n \n " , fmt .Sprintf (`{"type":"error","message":"NodePass returned status code : %d"}` , resp .StatusCode ))
569569 c .Writer .Flush ()
570570 return
571571 }
@@ -574,7 +574,7 @@ func (h *SSEHandler) HandleNodePassSSEProxy(c *gin.Context) {
574574 contentType := resp .Header .Get ("Content-Type" )
575575 if ! strings .Contains (contentType , "text/event-stream" ) {
576576 log .Errorf ("[NodePass SSE Proxy] 无效的Content-Type: %s" , contentType )
577- fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"无效的Content -Type"}` )
577+ fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"Invalid Content -Type"}` )
578578 c .Writer .Flush ()
579579 return
580580 }
@@ -615,7 +615,7 @@ func (h *SSEHandler) HandleNodePassSSEProxy(c *gin.Context) {
615615
616616 if err := scanner .Err (); err != nil {
617617 log .Errorf ("[NodePass SSE Proxy] 读取响应失败: %v" , err )
618- fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"读取响应失败 "}` )
618+ fmt .Fprintf (c .Writer , "data: %s\n \n " , `{"type":"error","message":"Failed to read response "}` )
619619 c .Writer .Flush ()
620620 }
621621
0 commit comments