@@ -35,6 +35,9 @@ type Tunnel struct {
35
35
client Client
36
36
conn Conn
37
37
38
+ // clientLogger is deliberately separate, to avoid the tunnel using itself
39
+ // as a sink for it's own logs, which could lead to deadlocks
40
+ clientLogger slog.Logger
38
41
// router and dnsConfigurator may be nil
39
42
router router.Router
40
43
dnsConfigurator dns.OSConfigurator
@@ -60,6 +63,7 @@ func NewTunnel(
60
63
speaker : * (s ),
61
64
ctx : ctx ,
62
65
logger : logger ,
66
+ clientLogger : slog .Make (),
63
67
requestLoopDone : make (chan struct {}),
64
68
client : client ,
65
69
}
@@ -161,7 +165,7 @@ func UseAsRouter() TunnelOption {
161
165
162
166
func UseAsLogger () TunnelOption {
163
167
return func (t * Tunnel ) {
164
- t .logger = t .logger .AppendSinks (t )
168
+ t .clientLogger = t .clientLogger .AppendSinks (t )
165
169
}
166
170
}
167
171
@@ -227,7 +231,7 @@ func (t *Tunnel) start(req *StartRequest) error {
227
231
apiToken ,
228
232
& Options {
229
233
Headers : header ,
230
- Logger : t .logger ,
234
+ Logger : t .clientLogger ,
231
235
DNSConfigurator : t .dnsConfigurator ,
232
236
Router : t .router ,
233
237
TUNFileDescriptor : ptr .Ref (int (req .GetTunnelFileDescriptor ())),
@@ -305,7 +309,7 @@ func convertWorkspaceUpdate(update tailnet.WorkspaceUpdate) *PeerUpdate {
305
309
for i , agent := range update .UpsertedAgents {
306
310
fqdn := make ([]string , 0 , len (agent .Hosts ))
307
311
for name := range agent .Hosts {
308
- fqdn = append (fqdn , name .WithoutTrailingDot ())
312
+ fqdn = append (fqdn , name .WithTrailingDot ())
309
313
}
310
314
out .UpsertedAgents [i ] = & Agent {
311
315
Id : tailnet .UUIDToByteSlice (agent .ID ),
@@ -327,7 +331,7 @@ func convertWorkspaceUpdate(update tailnet.WorkspaceUpdate) *PeerUpdate {
327
331
for i , agent := range update .DeletedAgents {
328
332
fqdn := make ([]string , 0 , len (agent .Hosts ))
329
333
for name := range agent .Hosts {
330
- fqdn = append (fqdn , name .WithoutTrailingDot ())
334
+ fqdn = append (fqdn , name .WithTrailingDot ())
331
335
}
332
336
out .DeletedAgents [i ] = & Agent {
333
337
Id : tailnet .UUIDToByteSlice (agent .ID ),
0 commit comments