Skip to content

Commit

Permalink
Graduate PortForwardWebsockets to Beta
Browse files Browse the repository at this point in the history
Kubernetes-commit: 3ae3b4ea551443d8ef695d31bf0c51963fe35ac3
  • Loading branch information
seans3 authored and k8s-publishing-bot committed Jun 15, 2024
1 parent cea1539 commit 6e44692
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/portforward/fallback_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ import (
"k8s.io/klog/v2"
)

var _ httpstream.Dialer = &fallbackDialer{}
var _ httpstream.Dialer = &FallbackDialer{}

// fallbackDialer encapsulates a primary and secondary dialer, including
// FallbackDialer encapsulates a primary and secondary dialer, including
// the boolean function to determine if the primary dialer failed. Implements
// the httpstream.Dialer interface.
type fallbackDialer struct {
type FallbackDialer struct {
primary httpstream.Dialer
secondary httpstream.Dialer
shouldFallback func(error) bool
}

// NewFallbackDialer creates the fallbackDialer with the primary and secondary dialers,
// NewFallbackDialer creates the FallbackDialer with the primary and secondary dialers,
// as well as the boolean function to determine if the primary dialer failed.
func NewFallbackDialer(primary, secondary httpstream.Dialer, shouldFallback func(error) bool) httpstream.Dialer {
return &fallbackDialer{
return &FallbackDialer{
primary: primary,
secondary: secondary,
shouldFallback: shouldFallback,
Expand All @@ -47,7 +47,7 @@ func NewFallbackDialer(primary, secondary httpstream.Dialer, shouldFallback func
// httstream.Connection and the negotiated protocol version accepted. If the initial
// primary dialer fails, this function attempts the secondary dialer. Returns an error
// if one occurs.
func (f *fallbackDialer) Dial(protocols ...string) (httpstream.Connection, string, error) {
func (f *FallbackDialer) Dial(protocols ...string) (httpstream.Connection, string, error) {
conn, version, err := f.primary.Dial(protocols...)
if err != nil && f.shouldFallback(err) {
klog.V(4).Infof("fallback to secondary dialer from primary dialer err: %v", err)
Expand Down

0 comments on commit 6e44692

Please sign in to comment.