MCPcopy Index your code
hub / github.com/tailscale/tailscale / printConciseHeader

Method printConciseHeader

types/netmap/netmap.go:349–368  ·  view source on GitHub ↗

printConciseHeader prints a concise header line representing nm to buf. If this function is changed to access different fields of nm, keep in equalConciseHeader in sync.

(buf *strings.Builder)

Source from the content-addressed store, hash-verified

347// If this function is changed to access different fields of nm, keep
348// in equalConciseHeader in sync.
349func (nm *NetworkMap) printConciseHeader(buf *strings.Builder) {
350 fmt.Fprintf(buf, "netmap: self: %v auth=%v",
351 nm.NodeKey.ShortString(), nm.GetMachineStatus())
352
353 var login string
354 up, ok := nm.UserProfiles[nm.User()]
355 if ok {
356 login = up.LoginName()
357 }
358 if login == "" {
359 if nm.User().IsZero() {
360 login = "?"
361 } else {
362 login = fmt.Sprint(nm.User())
363 }
364 }
365 fmt.Fprintf(buf, " u=%s", login)
366 fmt.Fprintf(buf, " %v", nm.GetAddresses().AsSlice())
367 buf.WriteByte('\n')
368}
369
370// equalConciseHeader reports whether a and b are equal for the fields
371// used by printConciseHeader.

Callers 3

ConciseMethod · 0.95
VeryConciseMethod · 0.95
ConciseDiffFromMethod · 0.95

Calls 7

GetMachineStatusMethod · 0.95
UserMethod · 0.95
GetAddressesMethod · 0.95
IsZeroMethod · 0.65
ShortStringMethod · 0.45
LoginNameMethod · 0.45
AsSliceMethod · 0.45

Tested by

no test coverage detected