|
|
|
@ -792,7 +792,7 @@ func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
|
|
|
|
var tailscaleIPs []netip.Addr
|
|
|
|
|
if b.netMap != nil {
|
|
|
|
|
addrs := b.netMap.GetAddresses()
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
if addr := addrs.At(i); addr.IsSingleIP() {
|
|
|
|
|
sb.AddTailscaleIP(addr.Addr())
|
|
|
|
|
tailscaleIPs = append(tailscaleIPs, addr.Addr())
|
|
|
|
@ -856,7 +856,7 @@ func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) {
|
|
|
|
|
lastSeen = *p.LastSeen()
|
|
|
|
|
}
|
|
|
|
|
tailscaleIPs := make([]netip.Addr, 0, p.Addresses().Len())
|
|
|
|
|
for i := range p.Addresses().LenIter() {
|
|
|
|
|
for i := range p.Addresses().Len() {
|
|
|
|
|
addr := p.Addresses().At(i)
|
|
|
|
|
if addr.IsSingleIP() && tsaddr.IsTailscaleIP(addr.Addr()) {
|
|
|
|
|
tailscaleIPs = append(tailscaleIPs, addr.Addr())
|
|
|
|
@ -977,7 +977,7 @@ func (b *LocalBackend) peerCapsLocked(src netip.Addr) tailcfg.PeerCapMap {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
addrs := b.netMap.GetAddresses()
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
a := addrs.At(i)
|
|
|
|
|
if !a.IsSingleIP() {
|
|
|
|
|
continue
|
|
|
|
@ -1433,7 +1433,7 @@ func setExitNodeID(prefs *ipn.Prefs, nm *netmap.NetworkMap) (prefsChanged bool)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, peer := range nm.Peers {
|
|
|
|
|
for i := range peer.Addresses().LenIter() {
|
|
|
|
|
for i := range peer.Addresses().Len() {
|
|
|
|
|
addr := peer.Addresses().At(i)
|
|
|
|
|
if !addr.IsSingleIP() || addr.Addr() != prefs.ExitNodeIP {
|
|
|
|
|
continue
|
|
|
|
@ -1877,7 +1877,7 @@ func (b *LocalBackend) updateFilterLocked(netMap *netmap.NetworkMap, prefs ipn.P
|
|
|
|
|
logNetsB.RemovePrefix(tsaddr.ChromeOSVMRange())
|
|
|
|
|
if haveNetmap {
|
|
|
|
|
addrs = netMap.GetAddresses()
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
localNetsB.AddPrefix(addrs.At(i))
|
|
|
|
|
}
|
|
|
|
|
packetFilter = netMap.PacketFilter
|
|
|
|
@ -1987,7 +1987,7 @@ func packetFilterPermitsUnlockedNodes(peers map[tailcfg.NodeID]tailcfg.NodeView,
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
numUnlocked++
|
|
|
|
|
for i := range p.AllowedIPs().LenIter() { // not only addresses!
|
|
|
|
|
for i := range p.AllowedIPs().Len() { // not only addresses!
|
|
|
|
|
b.AddPrefix(p.AllowedIPs().At(i))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3640,14 +3640,14 @@ func dnsConfigForNetmap(nm *netmap.NetworkMap, peers map[tailcfg.NodeID]tailcfg.
|
|
|
|
|
return // TODO: propagate error?
|
|
|
|
|
}
|
|
|
|
|
var have4 bool
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
if addrs.At(i).Addr().Is4() {
|
|
|
|
|
have4 = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var ips []netip.Addr
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
addr := addrs.At(i)
|
|
|
|
|
if selfV6Only {
|
|
|
|
|
if addr.Addr().Is6() {
|
|
|
|
@ -3936,7 +3936,7 @@ func (b *LocalBackend) initPeerAPIListener() {
|
|
|
|
|
b.peerAPIServer = ps
|
|
|
|
|
|
|
|
|
|
isNetstack := b.sys.IsNetstack()
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
a := addrs.At(i)
|
|
|
|
|
var ln net.Listener
|
|
|
|
|
var err error
|
|
|
|
@ -4250,7 +4250,7 @@ func (b *LocalBackend) enterStateLockedOnEntry(newState ipn.State) {
|
|
|
|
|
case ipn.Running:
|
|
|
|
|
var addrStrs []string
|
|
|
|
|
addrs := netMap.GetAddresses()
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
addrStrs = append(addrStrs, addrs.At(i).Addr().String())
|
|
|
|
|
}
|
|
|
|
|
systemd.Status("Connected; %s; %s", activeLogin, strings.Join(addrStrs, " "))
|
|
|
|
@ -4626,7 +4626,7 @@ func (b *LocalBackend) setNetMapLocked(nm *netmap.NetworkMap) {
|
|
|
|
|
b.nodeByAddr[k] = 0
|
|
|
|
|
}
|
|
|
|
|
addNode := func(n tailcfg.NodeView) {
|
|
|
|
|
for i := range n.Addresses().LenIter() {
|
|
|
|
|
for i := range n.Addresses().Len() {
|
|
|
|
|
if ipp := n.Addresses().At(i); ipp.IsSingleIP() {
|
|
|
|
|
b.nodeByAddr[ipp.Addr()] = n.ID()
|
|
|
|
|
}
|
|
|
|
@ -5062,7 +5062,7 @@ func (b *LocalBackend) SetDNS(ctx context.Context, name, value string) error {
|
|
|
|
|
|
|
|
|
|
func peerAPIPorts(peer tailcfg.NodeView) (p4, p6 uint16) {
|
|
|
|
|
svcs := peer.Hostinfo().Services()
|
|
|
|
|
for i := range svcs.LenIter() {
|
|
|
|
|
for i := range svcs.Len() {
|
|
|
|
|
s := svcs.At(i)
|
|
|
|
|
switch s.Proto {
|
|
|
|
|
case tailcfg.PeerAPI4:
|
|
|
|
@ -5095,7 +5095,7 @@ func peerAPIBase(nm *netmap.NetworkMap, peer tailcfg.NodeView) string {
|
|
|
|
|
|
|
|
|
|
var have4, have6 bool
|
|
|
|
|
addrs := nm.GetAddresses()
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
a := addrs.At(i)
|
|
|
|
|
if !a.IsSingleIP() {
|
|
|
|
|
continue
|
|
|
|
@ -5118,7 +5118,7 @@ func peerAPIBase(nm *netmap.NetworkMap, peer tailcfg.NodeView) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func nodeIP(n tailcfg.NodeView, pred func(netip.Addr) bool) netip.Addr {
|
|
|
|
|
for i := range n.Addresses().LenIter() {
|
|
|
|
|
for i := range n.Addresses().Len() {
|
|
|
|
|
a := n.Addresses().At(i)
|
|
|
|
|
if a.IsSingleIP() && pred(a.Addr()) {
|
|
|
|
|
return a.Addr()
|
|
|
|
@ -5296,7 +5296,7 @@ func wireguardExitNodeDNSResolvers(nm *netmap.NetworkMap, peers map[tailcfg.Node
|
|
|
|
|
resolvers := p.ExitNodeDNSResolvers()
|
|
|
|
|
if !resolvers.IsNil() && resolvers.Len() > 0 {
|
|
|
|
|
copies := make([]*dnstype.Resolver, resolvers.Len())
|
|
|
|
|
for i := range resolvers.LenIter() {
|
|
|
|
|
for i := range resolvers.Len() {
|
|
|
|
|
copies[i] = resolvers.At(i).AsStruct()
|
|
|
|
|
}
|
|
|
|
|
return copies, true
|
|
|
|
@ -5319,7 +5319,7 @@ func peerCanProxyDNS(p tailcfg.NodeView) bool {
|
|
|
|
|
// If p.Cap is not populated (e.g. older control server), then do the old
|
|
|
|
|
// thing of searching through services.
|
|
|
|
|
services := p.Hostinfo().Services()
|
|
|
|
|
for i := range services.LenIter() {
|
|
|
|
|
for i := range services.Len() {
|
|
|
|
|
if s := services.At(i); s.Proto == tailcfg.PeerAPIDNS && s.Port >= 1 {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
@ -5495,7 +5495,7 @@ func (b *LocalBackend) handleQuad100Port80Conn(w http.ResponseWriter, r *http.Re
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
io.WriteString(w, "<p>Local addresses:</p><ul>\n")
|
|
|
|
|
for i := range addrs.LenIter() {
|
|
|
|
|
for i := range addrs.Len() {
|
|
|
|
|
fmt.Fprintf(w, "<li>%v</li>\n", addrs.At(i).Addr())
|
|
|
|
|
}
|
|
|
|
|
io.WriteString(w, "</ul>\n")
|
|
|
|
|