add auther config

This commit is contained in:
ginuerzh
2022-02-12 00:33:20 +08:00
parent c1bf501734
commit a8a6bbc3a3
37 changed files with 261 additions and 183 deletions

View File

@ -24,7 +24,6 @@ func init() {
}
type http2Connector struct {
user *url.Userinfo
md metadata
options connector.Options
}
@ -36,7 +35,6 @@ func NewConnector(opts ...connector.Option) connector.Connector {
}
return &http2Connector{
user: options.User,
options: options,
}
}
@ -76,7 +74,7 @@ func (c *http2Connector) Connect(ctx context.Context, conn net.Conn, network, ad
req.Header.Set("User-Agent", c.md.UserAgent)
}
if user := c.user; user != nil {
if user := c.options.Auth; user != nil {
u := user.Username()
p, _ := user.Password()
req.Header.Set("Proxy-Authorization",