Skip to content

Commit 23f2a04

Browse files
committed
TUN-3562: Fix panic when using bastion mode ingress rule
1 parent 1805261 commit 23f2a04

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

ingress/origin_service.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ func (o *localService) Dial(reqURL *url.URL, headers http.Header) (*gws.Conn, *h
8484
return d.Dial(reqURL.String(), headers)
8585
}
8686

87-
func (o *localService) address() string {
88-
return o.URL.String()
89-
}
90-
9187
func (o *localService) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error {
9288
transport, err := newHTTPTransport(o, cfg, log)
9389
if err != nil {
@@ -151,7 +147,14 @@ func (o *localService) startProxy(staticHost string, wg *sync.WaitGroup, log log
151147
}
152148

153149
func (o *localService) String() string {
154-
return o.address()
150+
if o.isBastion() {
151+
return "Bastion"
152+
}
153+
return o.URL.String()
154+
}
155+
156+
func (o *localService) isBastion() bool {
157+
return o.URL == nil
155158
}
156159

157160
func (o *localService) RoundTrip(req *http.Request) (*http.Response, error) {
@@ -163,6 +166,10 @@ func (o *localService) RoundTrip(req *http.Request) (*http.Response, error) {
163166

164167
func (o *localService) staticHost() string {
165168

169+
if o.URL == nil {
170+
return ""
171+
}
172+
166173
addPortIfMissing := func(uri *url.URL, port int) string {
167174
if uri.Port() != "" {
168175
return uri.Host

0 commit comments

Comments
 (0)