Fix error checking

Former-commit-id: 231808476b
This commit is contained in:
Owen
2026-01-13 11:51:51 -08:00
parent b76259bc31
commit 9c0b4fcd5f

View File

@@ -5,6 +5,7 @@ import (
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
@@ -414,7 +415,8 @@ func (c *Client) connectWithRetry() {
err := c.establishConnection() err := c.establishConnection()
if err != nil { if err != nil {
// Check if this is an auth error (401/403) // Check if this is an auth error (401/403)
if authErr, ok := err.(*AuthError); ok { var authErr *AuthError
if errors.As(err, &authErr) {
logger.Error("Authentication failed: %v. Terminating tunnel and retrying...", authErr) logger.Error("Authentication failed: %v. Terminating tunnel and retrying...", authErr)
// Trigger auth error callback if set (this should terminate the tunnel) // Trigger auth error callback if set (this should terminate the tunnel)
if c.onAuthError != nil { if c.onAuthError != nil {