@@ -26,6 +26,7 @@ import (
26
26
"github.com/coder/coder/v2/coderd/tracing"
27
27
"github.com/coder/coder/v2/codersdk/agentsdk"
28
28
"github.com/coder/coder/v2/tailnet"
29
+ tailnetproto "github.com/coder/coder/v2/tailnet/proto"
29
30
)
30
31
31
32
const AgentAPIVersionDRPC = "2.0"
@@ -42,6 +43,7 @@ type API struct {
42
43
* AppsAPI
43
44
* MetadataAPI
44
45
* LogsAPI
46
+ * tailnet.DRPCService
45
47
46
48
mu sync.Mutex
47
49
cachedWorkspaceID uuid.UUID
@@ -145,6 +147,13 @@ func New(opts Options) *API {
145
147
PublishWorkspaceAgentLogsUpdateFn : opts .PublishWorkspaceAgentLogsUpdateFn ,
146
148
}
147
149
150
+ api .DRPCService = & tailnet.DRPCService {
151
+ CoordPtr : opts .TailnetCoordinator ,
152
+ Logger : opts .Log ,
153
+ DerpMapUpdateFrequency : opts .DerpMapUpdateFrequency ,
154
+ DerpMapFn : opts .DerpMapFn ,
155
+ }
156
+
148
157
return api
149
158
}
150
159
@@ -155,6 +164,11 @@ func (a *API) Server(ctx context.Context) (*drpcserver.Server, error) {
155
164
return nil , xerrors .Errorf ("register agent API protocol in DRPC mux: %w" , err )
156
165
}
157
166
167
+ err = tailnetproto .DRPCRegisterTailnet (mux , a )
168
+ if err != nil {
169
+ return nil , xerrors .Errorf ("register tailnet API protocol in DRPC mux: %w" , err )
170
+ }
171
+
158
172
return drpcserver .NewWithOptions (& tracing.DRPCHandler {Handler : mux },
159
173
drpcserver.Options {
160
174
Log : func (err error ) {
0 commit comments