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

Commit25f2abf

Browse files
authored
chore: remove tailnet from agent API and rename client API to tailnet (#11303)
Refactors our DRPC service definitions slightly.In the previous version, I inserted the RPCs from the tailnet proto directly into the Agent service. This makes things hard to deal with because DRPC then generates a new set of methods with new interfaces with the `DRPCAgent_` prefixed. Since you can't have a single method that takes different argument types, we couldn't reuse the implementation of those RFCs without a lot of extra classes and pass-thru methods.Instead, the "right" way to do it is to integrate at the DRPC layer. So, we have two DRPC services available over the Agent websocket, and register them both on the DRPC `mux`.Since the tailnet proto RPC service is now for both clients and agents, I renamed some things to clarify and shorten.This PR also removes the `TailnetAPI` implementation from the `agentapi` package, and the next PR in the stack replaces it with the implementation from the `tailnet` package.
1 parent6529099 commit25f2abf

File tree

11 files changed

+97
-328
lines changed

11 files changed

+97
-328
lines changed

‎agent/proto/agent.pb.go‎

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

‎agent/proto/agent.proto‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,4 @@ service Agent {
256256
rpcUpdateStartup(UpdateStartupRequest)returns (Startup);
257257
rpcBatchUpdateMetadata(BatchUpdateMetadataRequest)returns (BatchUpdateMetadataResponse);
258258
rpcBatchCreateLogs(BatchCreateLogsRequest)returns (BatchCreateLogsResponse);
259-
260-
rpcStreamDERPMaps(tailnet.v2.StreamDERPMapsRequest)returns (streamtailnet.v2.DERPMap);
261-
rpcCoordinateTailnet(streamtailnet.v2.CoordinateRequest)returns (streamtailnet.v2.CoordinateResponse);
262259
}

‎agent/proto/agent_drpc.pb.go‎

Lines changed: 1 addition & 149 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/agentapi/api.go‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ type API struct {
4242
*AppsAPI
4343
*MetadataAPI
4444
*LogsAPI
45-
*TailnetAPI
4645

4746
mu sync.Mutex
4847
cachedWorkspaceID uuid.UUID
@@ -146,12 +145,6 @@ func New(opts Options) *API {
146145
PublishWorkspaceAgentLogsUpdateFn:opts.PublishWorkspaceAgentLogsUpdateFn,
147146
}
148147

149-
api.TailnetAPI=&TailnetAPI{
150-
Ctx:opts.Ctx,
151-
DerpMapFn:opts.DerpMapFn,
152-
DerpMapUpdateFrequency:opts.DerpMapUpdateFrequency,
153-
}
154-
155148
returnapi
156149
}
157150

‎coderd/agentapi/tailnet.go‎

Lines changed: 0 additions & 53 deletions
This file was deleted.

‎tailnet/client.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import (
1111
"github.com/coder/coder/v2/tailnet/proto"
1212
)
1313

14-
funcNewDRPCClient(conn net.Conn) (proto.DRPCClientClient,error) {
14+
funcNewDRPCClient(conn net.Conn) (proto.DRPCTailnetClient,error) {
1515
config:=yamux.DefaultConfig()
1616
config.LogOutput=io.Discard
1717
session,err:=yamux.Client(conn,config)
1818
iferr!=nil {
1919
returnnil,xerrors.Errorf("multiplex client: %w",err)
2020
}
21-
returnproto.NewDRPCClientClient(drpc.MultiplexedConn(session)),nil
21+
returnproto.NewDRPCTailnetClient(drpc.MultiplexedConn(session)),nil
2222
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp