MCPcopy Index your code
hub / github.com/coder/coder / updateDNSNamesLocked

Method updateDNSNamesLocked

tailnet/controllers.go:1422–1450  ·  view source on GitHub ↗

updateDNSNamesLocked updates the DNS names for all workspaces in the tunnelUpdater. t.Mutex must be held.

()

Source from the content-addressed store, hash-verified

1420// updateDNSNamesLocked updates the DNS names for all workspaces in the tunnelUpdater.
1421// t.Mutex must be held.
1422func (t *tunnelUpdater) updateDNSNamesLocked() map[dnsname.FQDN][]netip.Addr {
1423 names := make(map[dnsname.FQDN][]netip.Addr)
1424 for _, w := range t.workspaces {
1425 err := w.updateDNSNames(t.dnsNameOptions)
1426 if err != nil {
1427 // This should never happen in production, because converting the FQDN only fails
1428 // if names are too long, and we put strict length limits on agent, workspace, and user
1429 // names.
1430 t.logger.Critical(context.Background(),
1431 "failed to include DNS name(s)",
1432 slog.F("workspace_id", w.ID),
1433 slog.F("suffix", t.dnsNameOptions.Suffix),
1434 slog.Error(err))
1435 }
1436 for _, a := range w.agents {
1437 for name, addrs := range a.Hosts {
1438 names[name] = addrs
1439 }
1440 }
1441 }
1442 isCoderConnectEnabledFQDN, err := dnsname.ToFQDN(fmt.Sprintf(IsCoderConnectEnabledFmtString, t.dnsNameOptions.Suffix))
1443 if err != nil {
1444 t.logger.Critical(context.Background(),
1445 "failed to include Coder Connect enabled DNS name", slog.F("suffix", t.dnsNameOptions.Suffix))
1446 } else {
1447 names[isCoderConnectEnabledFQDN] = []netip.Addr{tsaddr.CoderServiceIPv6()}
1448 }
1449 return names
1450}
1451
1452type TunnelAllOption func(t *TunnelAllWorkspaceUpdatesController)
1453

Callers 2

NewMethod · 0.95
handleUpdateMethod · 0.95

Calls 2

updateDNSNamesMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected