mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-28 08:13:11 +00:00
net/netcheck: test for OS IPv6 support as well as connectivity.
This lets us distinguish "no IPv6 because the device's ISP doesn't offer IPv6" from "IPv6 is unavailable/disabled in the OS". Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
4c0feba38e
commit
c1cb3efbba
@@ -496,10 +496,14 @@ type NetInfo struct {
|
||||
// It reports true even if there's no NAT involved.
|
||||
HairPinning opt.Bool
|
||||
|
||||
// WorkingIPv6 is whether IPv6 works.
|
||||
// WorkingIPv6 is whether the host has IPv6 internet connectivity.
|
||||
WorkingIPv6 opt.Bool
|
||||
|
||||
// WorkingUDP is whether UDP works.
|
||||
// OSHasIPv6 is whether the OS supports IPv6 at all, regardless of
|
||||
// whether IPv6 internet connectivity is available.
|
||||
OSHasIPv6 opt.Bool
|
||||
|
||||
// WorkingUDP is whether the host has UDP internet connectivity.
|
||||
WorkingUDP opt.Bool
|
||||
|
||||
// HavePortMap is whether we have an existing portmap open
|
||||
@@ -590,6 +594,7 @@ func (ni *NetInfo) BasicallyEqual(ni2 *NetInfo) bool {
|
||||
return ni.MappingVariesByDestIP == ni2.MappingVariesByDestIP &&
|
||||
ni.HairPinning == ni2.HairPinning &&
|
||||
ni.WorkingIPv6 == ni2.WorkingIPv6 &&
|
||||
ni.OSHasIPv6 == ni2.OSHasIPv6 &&
|
||||
ni.WorkingUDP == ni2.WorkingUDP &&
|
||||
ni.HavePortMap == ni2.HavePortMap &&
|
||||
ni.UPnP == ni2.UPnP &&
|
||||
|
||||
@@ -154,6 +154,7 @@ var _NetInfoCloneNeedsRegeneration = NetInfo(struct {
|
||||
MappingVariesByDestIP opt.Bool
|
||||
HairPinning opt.Bool
|
||||
WorkingIPv6 opt.Bool
|
||||
OSHasIPv6 opt.Bool
|
||||
WorkingUDP opt.Bool
|
||||
HavePortMap bool
|
||||
UPnP opt.Bool
|
||||
|
||||
@@ -500,6 +500,7 @@ func TestNetInfoFields(t *testing.T) {
|
||||
"MappingVariesByDestIP",
|
||||
"HairPinning",
|
||||
"WorkingIPv6",
|
||||
"OSHasIPv6",
|
||||
"WorkingUDP",
|
||||
"HavePortMap",
|
||||
"UPnP",
|
||||
|
||||
@@ -338,6 +338,7 @@ func (v *NetInfoView) UnmarshalJSON(b []byte) error {
|
||||
func (v NetInfoView) MappingVariesByDestIP() opt.Bool { return v.ж.MappingVariesByDestIP }
|
||||
func (v NetInfoView) HairPinning() opt.Bool { return v.ж.HairPinning }
|
||||
func (v NetInfoView) WorkingIPv6() opt.Bool { return v.ж.WorkingIPv6 }
|
||||
func (v NetInfoView) OSHasIPv6() opt.Bool { return v.ж.OSHasIPv6 }
|
||||
func (v NetInfoView) WorkingUDP() opt.Bool { return v.ж.WorkingUDP }
|
||||
func (v NetInfoView) HavePortMap() bool { return v.ж.HavePortMap }
|
||||
func (v NetInfoView) UPnP() opt.Bool { return v.ж.UPnP }
|
||||
@@ -354,6 +355,7 @@ var _NetInfoViewNeedsRegeneration = NetInfo(struct {
|
||||
MappingVariesByDestIP opt.Bool
|
||||
HairPinning opt.Bool
|
||||
WorkingIPv6 opt.Bool
|
||||
OSHasIPv6 opt.Bool
|
||||
WorkingUDP opt.Bool
|
||||
HavePortMap bool
|
||||
UPnP opt.Bool
|
||||
|
||||
Reference in New Issue
Block a user