mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
Add SOCKS5 and HTTP/HTTPS proxy support
- Updated `GetAuthenticatedClient` to handle proxy configuration via `proxy-url`. - Extended `Config` to include `proxy-url` property. - Adjusted error handling and removed unused JSON error response logic for API handlers. - Updated documentation and configuration examples to reflect new proxy settings.
This commit is contained in:
@@ -429,12 +429,15 @@ func (h *APIHandlers) handleNonStreamingResponse(c *gin.Context, rawJson []byte)
|
||||
}
|
||||
case err, okError := <-errChan:
|
||||
if okError {
|
||||
c.JSON(http.StatusInternalServerError, ErrorResponse{
|
||||
Error: ErrorDetail{
|
||||
Message: err.Error(),
|
||||
Type: "server_error",
|
||||
},
|
||||
})
|
||||
c.Status(http.StatusInternalServerError)
|
||||
_, _ = fmt.Fprint(c.Writer, err.Error())
|
||||
flusher.Flush()
|
||||
// c.JSON(http.StatusInternalServerError, ErrorResponse{
|
||||
// Error: ErrorDetail{
|
||||
// Message: err.Error(),
|
||||
// Type: "server_error",
|
||||
// },
|
||||
// })
|
||||
cliCancel()
|
||||
return
|
||||
}
|
||||
@@ -523,12 +526,15 @@ func (h *APIHandlers) handleStreamingResponse(c *gin.Context, rawJson []byte) {
|
||||
}
|
||||
case err, okError := <-errChan:
|
||||
if okError {
|
||||
c.JSON(http.StatusInternalServerError, ErrorResponse{
|
||||
Error: ErrorDetail{
|
||||
Message: err.Error(),
|
||||
Type: "server_error",
|
||||
},
|
||||
})
|
||||
c.Status(http.StatusInternalServerError)
|
||||
_, _ = fmt.Fprint(c.Writer, err.Error())
|
||||
flusher.Flush()
|
||||
// c.JSON(http.StatusInternalServerError, ErrorResponse{
|
||||
// Error: ErrorDetail{
|
||||
// Message: err.Error(),
|
||||
// Type: "server_error",
|
||||
// },
|
||||
// })
|
||||
cliCancel()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user