mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-04 23:45:34 +00:00
WIP
Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I085e259fc45e7067a5a09a9e842cf66c700f0802
This commit is contained in:
parent
0e1403ec39
commit
9e61fc7721
@ -593,7 +593,7 @@ type NetInfo struct {
|
||||
|
||||
// HavePortMap is whether we have an existing portmap open
|
||||
// (UPnP, PMP, or PCP).
|
||||
HavePortMap bool `json:",omitempty"`
|
||||
HavePortMap opt.Bool
|
||||
|
||||
// UPnP is whether UPnP appears present on the LAN.
|
||||
// Empty means not checked.
|
||||
@ -642,11 +642,11 @@ func (ni *NetInfo) String() string {
|
||||
}
|
||||
|
||||
func (ni *NetInfo) portMapSummary() string {
|
||||
if !ni.HavePortMap && ni.UPnP == "" && ni.PMP == "" && ni.PCP == "" {
|
||||
if ni.HavePortMap == "" && ni.UPnP == "" && ni.PMP == "" && ni.PCP == "" {
|
||||
return "?"
|
||||
}
|
||||
var prefix string
|
||||
if ni.HavePortMap {
|
||||
if v, _ := ni.HavePortMap.Get(); v {
|
||||
prefix = "active-"
|
||||
}
|
||||
return prefix + conciseOptBool(ni.UPnP, "U") + conciseOptBool(ni.PMP, "M") + conciseOptBool(ni.PCP, "C")
|
||||
|
@ -177,7 +177,7 @@ func (src *NetInfo) Clone() *NetInfo {
|
||||
OSHasIPv6 opt.Bool
|
||||
WorkingUDP opt.Bool
|
||||
WorkingICMPv4 opt.Bool
|
||||
HavePortMap bool
|
||||
HavePortMap opt.Bool
|
||||
UPnP opt.Bool
|
||||
PMP opt.Bool
|
||||
PCP opt.Bool
|
||||
|
@ -380,7 +380,7 @@ 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) WorkingICMPv4() opt.Bool { return v.ж.WorkingICMPv4 }
|
||||
func (v NetInfoView) HavePortMap() bool { return v.ж.HavePortMap }
|
||||
func (v NetInfoView) HavePortMap() opt.Bool { return v.ж.HavePortMap }
|
||||
func (v NetInfoView) UPnP() opt.Bool { return v.ж.UPnP }
|
||||
func (v NetInfoView) PMP() opt.Bool { return v.ж.PMP }
|
||||
func (v NetInfoView) PCP() opt.Bool { return v.ж.PCP }
|
||||
@ -398,7 +398,7 @@ func (v NetInfoView) String() string { return v.ж.Stri
|
||||
OSHasIPv6 opt.Bool
|
||||
WorkingUDP opt.Bool
|
||||
WorkingICMPv4 opt.Bool
|
||||
HavePortMap bool
|
||||
HavePortMap opt.Bool
|
||||
UPnP opt.Bool
|
||||
PMP opt.Bool
|
||||
PCP opt.Bool
|
||||
|
@ -793,12 +793,12 @@ func (c *Conn) setNetInfoHavePortMap() {
|
||||
// No NetInfo yet. Nothing to update.
|
||||
return
|
||||
}
|
||||
if c.netInfoLast.HavePortMap {
|
||||
if v, _ := c.netInfoLast.HavePortMap.Get(); v {
|
||||
// No change.
|
||||
return
|
||||
}
|
||||
ni := c.netInfoLast.Clone()
|
||||
ni.HavePortMap = true
|
||||
ni.HavePortMap.Set(true)
|
||||
c.callNetInfoCallbackLocked(ni)
|
||||
}
|
||||
|
||||
@ -834,8 +834,8 @@ func (c *Conn) updateNetInfo(ctx context.Context) (*netcheck.Report, error) {
|
||||
UPnP: report.UPnP,
|
||||
PMP: report.PMP,
|
||||
PCP: report.PCP,
|
||||
HavePortMap: c.portMapper.HaveMapping(),
|
||||
}
|
||||
ni.HavePortMap.Set(c.portMapper.HaveMapping())
|
||||
for rid, d := range report.RegionV4Latency {
|
||||
ni.DERPLatency[fmt.Sprintf("%d-v4", rid)] = d.Seconds()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user