Merge 20c559870ac6a97835b5d45255206e1d04e98954 into c6f9d8d4031f6fba9a39fe9e1a79907ceedf0f5f

This commit is contained in:
fatedier 2024-07-08 09:54:45 +00:00 committed by GitHub
commit 7a08856d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,7 @@
### Features ### Features
* Added a new plugin "http2http" which allows forwarding HTTP requests to another HTTP server, supporting options like local address binding, host header rewrite, and custom request headers. * Added a new plugin "http2http" which allows forwarding HTTP requests to another HTTP server, supporting options like local address binding, host header rewrite, and custom request headers.
### Changes
* Disable HTTP/2 by default for the plugins https2http and https2https, and make it configurable.

View File

@ -108,6 +108,7 @@ type HTTPS2HTTPPluginOptions struct {
LocalAddr string `json:"localAddr,omitempty"` LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"` HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"` RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
EnableHTTP2 bool `json:"enableHTTP2,omitempty"`
CrtPath string `json:"crtPath,omitempty"` CrtPath string `json:"crtPath,omitempty"`
KeyPath string `json:"keyPath,omitempty"` KeyPath string `json:"keyPath,omitempty"`
} }
@ -117,6 +118,7 @@ type HTTPS2HTTPSPluginOptions struct {
LocalAddr string `json:"localAddr,omitempty"` LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"` HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"` RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
EnableHTTP2 bool `json:"enableHTTP2,omitempty"`
CrtPath string `json:"crtPath,omitempty"` CrtPath string `json:"crtPath,omitempty"`
KeyPath string `json:"keyPath,omitempty"` KeyPath string `json:"keyPath,omitempty"`
} }

View File

@ -91,6 +91,9 @@ func NewHTTPS2HTTPPlugin(options v1.ClientPluginOptions) (Plugin, error) {
ReadHeaderTimeout: 60 * time.Second, ReadHeaderTimeout: 60 * time.Second,
TLSConfig: tlsConfig, TLSConfig: tlsConfig,
} }
if !opts.EnableHTTP2 {
p.s.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
}
go func() { go func() {
_ = p.s.ServeTLS(listener, "", "") _ = p.s.ServeTLS(listener, "", "")

View File

@ -97,6 +97,9 @@ func NewHTTPS2HTTPSPlugin(options v1.ClientPluginOptions) (Plugin, error) {
ReadHeaderTimeout: 60 * time.Second, ReadHeaderTimeout: 60 * time.Second,
TLSConfig: tlsConfig, TLSConfig: tlsConfig,
} }
if !opts.EnableHTTP2 {
p.s.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
}
go func() { go func() {
_ = p.s.ServeTLS(listener, "", "") _ = p.s.ServeTLS(listener, "", "")

View File

@ -14,7 +14,7 @@
package version package version
var version = "0.58.1" var version = "0.59.0"
func Full() string { func Full() string {
return version return version