Skip to content

Commit

Permalink
feat: add http_proxy config for fiber
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Jul 9, 2024
1 parent 5847034 commit e5ec837
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var Config struct {
ProxyEmail string `env:"PROXY_EMAIL"`
HostRewrite string `env:"HOST_REWRITE"`
Token string `env:"TOKEN"`
HttpProxyUrl string `env:"HTTP_PROXY_URL"`
}

var Token struct {
Expand Down
2 changes: 2 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/gofiber/fiber/v2"
"github.com/valyala/fasthttp/fasthttpproxy"
"time"
)

Expand Down Expand Up @@ -45,5 +46,6 @@ func LskyBaseAgent(agent *fiber.Agent, method string, path string) *fiber.Agent
req := agent.Request()
req.Header.SetMethod(method)
req.SetRequestURI(Config.ProxyUrl + path)
agent.Dial = fasthttpproxy.FasthttpHTTPDialer(Config.HttpProxyUrl)
return agent
}

0 comments on commit e5ec837

Please sign in to comment.