TUN-6185: Fix tcpOverWSOriginService not using original scheme for String representation

This commit is contained in:
João Oliveirinha 2022-05-06 18:47:03 +01:00
parent 99d4e48656
commit fa2234d639
1 changed files with 9 additions and 2 deletions

View File

@ -109,6 +109,7 @@ func (o rawTCPService) MarshalJSON() ([]byte, error) {
// tcpOverWSService models TCP origins serving eyeballs connecting over websocket, such as // tcpOverWSService models TCP origins serving eyeballs connecting over websocket, such as
// cloudflared access commands. // cloudflared access commands.
type tcpOverWSService struct { type tcpOverWSService struct {
scheme string
dest string dest string
isBastion bool isBastion bool
streamHandler streamHandlerFunc streamHandler streamHandlerFunc
@ -130,7 +131,8 @@ func newTCPOverWSService(url *url.URL) *tcpOverWSService {
addPortIfMissing(url, 7864) // just a random port since there isn't a default in this case addPortIfMissing(url, 7864) // just a random port since there isn't a default in this case
} }
return &tcpOverWSService{ return &tcpOverWSService{
dest: url.Host, scheme: url.Scheme,
dest: url.Host,
} }
} }
@ -160,7 +162,12 @@ func (o *tcpOverWSService) String() string {
if o.isBastion { if o.isBastion {
return ServiceBastion return ServiceBastion
} }
return o.dest
if o.scheme != "" {
return fmt.Sprintf("%s://%s", o.scheme, o.dest)
} else {
return o.dest
}
} }
func (o *tcpOverWSService) start(log *zerolog.Logger, _ <-chan struct{}, cfg OriginRequestConfig) error { func (o *tcpOverWSService) start(log *zerolog.Logger, _ <-chan struct{}, cfg OriginRequestConfig) error {