add h2c/http2 support with WithoutCmux option

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2023-09-16 16:21:51 +02:00
parent f455c9994c
commit c0c19683cf
3 changed files with 99 additions and 30 deletions

View File

@ -334,6 +334,13 @@ func WithReactUI(fs fs.FS, subpath string) Option {
}
}
// WithoutCmux disables the use of cmux for http support to instead use grpc.Server.ServeHTTP method when http support is enabled
func WithoutCmux() Option {
return func(o *options) {
o.withoutCmux = true
}
}
type options struct {
ctx context.Context
name string
@ -381,6 +388,7 @@ type options struct {
error error
gatewayPrefix string
withoutCmux bool
}
func (o *options) Name() string {
@ -499,6 +507,10 @@ func (o *options) GatewayOpts() []runtime.ServeMuxOption {
return o.gatewayOpts
}
func (o *options) WithoutCmux() bool {
return o.withoutCmux
}
func (o *options) parseTLSConfig() error {
if o.tlsConfig != nil {
return nil