Add wildcard hostname support for SSL passthrough
This commit is contained in:
parent
9e6c40664f
commit
e2995f3b90
1 changed files with 6 additions and 0 deletions
|
@ -20,6 +20,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
|
@ -46,10 +47,15 @@ func (p *TCPProxy) Get(host string) *TCPServer {
|
||||||
return p.Default
|
return p.Default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, parentHost, hasParentHost := strings.Cut(host, ".")
|
||||||
|
|
||||||
for _, s := range p.ServerList {
|
for _, s := range p.ServerList {
|
||||||
if s.Hostname == host {
|
if s.Hostname == host {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(s.Hostname, "*.") && hasParentHost && parentHost == s.Hostname[2:] {
|
||||||
|
return s
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p.Default
|
return p.Default
|
||||||
|
|
Loading…
Reference in a new issue