Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7e99e3e
all: backport embedded tsnet dependencies
xishang0128 May 14, 2026
b7a7b56
all: rename module to metacubex tailscale
xishang0128 May 14, 2026
0eb7d71
all: repair URLs that should not be changed
wwqgtxx May 15, 2026
94fa67e
add SystemDialer and PacketListener to magicsock and netcheck
wwqgtxx May 17, 2026
29988b7
add SystemDialer to tsdial
wwqgtxx May 16, 2026
546022d
all: adapt tsnet for mihomo
xishang0128 May 14, 2026
fc05f0f
remove sockstatLogger
wwqgtxx May 15, 2026
f056af2
disable useproxy
wwqgtxx May 16, 2026
bfaf30f
remove net.Resolver in tsdial userDialResolve
wwqgtxx May 16, 2026
8c8b2e3
use configured dialer for captive detection
xishang0128 May 16, 2026
a692146
remove net.Resolver in debugderp
wwqgtxx May 16, 2026
a5d029c
remove net.Resolver in netcheck
wwqgtxx May 16, 2026
4489cb2
use configured dialer for dnsfallback
wwqgtxx May 16, 2026
8d2e66c
use configured dialer for netstack forwardTCP
wwqgtxx May 16, 2026
ea79eda
use configured dialer for tsdial UserDial
wwqgtxx May 16, 2026
817a7fa
replace all http.DefaultTransport using
wwqgtxx May 16, 2026
cff98bb
remove cloudHostResolver
wwqgtxx May 16, 2026
1c98176
remove unstable warning
wwqgtxx May 16, 2026
511de1e
use configured listener for netstack forwardUDP
wwqgtxx May 17, 2026
cd8f304
change PacketListener type to netx.ListenPacketFunc and implement Sys…
wwqgtxx May 17, 2026
50830e8
fix panic when packetConn is not *net.UDPConn
wwqgtxx May 17, 2026
cc3ee86
fix panic when packetConn.LocalAddr() is not *net.UDPAddr
wwqgtxx May 17, 2026
00f8608
export Netstack method to tsnet.Server
wwqgtxx May 17, 2026
9e64d98
fix errors.ErrUnsupported backport
wwqgtxx May 18, 2026
977cb04
add FallbackUDPHandler for tsnet
wwqgtxx May 19, 2026
f23132f
use configured listener for Pinger
wwqgtxx May 20, 2026
1ab893d
update tailscale-wireguard-go
wwqgtxx May 21, 2026
4e8c2c8
disable webclient
wwqgtxx Jul 11, 2026
5e59cd1
disable syspolicy
wwqgtxx Jul 11, 2026
5a9137d
disable logtail
wwqgtxx Jul 11, 2026
2b5c7d7
disable dbus
wwqgtxx Jul 11, 2026
c4a5174
disable networkmanager
wwqgtxx Jul 11, 2026
bf38f98
disable resolved
wwqgtxx Jul 11, 2026
f7c1558
disable debug eventbus
wwqgtxx Jul 11, 2026
3ec565e
disable clientmetrics
wwqgtxx Jul 11, 2026
ba6570c
disable usermetrics
wwqgtxx Jul 11, 2026
e2257fe
disable debug
wwqgtxx Jul 11, 2026
3b88efd
net/netmon: poll interfaces after wake
eviaaaaa Jul 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 11 additions & 11 deletions appc/appconnector.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ package appc
import (
"context"
"fmt"
"maps"
maps "github.com/metacubex/tailscale/util/go120/maps"
slices "github.com/metacubex/tailscale/util/go120/slices"
"net/netip"
"slices"
"strings"
"time"

"tailscale.com/syncs"
"tailscale.com/types/appctype"
"tailscale.com/types/logger"
"tailscale.com/types/views"
"tailscale.com/util/clientmetric"
"tailscale.com/util/dnsname"
"tailscale.com/util/eventbus"
"tailscale.com/util/execqueue"
"tailscale.com/util/slicesx"
"github.com/metacubex/tailscale/syncs"
"github.com/metacubex/tailscale/types/appctype"
"github.com/metacubex/tailscale/types/logger"
"github.com/metacubex/tailscale/types/views"
"github.com/metacubex/tailscale/util/clientmetric"
"github.com/metacubex/tailscale/util/dnsname"
"github.com/metacubex/tailscale/util/eventbus"
"github.com/metacubex/tailscale/util/execqueue"
"github.com/metacubex/tailscale/util/slicesx"
)

// rateLogger responds to calls to update by adding a count for the current period and
Expand Down
22 changes: 12 additions & 10 deletions appc/appconnector_test.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

package appc

import (
stdcmp "cmp"
"fmt"
stdcmp "github.com/metacubex/tailscale/util/go120/cmp"
slices "github.com/metacubex/tailscale/util/go120/slices"
"net/netip"
"reflect"
"slices"
"sync/atomic"
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/metacubex/tailscale/appc/appctest"
"github.com/metacubex/tailscale/tstest"
"github.com/metacubex/tailscale/types/appctype"
"github.com/metacubex/tailscale/util/clientmetric"
"github.com/metacubex/tailscale/util/eventbus/eventbustest"
"github.com/metacubex/tailscale/util/mak"
"github.com/metacubex/tailscale/util/must"
"github.com/metacubex/tailscale/util/slicesx"
"golang.org/x/net/dns/dnsmessage"
"tailscale.com/appc/appctest"
"tailscale.com/tstest"
"tailscale.com/types/appctype"
"tailscale.com/util/clientmetric"
"tailscale.com/util/eventbus/eventbustest"
"tailscale.com/util/mak"
"tailscale.com/util/must"
"tailscale.com/util/slicesx"
)

func TestUpdateDomains(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion appc/appctest/appctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package appctest

import (
slices "github.com/metacubex/tailscale/util/go120/slices"
"net/netip"
"slices"
)

// RouteCollector is a test helper that collects the list of routes advertised
Expand Down
32 changes: 18 additions & 14 deletions appc/conn25.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
package appc

import (
"cmp"
"slices"
cmp "github.com/metacubex/tailscale/util/go120/cmp"
slices "github.com/metacubex/tailscale/util/go120/slices"
"strings"

"tailscale.com/ipn/ipnext"
"tailscale.com/tailcfg"
"tailscale.com/types/appctype"
"tailscale.com/util/mak"
"tailscale.com/util/set"
"github.com/metacubex/tailscale/ipn/ipnext"
"github.com/metacubex/tailscale/tailcfg"
"github.com/metacubex/tailscale/types/appctype"
"github.com/metacubex/tailscale/util/mak"
"github.com/metacubex/tailscale/util/set"
)

const AppConnectorsExperimentalAttrName = "tailscale.com/app-connectors-experimental"
const AppConnectorsExperimentalAttrName = "github.com/metacubex/tailscale/app-connectors-experimental"

func isPeerEligibleConnector(peer tailcfg.NodeView) bool {
if !peer.Valid() || !peer.Hostinfo().Valid() {
Expand Down Expand Up @@ -43,12 +43,15 @@ func PickConnector(nb ipnext.NodeBackend, app appctype.Conn25Attr) []tailcfg.Nod
if !isPeerEligibleConnector(n) {
return false
}
for _, t := range n.Tags().All() {
matched := false
n.Tags().All()(func(_ int, t string) bool {
if appTagsSet.Contains(t) {
return true
matched = true
return false
}
}
return false
return true
})
return matched
})
sortByPreference(matches)
return matches
Expand Down Expand Up @@ -96,7 +99,7 @@ func PickSplitDNSPeers(hasCap func(c tailcfg.NodeCapability) bool, self tailcfg.
if !isPeerEligibleConnector(peer) {
continue
}
for _, t := range peer.Tags().All() {
peer.Tags().All()(func(_ int, t string) bool {
domains := tagToDomain[t]
for domain := range domains {
if selfRoutedDomains.Contains(domain) {
Expand All @@ -107,7 +110,8 @@ func PickSplitDNSPeers(hasCap func(c tailcfg.NodeCapability) bool, self tailcfg.
}
work[domain].Add(peer.ID())
}
}
return true
})
}

// Populate m. Make a []tailcfg.NodeView from []tailcfg.NodeID using the peers map.
Expand Down
10 changes: 6 additions & 4 deletions appc/conn25_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

Expand All @@ -9,10 +11,10 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"tailscale.com/ipn/ipnext"
"tailscale.com/tailcfg"
"tailscale.com/types/appctype"
"tailscale.com/types/opt"
"github.com/metacubex/tailscale/ipn/ipnext"
"github.com/metacubex/tailscale/tailcfg"
"github.com/metacubex/tailscale/types/appctype"
"github.com/metacubex/tailscale/types/opt"
)

func TestPickSplitDNSPeers(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion appc/observe.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"net/netip"
"strings"

"github.com/metacubex/tailscale/util/mak"
"golang.org/x/net/dns/dnsmessage"
"tailscale.com/util/mak"
)

// ObserveDNSResponse is a callback invoked by the DNS resolver when a DNS
Expand Down
2 changes: 1 addition & 1 deletion atomicfile/atomicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// atomically.
//
// This package should be considered internal; its API is not stable.
package atomicfile // import "tailscale.com/atomicfile"
package atomicfile // import "github.com/metacubex/tailscale/atomicfile"

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions atomicfile/atomicfile_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

//go:build !js && !windows

package atomicfile

import (
Expand Down
2 changes: 2 additions & 0 deletions atomicfile/atomicfile_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

Expand Down
4 changes: 3 additions & 1 deletion cache_key_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

Expand All @@ -9,7 +11,7 @@ import (
"strings"
"testing"

"tailscale.com/util/cibuild"
"github.com/metacubex/tailscale/util/cibuild"
)

// TestTsgoRevInCacheKey verifies that the Tailscale Go toolchain's git
Expand Down
2 changes: 2 additions & 0 deletions chirp/chirp_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

Expand Down
2 changes: 2 additions & 0 deletions client/freedesktop/freedesktop_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

Expand Down
4 changes: 2 additions & 2 deletions client/local/debugportmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
package local

import (
"cmp"
"context"
"fmt"
cmp "github.com/metacubex/tailscale/util/go120/cmp"
"io"
"net/http"
"net/netip"
"net/url"
"strconv"
"time"

"tailscale.com/client/tailscale/apitype"
"github.com/metacubex/tailscale/client/tailscale/apitype"
)

// DebugPortmapOpts contains options for the [Client.DebugPortmap] command.
Expand Down
50 changes: 26 additions & 24 deletions client/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ package local
import (
"bufio"
"bytes"
"cmp"
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
cmp "github.com/metacubex/tailscale/util/go120/cmp"
iter "github.com/metacubex/tailscale/util/go120/iter"
"io"
"iter"
"net"
"net/http"
"net/http/httptrace"
Expand All @@ -27,24 +27,24 @@ import (
"sync"
"time"

"tailscale.com/client/tailscale/apitype"
"tailscale.com/drive"
"tailscale.com/envknob"
"tailscale.com/feature"
"tailscale.com/feature/buildfeatures"
"tailscale.com/ipn"
"tailscale.com/ipn/ipnstate"
"tailscale.com/net/netutil"
"tailscale.com/net/udprelay/status"
"tailscale.com/paths"
"tailscale.com/safesocket"
"tailscale.com/syncs"
"tailscale.com/tailcfg"
"tailscale.com/types/appctype"
"tailscale.com/types/dnstype"
"tailscale.com/types/key"
"tailscale.com/util/clientmetric"
"tailscale.com/util/eventbus"
"github.com/metacubex/tailscale/client/tailscale/apitype"
"github.com/metacubex/tailscale/drive"
"github.com/metacubex/tailscale/envknob"
"github.com/metacubex/tailscale/feature"
"github.com/metacubex/tailscale/feature/buildfeatures"
"github.com/metacubex/tailscale/ipn"
"github.com/metacubex/tailscale/ipn/ipnstate"
"github.com/metacubex/tailscale/net/netutil"
"github.com/metacubex/tailscale/net/udprelay/status"
"github.com/metacubex/tailscale/paths"
"github.com/metacubex/tailscale/safesocket"
"github.com/metacubex/tailscale/syncs"
"github.com/metacubex/tailscale/tailcfg"
"github.com/metacubex/tailscale/types/appctype"
"github.com/metacubex/tailscale/types/dnstype"
"github.com/metacubex/tailscale/types/key"
"github.com/metacubex/tailscale/util/clientmetric"
"github.com/metacubex/tailscale/util/eventbus"
)

// defaultClient is the default Client when using the legacy
Expand Down Expand Up @@ -192,7 +192,8 @@ func (e *AccessDeniedError) Unwrap() error { return e.err }

// IsAccessDeniedError reports whether err is or wraps an AccessDeniedError.
func IsAccessDeniedError(err error) bool {
_, ok := errors.AsType[*AccessDeniedError](err)
var accessDeniedErr *AccessDeniedError
ok := errors.As(err, &accessDeniedErr)
return ok
}

Expand All @@ -210,7 +211,8 @@ func (e *PreconditionsFailedError) Unwrap() error { return e.err }

// IsPreconditionsFailedError reports whether err is or wraps an PreconditionsFailedError.
func IsPreconditionsFailedError(err error) bool {
_, ok := errors.AsType[*PreconditionsFailedError](err)
var preconditionsFailedErr *PreconditionsFailedError
ok := errors.As(err, &preconditionsFailedErr)
return ok
}

Expand Down Expand Up @@ -868,7 +870,7 @@ func (lc *Client) CheckUDPGROForwarding(ctx context.Context) error {
// SetUDPGROForwarding enables UDP GRO forwarding for the main interface of this
// node. This can be done to improve performance of tailnet nodes acting as exit
// nodes or subnet routers.
// See https://tailscale.com/kb/1320/performance-best-practices#linux-optimizations-for-subnet-routers-and-exit-nodes
// See https://github.com/metacubex/tailscale/kb/1320/performance-best-practices#linux-optimizations-for-subnet-routers-and-exit-nodes
func (lc *Client) SetUDPGROForwarding(ctx context.Context) error {
body, err := lc.get200(ctx, "/localapi/v0/set-udp-gro-forwarding")
if err != nil {
Expand Down Expand Up @@ -1169,7 +1171,7 @@ func tailscaledConnectHint() string {
// ActiveState=inactive
// SubState=dead
st := map[string]string{}
for line := range strings.SplitSeq(string(out), "\n") {
for _, line := range strings.Split(string(out), "\n") {
if k, v, ok := strings.Cut(line, "="); ok {
st[k] = strings.TrimSpace(v)
}
Expand Down
16 changes: 8 additions & 8 deletions client/local/local_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//go:build ignore

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

//go:build go1.19

package local

import (
Expand All @@ -11,9 +11,9 @@ import (
"net/http"
"testing"

"tailscale.com/tstest/deptest"
"tailscale.com/tstest/nettest"
"tailscale.com/types/key"
"github.com/metacubex/tailscale/tstest/deptest"
"github.com/metacubex/tailscale/tstest/nettest"
"github.com/metacubex/tailscale/types/key"
)

func TestGetServeConfigFromJSON(t *testing.T) {
Expand Down Expand Up @@ -117,9 +117,9 @@ func TestDeps(t *testing.T) {
BadDeps: map[string]string{
// Make sure we don't again accidentally bring in a dependency on
// drive or its transitive dependencies
"testing": "do not use testing package in production code",
"tailscale.com/drive/driveimpl": "https://github.com/tailscale/tailscale/pull/10631",
"github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631",
"testing": "do not use testing package in production code",
"github.com/metacubex/tailscale/drive/driveimpl": "https://github.com/tailscale/tailscale/pull/10631",
"github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631",
},
}.Check(t)
}
2 changes: 1 addition & 1 deletion client/local/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"fmt"
"net/http"

"tailscale.com/ipn"
"github.com/metacubex/tailscale/ipn"
)

// GetServeConfig return the current serve config.
Expand Down
Loading