🎨 format code

pull/548/head
微凉 2021-11-09 16:03:04 +08:00
parent ac8f5d5737
commit 1542878d66
1 changed files with 22 additions and 8 deletions

View File

@ -55,6 +55,20 @@ func Proxy(ctx *fiber.Ctx) error {
return ctx.SendFile(link)
} else {
driver.Proxy(ctx)
//ctx.Response().ImmediateHeaderFlush = true
//var ProxyNetHttp = fasthttpadaptor.NewFastHTTPHandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// target, _ := url.Parse(link)
// protocol := "https://"
// if strings.HasPrefix(link, "http://") {
// protocol = "http://"
// }
// targetHost, _ := url.Parse(fmt.Sprintf("%s%s", protocol, target.Host))
// proxy := httputil.NewSingleHostReverseProxy(targetHost)
// r.URL = target
// r.Host = target.Host
// proxy.ServeHTTP(w, r)
//})
//ProxyNetHttp(ctx.Context())
if err := proxy.Do(ctx, link); err != nil {
log.Errorf("proxy error: %s", err)
return ErrorResp(ctx,err,500)