mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: check agent API version on connection (#11696)
fixes #10531 Adds a check for `version` on connection to the Agent API websocket endpoint. This is primarily for future-proofing, so that up-level agents get a sensible error if they connect to a back-level Coderd. It also refactors the location of the `CurrentVersion` variables, to be part of the `proto` packages, since the versions refer to the APIs defined therein.
This commit is contained in:
@@ -460,7 +460,7 @@ func TestRemoteCoordination(t *testing.T) {
|
||||
|
||||
serveErr := make(chan error, 1)
|
||||
go func() {
|
||||
err := svc.ServeClient(ctx, tailnet.CurrentVersion.String(), sC, clientID, agentID)
|
||||
err := svc.ServeClient(ctx, proto.CurrentVersion.String(), sC, clientID, agentID)
|
||||
serveErr <- err
|
||||
}()
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"github.com/coder/coder/v2/coderd/util/apiversion"
|
||||
)
|
||||
|
||||
const (
|
||||
CurrentMajor = 2
|
||||
CurrentMinor = 0
|
||||
)
|
||||
|
||||
var CurrentVersion = apiversion.New(CurrentMajor, CurrentMinor).WithBackwardCompat(1)
|
||||
@@ -20,13 +20,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
const (
|
||||
CurrentMajor = 2
|
||||
CurrentMinor = 0
|
||||
)
|
||||
|
||||
var CurrentVersion = apiversion.New(CurrentMajor, CurrentMinor).WithBackwardCompat(1)
|
||||
|
||||
type streamIDContextKey struct{}
|
||||
|
||||
// StreamID identifies the caller of the CoordinateTailnet RPC. We store this
|
||||
|
||||
Reference in New Issue
Block a user