feat: update protocol version constants and references to support new SDK and discovery versions

Kim committed Apr 13, 2026 at 17:05 UTC 534e47dc2fd61d6b548be3be985afecc8b2c53fb
6 files changed +11 -10
portal/api_server.go
+1 -1
@@ -206,7 +206,7 @@ func (s *Server) handleDomain(w http.ResponseWriter, r *http.Request) {
206 }
207
208 utils.WriteAPIData(w, http.StatusOK, types.DomainResponse{
209 - ProtocolVersion: types.ProtocolVersion,
209 + ProtocolVersion: types.SDKVersion,
210 ReleaseVersion: types.ReleaseVersion,
211 })
212 }
portal/discovery/relayset.go
+3 -3
@@ -159,7 +159,7 @@ func (s *RelaySet) ServeDiscovery(w http.ResponseWriter, r *http.Request, local
159 }
160
161 utils.WriteAPIData(w, http.StatusOK, types.DiscoveryResponse{
162 - ProtocolVersion: types.ProtocolVersion,
162 + ProtocolVersion: types.DiscoveryVersion,
163 GeneratedAt: time.Now().UTC(),
164 Relays: relays,
165 })
@@ -198,8 +198,8 @@ func (s *RelaySet) ApplyRelayDiscoveryResponse(targetURL string, resp types.Disc
198 now = now.UTC()
199 }
200
201 - if resp.ProtocolVersion != types.ProtocolVersion {
202 - return false, fmt.Errorf("relay protocol version mismatch: relay=%q client=%q", resp.ProtocolVersion, types.ProtocolVersion)
201 + if resp.ProtocolVersion != types.DiscoveryVersion {
202 + return false, fmt.Errorf("relay discovery protocol version mismatch: relay=%q client=%q", resp.ProtocolVersion, types.DiscoveryVersion)
203 }
204 authoritative := targetURL != ""
205
portal/discovery/relayset_test.go
+1 -1
@@ -15,7 +15,7 @@ func TestApplyRelayDiscoveryResponsePreservesBootstrapFlag(t *testing.T) {
15
16 desc := mustPolicyRelayDescriptor(t, "relay-a", "https://relay-a.example")
17 if _, err := set.ApplyRelayDiscoveryResponse(desc.APIHTTPSAddr, types.DiscoveryResponse{
18 - ProtocolVersion: types.ProtocolVersion,
18 + ProtocolVersion: types.DiscoveryVersion,
19 Relays: []types.RelayDescriptor{desc},
20 }, time.Now().UTC()); err != nil {
21 t.Fatalf("ApplyRelayDiscoveryResponse() error = %v", err)
portal/server_test.go
+2 -2
@@ -205,8 +205,8 @@ func TestServerStartDomainReportsCompatibilityInfo(t *testing.T) {
205 if !envelope.OK {
206 t.Fatalf("GET /sdk/domain response = %+v, want ok=true", envelope)
207 }
208 - if envelope.Data.ProtocolVersion != types.ProtocolVersion {
209 - t.Fatalf("DomainResponse.ProtocolVersion = %q, want %q", envelope.Data.ProtocolVersion, types.ProtocolVersion)
208 + if envelope.Data.ProtocolVersion != types.SDKVersion {
209 + t.Fatalf("DomainResponse.ProtocolVersion = %q, want %q", envelope.Data.ProtocolVersion, types.SDKVersion)
210 }
211 if envelope.Data.ReleaseVersion != types.ReleaseVersion {
212 t.Fatalf("DomainResponse.ReleaseVersion = %q, want %q", envelope.Data.ReleaseVersion, types.ReleaseVersion)
sdk/api_client.go
+2 -2
@@ -232,8 +232,8 @@ func (a *apiClient) ensureCompatible(ctx context.Context, httpClient *http.Clien
232 return fmt.Errorf("%w: %w", errRelayIncompatible, err)
233 }
234 protocolVersion := strings.TrimSpace(resp.ProtocolVersion)
235 - if protocolVersion != types.ProtocolVersion {
236 - return fmt.Errorf("%w: relay protocol version mismatch: relay=%q client=%q", errRelayIncompatible, protocolVersion, types.ProtocolVersion)
235 + if protocolVersion != types.SDKVersion {
236 + return fmt.Errorf("%w: relay sdk protocol version mismatch: relay=%q client=%q", errRelayIncompatible, protocolVersion, types.SDKVersion)
237 }
238 return nil
239 }
types/types.go
+2 -1
@@ -2,7 +2,8 @@ package types
2
3 const (
4 ReleaseVersion = "v2.1.4"
5 - ProtocolVersion = "5"
5 + SDKVersion = "5"
6 + DiscoveryVersion = "6"
7 PortalRelayRegistryURL = "https://raw.githubusercontent.com/gosuda/portal-tunnel/main/registry.json"
8
9 HeaderAccessToken = "X-Portal-Access-Token"