add proxy protocol support

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2023-07-10 16:01:40 +02:00
parent c0c19683cf
commit 37b09f9f54
4 changed files with 51 additions and 3 deletions

View File

@ -67,6 +67,9 @@ type Options interface {
// TODO(adphi): metrics + tracing
WithoutCmux() bool
ProxyProtocol() bool
Default()
}
@ -341,6 +344,13 @@ func WithoutCmux() Option {
}
}
func WithProxyProtocol(addrs ...string) Option {
return func(o *options) {
o.proxyProtocol = true
o.proxyProtocolAddrs = addrs
}
}
type options struct {
ctx context.Context
name string
@ -386,9 +396,11 @@ type options struct {
reactUISubPath string
hasReactUI bool
error error
gatewayPrefix string
withoutCmux bool
error error
gatewayPrefix string
withoutCmux bool
proxyProtocol bool
proxyProtocolAddrs []string
}
func (o *options) Name() string {
@ -511,6 +523,10 @@ func (o *options) WithoutCmux() bool {
return o.withoutCmux
}
func (o *options) ProxyProtocol() bool {
return o.proxyProtocol
}
func (o *options) parseTLSConfig() error {
if o.tlsConfig != nil {
return nil