Skip to content

Commit e4fa450

Browse files
committed
bump portal version
1 parent 5d59b91 commit e4fa450

33 files changed

Lines changed: 405 additions & 152 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
BIN_DIR := $(CURDIR)/bin
44
BIN := $(BIN_DIR)/portal-tunnel$(if $(filter Windows_NT,$(OS)),.exe,)
5-
PKG := github.com/gosuda/portal/v2/cmd/portal-tunnel
5+
PKG := github.com/gosuda/portal-tunnel/v2/cmd/portal-tunnel
66
# portal-tunnel is pinned to v2.1.1 through the root go.mod require/replace.
77
GOINSTALL := $(if $(filter Windows_NT,$(OS)),set "GOBIN=$(BIN_DIR)" &&,GOBIN="$(BIN_DIR)") go install $(PKG)
88
# Unified relay configuration: prefer RELAY, then RELAY_URL, else default

ceversi/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import (
1212
"strings"
1313
"syscall"
1414

15-
"github.com/gosuda/portal/v2/sdk"
16-
"github.com/gosuda/portal/v2/types"
17-
"github.com/gosuda/portal/v2/utils"
15+
"github.com/gosuda/portal-toys/internal/portalapp"
16+
"github.com/gosuda/portal-tunnel/v2/sdk"
17+
"github.com/gosuda/portal-tunnel/v2/types"
18+
"github.com/gosuda/portal-tunnel/v2/utils"
1819
"github.com/rs/zerolog/log"
1920
"github.com/spf13/cobra"
2021
)
@@ -43,8 +44,8 @@ var rootCmd = &cobra.Command{
4344
func init() {
4445
flags := rootCmd.PersistentFlags()
4546
flags.StringSliceVar(&flagServerURLs, "server-url", strings.Split(os.Getenv("RELAY"), ","), "relay site URL(s); repeat or comma-separated (from env RELAY/RELAY_URL if set)")
46-
flags.BoolVar(&flagDiscovery, "discovery", utils.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
47-
flags.BoolVar(&flagBanMITM, "ban-mitm", utils.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
47+
flags.BoolVar(&flagDiscovery, "discovery", portalapp.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
48+
flags.BoolVar(&flagBanMITM, "ban-mitm", portalapp.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
4849
flags.IntVar(&flagPort, "port", 31744, "optional local HTTP port (negative to disable)")
4950
flags.IntVar(&flagBackendPort, "backend-port", 31745, "C server port")
5051
flags.StringVar(&flagName, "name", "ceversi", "backend display name")
@@ -89,7 +90,7 @@ func runCeversi(cmd *cobra.Command, args []string) error {
8990
mux := http.NewServeMux()
9091
mux.Handle("/", proxy)
9192

92-
exposure, err := sdk.Expose(ctx, sdk.ExposeConfig{
93+
exposure, err := portalapp.Expose(ctx, sdk.ExposeConfig{
9394
RelayURLs: append([]string(nil), flagServerURLs...),
9495
BanMITM: flagBanMITM,
9596
Discovery: flagDiscovery,

chatter-bbs/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import (
77
"os/signal"
88
"syscall"
99

10-
"github.com/gosuda/portal/v2/sdk"
11-
"github.com/gosuda/portal/v2/types"
12-
"github.com/gosuda/portal/v2/utils"
10+
"github.com/gosuda/portal-toys/internal/portalapp"
11+
"github.com/gosuda/portal-tunnel/v2/sdk"
12+
"github.com/gosuda/portal-tunnel/v2/types"
13+
"github.com/gosuda/portal-tunnel/v2/utils"
1314
"github.com/rs/zerolog/log"
1415
"github.com/spf13/cobra"
1516
)
@@ -36,8 +37,8 @@ var (
3637
func init() {
3738
flags := rootCmd.PersistentFlags()
3839
flags.StringVar(&flagServerURLs, "server-url", os.Getenv("RELAY"), "relay base URL(s); repeat or comma-separated (from env RELAY/RELAY_URL if set)")
39-
flags.BoolVar(&flagDiscovery, "discovery", utils.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
40-
flags.BoolVar(&flagBanMITM, "ban-mitm", utils.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
40+
flags.BoolVar(&flagDiscovery, "discovery", portalapp.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
41+
flags.BoolVar(&flagBanMITM, "ban-mitm", portalapp.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
4142
flags.IntVar(&flagPort, "port", -1, "optional local HTTP port (negative to disable)")
4243
flags.StringVar(&flagName, "name", "chatter-bbs", "backend display name")
4344
flags.StringVar(&flagIdentityPath, "identity-path", "identity.json", "optional path to load/save the portal identity")
@@ -67,7 +68,7 @@ func runChatter(cmd *cobra.Command, args []string) error {
6768
}
6869
handler := NewHandler(displayAddr, flagName, func() string { return "Connected" })
6970

70-
exposure, err := sdk.Expose(ctx, sdk.ExposeConfig{
71+
exposure, err := portalapp.Expose(ctx, sdk.ExposeConfig{
7172
RelayURLs: utils.SplitCSV(flagServerURLs),
7273
BanMITM: flagBanMITM,
7374
Discovery: flagDiscovery,

distributed-web-server/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ module distributed-web-server
22

33
go 1.26.1
44

5-
replace github.com/gosuda/portal/v2 => github.com/gosuda/portal-tunnel/v2 v2.1.1
5+
replace github.com/gosuda/portal-tunnel/v2 => github.com/gosuda/portal-tunnel/v2 v2.1.1
66

77
require (
88
github.com/gabriel-vasile/mimetype v1.4.13
9-
github.com/gosuda/portal/v2 v2.1.1
9+
github.com/gosuda/portal-tunnel/v2 v2.1.1
1010
github.com/joho/godotenv v1.5.1
1111
github.com/microcosm-cc/bluemonday v1.0.27
1212
github.com/rs/zerolog v1.35.0

distributed-web-server/manager/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"time"
2222

2323
"github.com/gabriel-vasile/mimetype"
24-
"github.com/gosuda/portal/v2/sdk"
25-
"github.com/gosuda/portal/v2/types"
26-
"github.com/gosuda/portal/v2/utils"
24+
"github.com/gosuda/portal-tunnel/v2/sdk"
25+
"github.com/gosuda/portal-tunnel/v2/types"
26+
"github.com/gosuda/portal-tunnel/v2/utils"
2727
"github.com/joho/godotenv"
2828
"github.com/microcosm-cc/bluemonday"
2929
"github.com/rs/zerolog"

doom/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import (
99
"os/signal"
1010
"syscall"
1111

12-
"github.com/gosuda/portal/v2/sdk"
13-
"github.com/gosuda/portal/v2/types"
14-
"github.com/gosuda/portal/v2/utils"
12+
"github.com/gosuda/portal-toys/internal/portalapp"
13+
"github.com/gosuda/portal-tunnel/v2/sdk"
14+
"github.com/gosuda/portal-tunnel/v2/types"
15+
"github.com/gosuda/portal-tunnel/v2/utils"
1516
"github.com/rs/zerolog/log"
1617
"github.com/spf13/cobra"
1718
)
@@ -38,8 +39,8 @@ var (
3839
func init() {
3940
flags := rootCmd.PersistentFlags()
4041
flags.StringVar(&flagServerURLs, "server-url", os.Getenv("RELAY"), "relayserver base URL(s); repeat or comma-separated (from env RELAY/RELAY_URL if set)")
41-
flags.BoolVar(&flagDiscovery, "discovery", utils.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
42-
flags.BoolVar(&flagBanMITM, "ban-mitm", utils.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
42+
flags.BoolVar(&flagDiscovery, "discovery", portalapp.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
43+
flags.BoolVar(&flagBanMITM, "ban-mitm", portalapp.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
4344
flags.IntVar(&flagPort, "port", -1, "optional local HTTP port (negative to disable)")
4445
flags.StringVar(&flagName, "name", "doom", "backend display name")
4546
flags.StringVar(&flagIdentityPath, "identity-path", "identity.json", "optional path to load/save the portal identity")
@@ -67,7 +68,7 @@ func runDoom(cmd *cobra.Command, args []string) error {
6768
mux.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) })
6869
mux.Handle("/", withStaticHeaders(http.FileServer(http.FS(staticFS))))
6970

70-
exposure, err := sdk.Expose(ctx, sdk.ExposeConfig{
71+
exposure, err := portalapp.Expose(ctx, sdk.ExposeConfig{
7172
RelayURLs: utils.SplitCSV(flagServerURLs),
7273
BanMITM: flagBanMITM,
7374
Discovery: flagDiscovery,

emulator-js/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import (
99
"os/signal"
1010
"syscall"
1111

12-
"github.com/gosuda/portal/v2/sdk"
13-
"github.com/gosuda/portal/v2/types"
14-
"github.com/gosuda/portal/v2/utils"
12+
"github.com/gosuda/portal-toys/internal/portalapp"
13+
"github.com/gosuda/portal-tunnel/v2/sdk"
14+
"github.com/gosuda/portal-tunnel/v2/types"
15+
"github.com/gosuda/portal-tunnel/v2/utils"
1516
"github.com/rs/zerolog/log"
1617
"github.com/spf13/cobra"
1718
)
@@ -38,8 +39,8 @@ var (
3839
func init() {
3940
flags := rootCmd.PersistentFlags()
4041
flags.StringVar(&flagServerURLs, "server-url", os.Getenv("RELAY"), "relayserver base URL(s); repeat or comma-separated (from env RELAY/RELAY_URL if set)")
41-
flags.BoolVar(&flagDiscovery, "discovery", utils.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
42-
flags.BoolVar(&flagBanMITM, "ban-mitm", utils.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
42+
flags.BoolVar(&flagDiscovery, "discovery", portalapp.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
43+
flags.BoolVar(&flagBanMITM, "ban-mitm", portalapp.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
4344
flags.IntVar(&flagPort, "port", -1, "optional local HTTP port (negative to disable)")
4445
flags.StringVar(&flagName, "name", "emulator-js", "backend display name")
4546
flags.StringVar(&flagIdentityPath, "identity-path", "identity.json", "optional path to load/save the portal identity")
@@ -74,7 +75,7 @@ func runEmulator(cmd *cobra.Command, args []string) error {
7475
mux.Handle("/data/", withStaticHeaders(http.FileServer(http.FS(emulatorAssets))))
7576
mux.Handle("/docs/", withStaticHeaders(http.FileServer(http.FS(emulatorAssets))))
7677

77-
exposure, err := sdk.Expose(ctx, sdk.ExposeConfig{
78+
exposure, err := portalapp.Expose(ctx, sdk.ExposeConfig{
7879
RelayURLs: utils.SplitCSV(flagServerURLs),
7980
BanMITM: flagBanMITM,
8081
Discovery: flagDiscovery,

ffmpeg-converter/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import (
1010
"os/signal"
1111
"syscall"
1212

13-
"github.com/gosuda/portal/v2/sdk"
14-
"github.com/gosuda/portal/v2/types"
15-
"github.com/gosuda/portal/v2/utils"
13+
"github.com/gosuda/portal-toys/internal/portalapp"
14+
"github.com/gosuda/portal-tunnel/v2/sdk"
15+
"github.com/gosuda/portal-tunnel/v2/types"
16+
"github.com/gosuda/portal-tunnel/v2/utils"
1617
"github.com/rs/zerolog/log"
1718
"github.com/spf13/cobra"
1819
)
@@ -41,8 +42,8 @@ var (
4142
func init() {
4243
f := rootCmd.PersistentFlags()
4344
f.StringVar(&flagServerURLs, "server-url", os.Getenv("RELAY"), "relay base URL(s); repeat or comma-separated (from env RELAY/RELAY_URL if set)")
44-
f.BoolVar(&flagDiscovery, "discovery", utils.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
45-
f.BoolVar(&flagBanMITM, "ban-mitm", utils.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
45+
f.BoolVar(&flagDiscovery, "discovery", portalapp.ResolveBoolEnv(true, "DISCOVERY", "DEFAULT_RELAYS"), "include registry relays and enable relay discovery [env: DISCOVERY, DEFAULT_RELAYS]")
46+
f.BoolVar(&flagBanMITM, "ban-mitm", portalapp.ResolveBoolEnv(false, "BAN_MITM"), "ban relay when MITM self-probe detects TLS termination [env: BAN_MITM]")
4647
f.IntVar(&flagPort, "port", -1, "optional local HTTP port")
4748
f.StringVar(&flagName, "name", "ffmpeg-converter", "display name for relay lease")
4849
f.StringVar(&flagIdentityPath, "identity-path", "identity.json", "optional path to load/save the portal identity")
@@ -81,7 +82,7 @@ func run(cmd *cobra.Command, args []string) error {
8182
mux.HandleFunc("/convert", handleConvert)
8283
mux.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) })
8384

84-
exposure, err := sdk.Expose(ctx, sdk.ExposeConfig{
85+
exposure, err := portalapp.Expose(ctx, sdk.ExposeConfig{
8586
RelayURLs: utils.SplitCSV(flagServerURLs),
8687
BanMITM: flagBanMITM,
8788
Discovery: flagDiscovery,

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ module github.com/gosuda/portal-toys
22

33
go 1.26.1
44

5-
replace github.com/gosuda/portal/v2 => github.com/gosuda/portal-tunnel/v2 v2.1.1
6-
75
require (
86
github.com/cockroachdb/pebble/v2 v2.1.4
97
github.com/go-chi/chi/v5 v5.2.3
108
github.com/gorilla/websocket v1.5.3
11-
github.com/gosuda/portal/v2 v2.1.1
9+
github.com/gosuda/portal-tunnel/v2 v2.1.3
1210
github.com/joho/godotenv v1.5.1
1311
github.com/libp2p/go-libp2p v0.48.0
1412
github.com/multiformats/go-multiaddr v0.16.0
@@ -22,6 +20,7 @@ require (
2220
github.com/DataDog/zstd v1.5.7 // indirect
2321
github.com/RaduBerinde/axisds v0.1.0 // indirect
2422
github.com/RaduBerinde/btreemap v0.0.0-20250419174037-3d62b7205d54 // indirect
23+
github.com/andybalholm/brotli v1.2.1 // indirect
2524
github.com/benbjohnson/clock v1.3.5 // indirect
2625
github.com/beorn7/perks v1.0.1 // indirect
2726
github.com/cespare/xxhash/v2 v2.3.0 // indirect

go.sum

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ github.com/RaduBerinde/btreemap v0.0.0-20250419174037-3d62b7205d54 h1:bsU8Tzxr/P
1212
github.com/RaduBerinde/btreemap v0.0.0-20250419174037-3d62b7205d54/go.mod h1:0tr7FllbE9gJkHq7CVeeDDFAFKQVy5RnCSSNBOvdqbc=
1313
github.com/aclements/go-perfevent v0.0.0-20240301234650-f7843625020f h1:JjxwchlOepwsUWcQwD2mLUAGE9aCp0/ehy6yCHFBOvo=
1414
github.com/aclements/go-perfevent v0.0.0-20240301234650-f7843625020f/go.mod h1:tMDTce/yLLN/SK8gMOxQfnyeMeCg8KGzp0D1cbECEeo=
15+
github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eTWro=
16+
github.com/andybalholm/brotli v1.2.1/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
1517
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
1618
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
1719
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -78,8 +80,8 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
7880
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
7981
github.com/gosuda/keyless_tls v0.0.1-0.20260304212324-7733f8366abc h1:aS9LQ35x6EtrGKCmOWRj6Y9aQ2l5hP8dVva4oxB9VEg=
8082
github.com/gosuda/keyless_tls v0.0.1-0.20260304212324-7733f8366abc/go.mod h1:BOhUZgiAAQzxKO3QcC4fCXgd/+lqxgIu1OyIYTqtta8=
81-
github.com/gosuda/portal-tunnel/v2 v2.1.1 h1:aUGE+e668cyYQpHTE+qf8JLo1nT7RrYIkuYXGs+j9Oo=
82-
github.com/gosuda/portal-tunnel/v2 v2.1.1/go.mod h1:dFmGGY70+N7kmQTq8yoIiRVrbGpQSTBsRvcs+J1XSIs=
83+
github.com/gosuda/portal-tunnel/v2 v2.1.3 h1:FhhMbXhNu+ynAGajk0gVzJrmlLlP48dJBjNbgcQdL0I=
84+
github.com/gosuda/portal-tunnel/v2 v2.1.3/go.mod h1:vSMbwtO5nQvI2dzRXk4b2kdfemnwOPYvBCmOEaf+Os8=
8385
github.com/holiman/uint256 v1.3.2 h1:a9EgMPSC1AAaj1SZL5zIQD3WbwTuHrMGOerLjGmM/TA=
8486
github.com/holiman/uint256 v1.3.2/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
8587
github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
@@ -258,6 +260,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
258260
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
259261
github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
260262
github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
263+
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
264+
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
261265
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
262266
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
263267
go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4=

0 commit comments

Comments
 (0)