Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12dc086

Browse files
authored
feat: return hostname suffix on AgentConnectionInfo (#17334)
Adds the Hostname Suffix to `AgentConnectionInfo` --- the VPN provider will use it to control the suffix for DNS hostnames.part of:#16828
1 parent60fbe67 commit12dc086

File tree

7 files changed

+45
-2
lines changed

7 files changed

+45
-2
lines changed

‎coderd/apidoc/docs.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/workspaceagents.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ func (api *API) workspaceAgentConnection(rw http.ResponseWriter, r *http.Request
882882
DERPMap:api.DERPMap(),
883883
DERPForceWebSockets:api.DeploymentValues.DERP.Config.ForceWebSockets.Value(),
884884
DisableDirectConnections:api.DeploymentValues.DERP.Config.BlockDirect.Value(),
885+
HostnameSuffix:api.DeploymentValues.WorkspaceHostnameSuffix.Value(),
885886
})
886887
}
887888

@@ -903,6 +904,7 @@ func (api *API) workspaceAgentConnectionGeneric(rw http.ResponseWriter, r *http.
903904
DERPMap:api.DERPMap(),
904905
DERPForceWebSockets:api.DeploymentValues.DERP.Config.ForceWebSockets.Value(),
905906
DisableDirectConnections:api.DeploymentValues.DERP.Config.BlockDirect.Value(),
907+
HostnameSuffix:api.DeploymentValues.WorkspaceHostnameSuffix.Value(),
906908
})
907909
}
908910

‎coderd/workspaceagents_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,3 +2560,34 @@ func requireEqualOrBothNil[T any](t testing.TB, a, b *T) {
25602560
}
25612561
require.Equal(t,a,b)
25622562
}
2563+
2564+
funcTestAgentConnectionInfo(t*testing.T) {
2565+
t.Parallel()
2566+
ctx:=testutil.Context(t,testutil.WaitShort)
2567+
2568+
dv:=coderdtest.DeploymentValues(t)
2569+
dv.WorkspaceHostnameSuffix="yallah"
2570+
dv.DERP.Config.BlockDirect=true
2571+
dv.DERP.Config.ForceWebSockets=true
2572+
client,db:=coderdtest.NewWithDatabase(t,&coderdtest.Options{DeploymentValues:dv})
2573+
user:=coderdtest.CreateFirstUser(t,client)
2574+
r:=dbfake.WorkspaceBuild(t,db, database.WorkspaceTable{
2575+
OrganizationID:user.OrganizationID,
2576+
OwnerID:user.UserID,
2577+
}).WithAgent().Do()
2578+
2579+
info,err:=workspacesdk.New(client).AgentConnectionInfoGeneric(ctx)
2580+
require.NoError(t,err)
2581+
require.Equal(t,"yallah",info.HostnameSuffix)
2582+
require.True(t,info.DisableDirectConnections)
2583+
require.True(t,info.DERPForceWebSockets)
2584+
2585+
ws,err:=client.Workspace(ctx,r.Workspace.ID)
2586+
require.NoError(t,err)
2587+
agnt:=ws.LatestBuild.Resources[0].Agents[0]
2588+
info,err=workspacesdk.New(client).AgentConnectionInfo(ctx,agnt.ID)
2589+
require.NoError(t,err)
2590+
require.Equal(t,"yallah",info.HostnameSuffix)
2591+
require.True(t,info.DisableDirectConnections)
2592+
require.True(t,info.DERPForceWebSockets)
2593+
}

‎codersdk/workspacesdk/workspacesdk.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ type AgentConnectionInfo struct {
143143
DERPMap*tailcfg.DERPMap`json:"derp_map"`
144144
DERPForceWebSocketsbool`json:"derp_force_websockets"`
145145
DisableDirectConnectionsbool`json:"disable_direct_connections"`
146+
HostnameSuffixstring`json:"hostname_suffix"`
146147
}
147148

148149
func (c*Client)AgentConnectionInfoGeneric(ctx context.Context) (AgentConnectionInfo,error) {

‎docs/reference/api/agents.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/reference/api/schemas.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp