MCPcopy
hub / github.com/tailscale/tailscale / Format

Method Format

net/dns/osconfig.go:160–196  ·  view source on GitHub ↗

Format implements the fmt.Formatter interface to ensure that Hosts is printed correctly (i.e. not as a bunch of pointers). Fixes https://github.com/tailscale/tailscale/issues/5669

(f fmt.State, verb rune)

Source from the content-addressed store, hash-verified

158//
159// Fixes https://github.com/tailscale/tailscale/issues/5669
160func (a OSConfig) Format(f fmt.State, verb rune) {
161 logger.ArgWriter(func(w *bufio.Writer) {
162 if !buildfeatures.HasDNS {
163 w.WriteString(`{DNS-unlinked}`)
164 return
165 }
166 w.WriteString(`{Nameservers:[`)
167 for i, ns := range a.Nameservers {
168 if i != 0 {
169 w.WriteString(" ")
170 }
171 fmt.Fprintf(w, "%+v", ns)
172 }
173 w.WriteString(`] SearchDomains:[`)
174 for i, domain := range a.SearchDomains {
175 if i != 0 {
176 w.WriteString(" ")
177 }
178 fmt.Fprintf(w, "%+v", domain)
179 }
180 w.WriteString(`] MatchDomains:[`)
181 for i, domain := range a.MatchDomains {
182 if i != 0 {
183 w.WriteString(" ")
184 }
185 fmt.Fprintf(w, "%+v", domain)
186 }
187 w.WriteString(`] Hosts:[`)
188 for i, host := range a.Hosts {
189 if i != 0 {
190 w.WriteString(" ")
191 }
192 fmt.Fprintf(w, "%+v", host)
193 }
194 w.WriteString(`]}`)
195 }).Format(f, verb)
196}
197
198// ErrGetBaseConfigNotSupported is the error
199// OSConfigurator.GetBaseConfig returns when the OSConfigurator

Callers 15

serveGetNodeDataMethod · 0.45
HashRegisterRequestFunction · 0.45
appendToFileLockedMethod · 0.45
newConnMethod · 0.45
newSSHSessionMethod · 0.45
printMessageFunction · 0.45
sumFileFunction · 0.45
printRouteCheckReportFunction · 0.45
printNetCheckReportFunction · 0.45
startNewLogFileMethod · 0.45
serveBugReportMethod · 0.45
nextPeerExpiryMethod · 0.45

Calls 2

ArgWriterFuncType · 0.92
WriteStringMethod · 0.80

Tested by 2

TestNextPeerExpiryFunction · 0.36
FuzzTimeFunction · 0.36