tailcfg.NetInfo: add a .String() renderer.

For pretty printing purposes in logs.
This commit is contained in:
Avery Pennarun 2020-03-13 01:29:47 -04:00
parent b23cb11eaf
commit 7dd63abaed
1 changed files with 6 additions and 0 deletions

View File

@ -283,6 +283,12 @@ type NetInfo struct {
// Update Clone and BasicallyEqual when adding fields.
}
func (ni *NetInfo) String() string {
return fmt.Sprintf("NetInfo{varies=%v hairpin=%v ipv6=%v udp=%v derp=#%v link=%q}",
ni.MappingVariesByDestIP, ni.HairPinning, ni.WorkingIPv6,
ni.WorkingUDP, ni.PreferredDERP, ni.LinkType)
}
// BasicallyEqual reports whether ni and ni2 are basically equal, ignoring
// changes in DERPLatency.
func (ni *NetInfo) BasicallyEqual(ni2 *NetInfo) bool {