tunnel: remove portal dependency
Kim committed
Mar 6, 2026 at 12:54 UTC
410d8c1e8755a5a40aeb373d3a5cbf9f686c8602
1 file changed
+16
-2
cmd/portal-tunnel/main.go
+16
-2
@@ -7,6 +7,7 @@ import (
7
"fmt"
8
"io"
9
"net"
10
+ "net/url"
11
"os"
12
"os/signal"
13
"strings"
@@ -17,7 +18,6 @@ import (
18
"github.com/rs/zerolog"
19
"github.com/rs/zerolog/log"
20
20
- "gosuda.org/portal/portal"
21
"gosuda.org/portal/sdk"
22
)
23
@@ -173,7 +173,21 @@ loop:
173
}
174
175
func normalizeRelayURLsForReverseConnect(relayURLs []string) (string, error) {
176
- return portal.NormalizeRelayURL(relayURLs[0])
176
+ raw := relayURLs[0]
177
+ u, err := url.Parse(strings.TrimSpace(raw))
178
+ if err != nil {
179
+ return "", fmt.Errorf("parse relay url: %w", err)
180
+ }
181
+ if !strings.EqualFold(u.Scheme, "https") {
182
+ return "", fmt.Errorf("relay url must use https: %q", raw)
183
+ }
184
+ if u.Host == "" {
185
+ return "", fmt.Errorf("relay url host is empty: %q", raw)
186
+ }
187
+ u.Path = strings.TrimRight(u.Path, "/")
188
+ u.RawQuery = ""
189
+ u.Fragment = ""
190
+ return u.String(), nil
191
}
192
193
var bufferPool = sync.Pool{