diff --git a/go.mod b/go.mod index 93f8086..482227f 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,15 @@ module github.com/ekarulf/quantumcat go 1.27.4 require ( - github.com/tailscale/tailcat v0.7.1-0.20261105151022-e00cdde6ff78 + github.com/tailscale/tailcat v0.8.1-0.20261202233757-9245129f1aff go4.org/mem v0.0.0-20240501181205-ae6ca9944745 - tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5 + tailscale.com v1.107.0-pre.0.20261201224323-cd4f62139953 ) require ( filippo.io/edwards25519 v1.2.0 // indirect github.com/akutz/memconn v0.1.0 // indirect + github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect github.com/axiomhq/hyperloglog v0.3.0 // indirect github.com/coder/websocket v1.8.15 // indirect github.com/creachadair/msync v0.10.1 // indirect @@ -28,7 +29,7 @@ require ( github.com/huin/goupnp v1.3.0 // indirect github.com/jsimonetti/rtnetlink v1.4.2 // indirect github.com/kamstrup/intmap v0.5.2 // indirect - github.com/klauspost/compress v1.20.1 // indirect + github.com/klauspost/compress v1.20.2 // indirect github.com/mdlayher/netlink v1.11.2 // indirect github.com/mdlayher/socket v0.7.0 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect @@ -39,20 +40,20 @@ require ( github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f // indirect github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea // indirect - github.com/tailscale/wireguard-go v0.0.0-20260928213353-e61b6b78110b // indirect + github.com/tailscale/wireguard-go v0.0.0-20261125191149-d74d4ff62061 // indirect github.com/x448/float16 v0.8.4 // indirect go4.org/netipx v0.0.0-20260823151212-3075585bcbeb // indirect - golang.org/x/crypto v0.57.0 // indirect + golang.org/x/crypto v0.59.0 // indirect golang.org/x/exp v0.0.0-20261007192929-f45ad48fbe92 // indirect - golang.org/x/net v0.60.0 // indirect - golang.org/x/sync v0.23.0 // indirect - golang.org/x/sys v0.48.0 // indirect - golang.org/x/term v0.46.0 // indirect - golang.org/x/text v0.42.0 // indirect + golang.org/x/net v0.62.0 // indirect + golang.org/x/sync v0.25.0 // indirect + golang.org/x/sys v0.50.0 // indirect + golang.org/x/term v0.48.0 // indirect + golang.org/x/text v0.44.0 // indirect golang.org/x/time v0.16.0 // indirect golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect golang.zx2c4.com/wireguard/windows v1.1.1 // indirect - gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72 // indirect + gvisor.dev/gvisor v0.0.0-20261129202619-2c60c87d5cf0 // indirect ) replace github.com/tailscale/tailcat => ./third_party/tailcat diff --git a/go.sum b/go.sum index 2a33480..1dd2129 100644 --- a/go.sum +++ b/go.sum @@ -12,36 +12,36 @@ github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e h1:4dAU9FXIyQktp github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= -github.com/aws/aws-sdk-go-v2 v1.46.0 h1:1kt7m/EKcEHt5mlyyxx9cSlMddRPIKbjb6DIQsu4HPk= -github.com/aws/aws-sdk-go-v2 v1.46.0/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU= -github.com/aws/aws-sdk-go-v2/config v1.33.3 h1:h090b3O5S17bF87/0ysHZuIT/7DCb4EBRFQX2PMVPCw= -github.com/aws/aws-sdk-go-v2/config v1.33.3/go.mod h1:YYDB1kTejxbfAbEVUqgCtkVp26xvNCHev9cLKABMGAk= -github.com/aws/aws-sdk-go-v2/credentials v1.20.3 h1:tToOYM/LXev4NpfWlIYGDvBvjHmJ3HXpRU9ppl+pM6k= -github.com/aws/aws-sdk-go-v2/credentials v1.20.3/go.mod h1:wfGneWyncO7p67wqXV2IQhPk14JqIc25woKlaArT3WI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2 h1:Ldv7RPHs7qwwTscRjAl3YBud32f3BvdAGRmSvAx5L38= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2/go.mod h1:XyK6UV8xbo66ysVqLd2783C09pBYHOm8aKTRV5DVJ30= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2 h1:q/PSLGuRWCChWg+dLnb9dWOnrCxJtnboXbBtFoqqRrI= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2/go.mod h1:TD1jvU2LvXkJexct5vBqcd8QlNXh5EmRUeL/Z32p0n4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2 h1:6fl86IPqKEXoySqiOWdfgbEp9OVbn44zTfEICNEBDhY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2/go.mod h1:63HDfhFkdzBpI8WGXTSKUHPKS6mqldj4u3LJW7RZtSU= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2 h1:XMgIRS+uW9F3yFKnXGRrI9pkHi99CXTmoz2kz2/TGBA= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2/go.mod h1:vorxDzK+n3jiv9a5ST/LG0Eu9cSv1CRdKTpG6pDMs+M= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 h1:bAdDl/HkGCcGPoe25ToSHEw23VIxt6CT5fLcg111BKg= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19/go.mod h1:KaUzbLxv4CeSxh6ZCl9B4m7CuFenS8kUEaDs+f/DQr4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2 h1:ZtHYnumr6QyxhzEzNZwzQTFJEXOswrZqTTkRxthwvr4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2/go.mod h1:a1NXrYpBd311gBzn1UI5UzJyyvXktM4xNh/ydPiPpqY= -github.com/aws/aws-sdk-go-v2/service/signin v1.9.0 h1:c3k+k/CS4L+sAIH6fxikL+g5g2LpeNczaoyjjw1iMKI= -github.com/aws/aws-sdk-go-v2/service/signin v1.9.0/go.mod h1:AGIoQg99fBrOIQnF78TLx4lj18mc4gZ0hJx1UaLIFM4= +github.com/aws/aws-sdk-go-v2 v1.47.3 h1:HRoT/MkNi3bjO5xF4dCzLzvVmkvRGHj3/cLINDnJejk= +github.com/aws/aws-sdk-go-v2 v1.47.3/go.mod h1:xSl+OSI5ZUw6bSMupWc218zE5Pl+65MCCu3ySWFY99A= +github.com/aws/aws-sdk-go-v2/config v1.33.9 h1:Hv6bcQUJVnmuWaKjqD6Ot8sE75NrWsWV20oGT5aWle0= +github.com/aws/aws-sdk-go-v2/config v1.33.9/go.mod h1:ivowmrZNfBQLcg4QkaItgi5wae4Bzot9RzIdbY1hfTg= +github.com/aws/aws-sdk-go-v2/credentials v1.20.9 h1:SNO55PnWhaDafsOcv16lCA0kdoFMl/YlegWoVsU02s0= +github.com/aws/aws-sdk-go-v2/credentials v1.20.9/go.mod h1:+2reOTRtdD3VSBqpRDNwrZIYy8yMCYa7oK3WKTJ/I1I= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.3 h1:gr3b87OLB29jymWPzp/CAyXwQRJVE+sC4Wm0qBIKHsk= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.3/go.mod h1:BRjf4L/Yx2hY54o+ZibPbLJyMMeSwqYQXwcJfqW66a8= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.6 h1:CqL8NN3p4I0JTwwV5MEoatIl4Y2amZ2X9dRD+0hbRL0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.6/go.mod h1:exdJ32hMqXl0Wyo6NwqEC5yIhtua3+PDaKE8P29m4qE= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.6 h1:FpBq24TG6WVSObTNhQOv7Q0088rounUUlwn3zlNItkM= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.6/go.mod h1:ONzdPVYC95oBOu0VWNEsKEntcoemP3xVKjT+qWml1s4= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.6 h1:Qmn60RWuk9+bd2ddvJJqwf3Cpac3VvGMOdbGemtUhX4= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.6/go.mod h1:h/YJhe4AVyQxEUMluph10iqV7mjajH7A9L+BHF5ppis= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.21 h1:e6YW5uME30TkrElR+4/xcY7NB6CCj2dcv7vtmGXhfhQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.21/go.mod h1:obpHAMP693+f3/A8PkLhIqfK1C+NWWn8zXzqD3OH520= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.6 h1:LHHdobjo5le1sjJdolitV7uVvYg3wkaeM1Ju2fDgeZQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.6/go.mod h1:CBGB0evAiaMD3Lk4wPO7LQCcCZLuhzL5Qf/wfEUHQ5w= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.4 h1:tvpDjuUvgKURf3Yk4hOaGbZ4QdY+070OWcA5d6LUv2A= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.4/go.mod h1:3ibVKg5Ng82Zby8++jELTD2nHxiPk2DJRLEeW/LKp8M= github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0 h1:JqKSBJlS68F4nxoPLwD7tB3lJ3gWEK9p+7eOiBE/lsM= github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0/go.mod h1:5TMMHmQGjCODMeIopSNfxkan11jG0SmFpyjcMvCLzHA= -github.com/aws/aws-sdk-go-v2/service/sso v1.37.0 h1:+rqBaOq7jzInjY8M12hr+zEe85JpRll9BjMx38r33Ok= -github.com/aws/aws-sdk-go-v2/service/sso v1.37.0/go.mod h1:XFlVwUsw3sYh8Hw37umYVJnrcWrwXWRxbNw/JY0bblw= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0 h1:hzM3GslEAOBcLn3DHH6ENToFi+vXP+n02W+x6zejAIM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0/go.mod h1:588e7skMkYIYkSUseT8E3WKFfbAfrA1bj3Zf+qxJtJY= -github.com/aws/aws-sdk-go-v2/service/sts v1.49.0 h1:N7Ey8obY3uSui+cxl0OUzFlFmkxSucoJnrniFhw+cLc= -github.com/aws/aws-sdk-go-v2/service/sts v1.49.0/go.mod h1:zMBwjSf4Pt8a1OHYiZ5rPD0PJRK1kQrUaxhS/Dbld8E= -github.com/aws/smithy-go v1.28.1 h1:R/nXH00c8qcfCzQVELtRw+eLQWtzv+VAIEFJ1/xxXlQ= -github.com/aws/smithy-go v1.28.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.4 h1:ChCtagixSFOxltv0o6E3NT8F7ksvZtZGPwUBynO5Nmk= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.4/go.mod h1:+FEO9jrVMpc9oN3CdAxJbtlQEu3z8UddDPSedpeM3PY= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.4 h1:j6c+HA4AoS0EBEjArPjavFEBrucJEryfrQU0TffmACk= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.4/go.mod h1:RhghaXUk9q66VtOQUX1FdPddQuHnqQZzbB0fEYXmPRA= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.4 h1:OKEfbf2tcfsF2pBk/S9QqNpo6alaAtiBs4hysCsBjPw= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.4/go.mod h1:mCd6qGo9b8hTtfjgsmNkFlzwjyce4owd7HDVFnCLXhM= +github.com/aws/smithy-go v1.28.5 h1:OqbqKtzY9NUnr2yAe9+hiTdFb20tNaK/lI0PMOGXX9k= +github.com/aws/smithy-go v1.28.5/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/axiomhq/hyperloglog v0.3.0 h1:IQzzb1zjZiODMwCgBRHKak4oIp2Oj7K0Q0rVoAoFVuM= github.com/axiomhq/hyperloglog v0.3.0/go.mod h1:YjX/dQqCR/7QYX0g8mu8UZAjpIenz1FKM71UEsjFoTo= github.com/benbjohnson/immutable v0.4.3 h1:GYHcksoJ9K6HyAUpGxwZURrbTkXA0Dh4otXGqbhdrjA= @@ -86,8 +86,8 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9 h1:J8S+Ms89nvHX1F9Ma2m3KhdTl41ZhbFKMyAJqvDA+iE= github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9/go.mod h1:OGmRfY/9QEK2P5zCRtmqfbCF283xPkU2dvVA4MvbvpI= -github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737 h1:cf60tHxREO3g1nroKr2osU3JWZsJzkfi7rEg+oAB0Lo= -github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737/go.mod h1:MIS0jDzbU/vuM9MC4YnBITCv+RYuTRq8dJzmCrFsK9g= +github.com/go4org/plan9netshell v0.0.0-20261130214832-f7dfc18b3ab6 h1:CMyTWglRVWGWh9q2kNEm84/DewiLMsMQtcMmOjxbS0Q= +github.com/go4org/plan9netshell v0.0.0-20261130214832-f7dfc18b3ab6/go.mod h1:MIS0jDzbU/vuM9MC4YnBITCv+RYuTRq8dJzmCrFsK9g= github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= @@ -106,8 +106,6 @@ github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/illarion/gonotify/v3 v3.0.2 h1:O7S6vcopHexutmpObkeWsnzMJt/r1hONIEogeVNmJMk= -github.com/illarion/gonotify/v3 v3.0.2/go.mod h1:HWGPdPe817GfvY3w7cx6zkbzNZfi3QjcBm/wgVvEL1U= github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae h1:nXGg65fXsylSUTNNWwvHuQsXev7mhIzQTnZREPTbWzs= github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae/go.mod h1:tGfUTcnFYGYvVNCaZZhwlJySU/fQQxh9TmpsFzWXnnY= github.com/jellydator/ttlcache/v3 v3.4.1 h1:bOdXmXiycyK6E6Qjyuj5vl+/vU3SCOoDs8a86NbHjAQ= @@ -116,8 +114,8 @@ github.com/jsimonetti/rtnetlink v1.4.2 h1:Df9w9TZ3npHTyDn0Ev9e1uzmN2odmXd0QX+J5G github.com/jsimonetti/rtnetlink v1.4.2/go.mod h1:92s6LJdE+1iOrw+F2/RO7LYI2Qd8pPpFNNUYW06gcoM= github.com/kamstrup/intmap v0.5.2 h1:qnwBm1mh4XAnW9W9Ue9tZtTff8pS6+s6iKF6JRIV2Dk= github.com/kamstrup/intmap v0.5.2/go.mod h1:gWUVWHKzWj8xpJVFf5GC0O26bWmv3GqdnIX/LMT6Aq4= -github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= -github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/compress v1.20.2 h1:v5tiZvm1KGLyg5d5oXdXe3lsSPrbEUiKoXGia//I7Qo= +github.com/klauspost/compress v1.20.2/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/kortschak/wol v0.0.0-20200729010619-da482cc4850a h1:+RR6SqnTkDLWyICxS1xpjCi/3dhyV+TgZwA6Ww3KncQ= github.com/kortschak/wol v0.0.0-20200729010619-da482cc4850a/go.mod h1:YTtCCM3ryyfiu4F7t8HQ1mxvp1UBdWM2r6Xa+nGWvDk= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= @@ -144,8 +142,8 @@ github.com/pierrec/lz4/v4 v4.1.26 h1:GrpZw1gZttORinvzBdXPUXATeqlJjqUG/D87TKMnhjY github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= github.com/pires/go-proxyproto v0.15.0 h1:dTshmNbFm/D+0+sbrxUuddPOZ5Y0B7c5NhtsBkm6LqI= github.com/pires/go-proxyproto v0.15.0/go.mod h1:OXsCrKwrK2tXS9YrI5tkHx5xaQlO8FH3lFW76orFh24= -github.com/pkg/sftp v1.13.11 h1:0N92SLTB8JqASJB14ZLHHzFnBV8mG9zw4K7jghEFWuE= -github.com/pkg/sftp v1.13.11/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0= +github.com/pkg/sftp v1.13.13 h1:lfbNTnT3zEilT8XxmwBBb5sdqJJBTunll5OVNCZPwrs= +github.com/pkg/sftp v1.13.13/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= github.com/prometheus/common v0.71.0 h1:9KDAKb7Mj3HEVKyFCK6Dc/HIwlBzZIN2l7/lrHl3KK8= @@ -160,8 +158,8 @@ github.com/studio-b12/gowebdav v0.13.0 h1:OcwSg6IQHOFNdYHn3bPOHwSE8looG8N56Y5xTT github.com/studio-b12/gowebdav v0.13.0/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE= github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d h1:JcGKBZAL7ePLwOhUdN8qGQZlP5GueEiIZwY7R62pejE= github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d/go.mod h1:XrBNfAFN+pwoWuksbFS9Ccxnopa15zJGgXRFN90l3K4= -github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28 h1:Azz5ILxxVsHN/KjIu3wkJPAmmtiijucZw4Ax5Ye8n+s= -github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28/go.mod h1:wn16Km1EZOX4UEAyaZa3dBwfFGOJ7neck40NcwosJUw= +github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a h1:LQfS++EBVN2Bk9/FbFjJmdP/CsebU0OupOX58tO4p04= +github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a/go.mod h1:wn16Km1EZOX4UEAyaZa3dBwfFGOJ7neck40NcwosJUw= github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 h1:Gzfnfk2TWrk8Jj4P4c1a3CtQyMaTVCznlkLZI++hok4= github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55/go.mod h1:4k4QO+dQ3R5FofL+SanAUZe+/QfeK0+OIuwDIRu2vSg= github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f h1:9hiVElpCmKzsBKQHkBqZ8LGzt82iLfM8egxr4sew+Ys= @@ -174,8 +172,8 @@ github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea h1:a github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea/go.mod h1:agQPE6y6ldqCOui2gkIh7ZMztTkIQKH049tv8siLuNQ= github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6 h1:l10Gi6w9jxvinoiq15g8OToDdASBni4CyJOdHY1Hr8M= github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6/go.mod h1:ZXRML051h7o4OcI0d3AaILDIad/Xw0IkXaHM17dic1Y= -github.com/tailscale/wireguard-go v0.0.0-20260928213353-e61b6b78110b h1:roJhpZBsUsZayIDsfSSrgGKUNJjOPXXs1Ul/C/z7C0g= -github.com/tailscale/wireguard-go v0.0.0-20260928213353-e61b6b78110b/go.mod h1:rUelGmuK4UnSJYM5gl5Mknp6YbwwcL8+VAPMhNYe+jg= +github.com/tailscale/wireguard-go v0.0.0-20261125191149-d74d4ff62061 h1:wwKhjUjxTN7Xp9tEJb3I/O0CspKEPkDXy9Aje08A/gY= +github.com/tailscale/wireguard-go v0.0.0-20261125191149-d74d4ff62061/go.mod h1:Hl7pyu83xNjc1LY5e9apq2mWm8Hl76wRtJbwZ2XISqY= github.com/tailscale/xnet v0.0.0-20240729143630-8497ac4dab2e h1:zOGKqN5D5hHhiYUp091JqK7DPCqSARyUfduhGUY8Bek= github.com/tailscale/xnet v0.0.0-20240729143630-8497ac4dab2e/go.mod h1:orPd6JZXXRyuDusYilywte7k094d7dycXXU5YnWsrwg= github.com/u-root/u-root v0.16.0 h1:wY40O83MBVks97+Is0WlFlOPSwKQMIrWP9R1IsrExg8= @@ -192,29 +190,29 @@ go4.org/mem v0.0.0-20240501181205-ae6ca9944745 h1:Tl++JLUCe4sxGu8cTpDzRLd3tN7US4 go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g= go4.org/netipx v0.0.0-20260823151212-3075585bcbeb h1:XBM4hvfwGAttkkiTIFfeigdfcL1xIfdKXqFdgiHGtDs= go4.org/netipx v0.0.0-20260823151212-3075585bcbeb/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= +golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= golang.org/x/exp v0.0.0-20261007192929-f45ad48fbe92 h1:kc+Gi2MFkd0KWtdDlVxVwjw4KB98/77usJDFj+6YFQ8= golang.org/x/exp v0.0.0-20261007192929-f45ad48fbe92/go.mod h1:SRjTzy5WcYqRRqquLUvHeeovSwLO0CZ3xcltZNO4Fck= golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f h1:+lI8cDJ4uceLipg2f1ODay7fEuLkk0BIHXd6PB8icxo= golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f/go.mod h1:PqrXSW65cXDZH0k4IeUbhmg/bcAZDbzNz3byBpKCsXo= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= +golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= -golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/term v0.48.0 h1:G6UU1eiSB8nl3DzeUGt7Mg+2SctI8tPS6Z5/mBt6cOk= +golang.org/x/term v0.48.0/go.mod h1:BRDLHCZr2SUjIeBHHpRyQeC9xzSAVbzY2rvKgafnHf4= +golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo= +golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY= golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= -golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= -golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI= golang.zx2c4.com/wireguard v0.0.0-20260522210424-ecfc5a8d5446 h1:cqHQ3AycTHvM2R7ikgyX57D+XvtcSnGylsLkOVhta/w= @@ -223,13 +221,13 @@ golang.zx2c4.com/wireguard/windows v1.1.1 h1:8/H97U1v1PNDNcBsMZgU3KFuND9MQdTsU2N golang.zx2c4.com/wireguard/windows v1.1.1/go.mod h1:+fbT3FFdX4zzYDLwJh5+HPEcNN/3HyNdzhNSVsQM+zs= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72 h1:EytKYr5WrVs+Aah/0xDO8ZAZZzS/iTEVC8ln4ipDbL0= -gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72/go.mod h1:8aLQqUBHDH8fY5y60lzmwDpMMbQCcT3EBfoSwhfaGCY= +gvisor.dev/gvisor v0.0.0-20261129202619-2c60c87d5cf0 h1:4/UU5xawrGIa4pgw1HqA62zG+KCZAj4FLKMkngP2aIU= +gvisor.dev/gvisor v0.0.0-20261129202619-2c60c87d5cf0/go.mod h1:AGCFHJ8yer01MsPbOE1JJtEOoLx79kr4ranU2wAm67k= honnef.co/go/tools v0.8.1 h1:+JKf3xJ1ni4CwrhVg4/pqsfPGP6vNAXcKbMXJodYx3w= honnef.co/go/tools v0.8.1/go.mod h1:XA+OnlRA9EDh/ukGvXMNSZNKGwFQJ+5dER0ioUkOxks= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= software.sslmate.com/src/go-pkcs12 v0.7.3 h1:JBQD3FDqYjTeyDAeZQklj2ar88ykBLtALloPJHyAauU= software.sslmate.com/src/go-pkcs12 v0.7.3/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI= -tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5 h1:LDOp01qRD9ZWKk3BOKTM6nHdmMtWo+sz7Q+j6au9YBU= -tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5/go.mod h1:cwBO6r4TAtlbDIdnDFJZeJ20bSBW10lbKm/dyLC73Ic= +tailscale.com v1.107.0-pre.0.20261201224323-cd4f62139953 h1:tdv9m40ehE2Dqu+TqLsf/DyMW239ZbBwKnxIxsebphQ= +tailscale.com v1.107.0-pre.0.20261201224323-cd4f62139953/go.mod h1:5jqflrhAgMwdzJz8PHB0Iltk2BfhvRcH16esoXSyw/0= diff --git a/third_party/tailcat/QUANTUMCAT.md b/third_party/tailcat/QUANTUMCAT.md index ea5bb08..a31313f 100644 --- a/third_party/tailcat/QUANTUMCAT.md +++ b/third_party/tailcat/QUANTUMCAT.md @@ -1,14 +1,15 @@ # Upstream provenance Networking library subset from github.com/tailscale/tailcat main, -commit e00cdde6ff787f801361ff85ed085775c775d4c5. BSD-3-Clause license retained. +commit 9245129f1affd5b4b838e36ea0a2276bf83fd4c4. BSD-3-Clause license retained. Optional SSH/file-server and CLI code is omitted. -The update from 52fbad323e9d to e00cdde6ff78 changes upstream dependency and -build metadata only; no retained upstream Go source changed. Both local module -manifests use its coordinated Tailscale/WireGuard versions, including the -Tailscale netstack shutdown fix. The reduced mirror does not carry upstream's -Nix, release CLI, or optional-feature build-tag configuration. +Both local Go modules use the Tailscale, WireGuard, and gVisor versions from +this revision. The networking subset includes upstream's DERP map handling, +proxy and WebSocket support, netstack shutdown changes, and legacy client +restart handling. Quantumcat keeps its authenticated bootstrap and full-length +per-peer PSKs. Upstream's experimental hybrid WireGuard mode is outside this +mirror. Quantumcat modifications add a bounded DERP bootstrap callback, disable Meow authorization when that callback is configured, gate client WireGuard peer diff --git a/third_party/tailcat/admission_test.go b/third_party/tailcat/admission_test.go index 9f6afe5..e1356a1 100644 --- a/third_party/tailcat/admission_test.go +++ b/third_party/tailcat/admission_test.go @@ -414,7 +414,7 @@ func TestLegacyAdmissionCancellation(t *testing.T) { t.Fatal(err) } result := make(chan bool, 1) - go func() { result <- s.lb.onMeow(client, disco) }() + go func() { result <- s.lb.onMeow(client, disco, meowInstanceID{}) }() awaitBootstrapEvent(t, entered) allowed.Store(false) if action == "disconnect" { @@ -427,7 +427,7 @@ func TestLegacyAdmissionCancellation(t *testing.T) { } } // Cancellation must retain per-key serialization until the hook returns. - if s.lb.onMeow(client, disco) || calls.Load() != 1 { + if s.lb.onMeow(client, disco, meowInstanceID{}) || calls.Load() != 1 { t.Fatal("retry started a second admission while the old hook was pending") } releaseOnce.Do(func() { close(release) }) @@ -441,14 +441,14 @@ func TestLegacyAdmissionCancellation(t *testing.T) { t.Fatalf("retained peers=%d pending=%d", peers, pending) } if action == "disconnect" { - if s.lb.onMeow(client, disco) { + if s.lb.onMeow(client, disco, meowInstanceID{}) { t.Fatal("fresh admission ignored updated rejection policy") } allowed.Store(true) - if !s.lb.onMeow(client, disco) { + if !s.lb.onMeow(client, disco, meowInstanceID{}) { t.Fatal("fresh approved admission was not installed") } - } else if s.lb.onMeow(client, disco) { + } else if s.lb.onMeow(client, disco, meowInstanceID{}) { t.Fatal("closed server admitted a new peer") } }) diff --git a/third_party/tailcat/derpwebsocket.go b/third_party/tailcat/derpwebsocket.go new file mode 100644 index 0000000..cb89fa8 --- /dev/null +++ b/third_party/tailcat/derpwebsocket.go @@ -0,0 +1,12 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +package tailcat + +// Some sandboxes, such as ChatGPT Work's, reach the internet only through +// an HTTP proxy that intercepts TLS and refuses DERP's "Upgrade: DERP" +// request but allows WebSocket upgrades. This package makes DERP clients +// that get refused retry by speaking DERP inside WebSockets, as browsers +// do. See https://github.com/tailscale/tailscale/issues/22412. +// (On js/wasm, where DERP clients always use WebSockets, it does nothing.) +import _ "tailscale.com/feature/derpwebsocket" diff --git a/third_party/tailcat/derpwebsocket_test.go b/third_party/tailcat/derpwebsocket_test.go new file mode 100644 index 0000000..4b2906f --- /dev/null +++ b/third_party/tailcat/derpwebsocket_test.go @@ -0,0 +1,96 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +package tailcat + +import ( + "context" + "crypto/tls" + "io" + "net" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" + + "tailscale.com/derp/derpserver" + "tailscale.com/net/stun/stuntest" + "tailscale.com/tailcfg" + "tailscale.com/types/key" + "tailscale.com/types/logger" + "tailscale.com/types/nettype" +) + +// TestDERPWebsocketFallback checks that a Server and Client get through a +// DERP server that, like some HTTP proxies, refuses the usual "Upgrade: DERP" +// request and only allows WebSocket upgrades. +func TestDERPWebsocketFallback(t *testing.T) { + t.Parallel() + + logf := mkLogger(t, "derp") + d := derpserver.New(key.NewNode(), logf) + t.Cleanup(func() { d.Close() }) + noDERPUpgrade := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if strings.EqualFold(r.Header.Get("Upgrade"), "derp") { + http.Error(w, "DERP upgrade blocked", http.StatusForbidden) + return + } + derpserver.Handler(d).ServeHTTP(w, r) + }) + httpsrv := httptest.NewUnstartedServer(derpserver.AddWebSocketSupport(d, noDERPUpgrade)) + httpsrv.Config.ErrorLog = logger.StdLogger(logf) + httpsrv.Config.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler)) + httpsrv.StartTLS() + t.Cleanup(httpsrv.Close) + + stunAddr, stunCleanup := stuntest.ServeWithPacketListener(t, nettype.Std{}) + t.Cleanup(stunCleanup) + + reg := &tailcfg.DERPRegion{ + RegionID: 1, + RegionCode: "test", + Nodes: []*tailcfg.DERPNode{{ + Name: "t1", + RegionID: 1, + HostName: "127.0.0.1", + IPv4: "127.0.0.1", + IPv6: "none", + STUNPort: stunAddr.Port, + DERPPort: httpsrv.Listener.Addr().(*net.TCPAddr).Port, + InsecureForTests: true, + STUNTestIP: "127.0.0.1", + }}, + } + + s := &Server{Key: key.NewNode(), Logf: mkLogger(t, "server"), Region: reg} + t.Cleanup(func() { s.Close() }) + s.OnTCP = func(port uint16) (handler func(net.Conn)) { + return func(c net.Conn) { + io.WriteString(c, "Hello over WebSockets\n") + c.Close() + } + } + if err := s.Start(); err != nil { + t.Fatalf("server Start: %v", err) + } + + c := &Client{Server: s.TailcatAddr(), Logf: mkLogger(t, "client")} + t.Cleanup(func() { c.Close() }) + PingForTest(t, s, c) + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + conn, err := c.DialTCPPort(ctx, 80) + if err != nil { + t.Fatalf("DialTCPPort: %v", err) + } + defer conn.Close() + got, err := io.ReadAll(conn) + if err != nil { + t.Fatalf("ReadAll: %v", err) + } + if want := "Hello over WebSockets\n"; string(got) != want { + t.Errorf("got %q; want %q", got, want) + } +} diff --git a/third_party/tailcat/disco.go b/third_party/tailcat/disco.go index 28d5d3a..82f6b5f 100644 --- a/third_party/tailcat/disco.go +++ b/third_party/tailcat/disco.go @@ -68,3 +68,33 @@ func ParseMeowPing(pkt []byte) (nodeKey key.NodePublic, discoKey key.DiscoPublic func IsMeowedPacket(pkt []byte) bool { return len(pkt) >= 5 && [4]byte(pkt[:4]) == meowMagic && pkt[4] == meowTypePong } + +// meowInstanceLen is the length of the optional instance ID that follows +// the keys in a meow ping. +const meowInstanceLen = 8 + +// meowInstanceID identifies one [Client] value, and so one client process. +// Clients send it after the keys in every meow ping. The server compares it +// with the instance ID it saw last for the same node key, so it can tell a +// restarted client from a retried meow even though the disco key, which is +// derived from the node key, stays the same. The zero value means that the +// client didn't send one, as clients older than v0.9.0 don't. +type meowInstanceID [meowInstanceLen]byte + +// appendMeowInstance appends id to a meow ping from [EncodeMeowPing]. +// Servers older than v0.9.0 ignore it, because [ParseMeowPing] ignores +// trailing bytes. +func appendMeowInstance(pkt []byte, id meowInstanceID) []byte { + return append(pkt, id[:]...) +} + +// parseMeowInstance returns the instance ID in a meow ping that +// [ParseMeowPing] accepted, or the zero value if it has none. +func parseMeowInstance(pkt []byte) meowInstanceID { + const off = 4 + 1 + key.NodePublicRawLen + key.DiscoPublicRawLen + var id meowInstanceID + if len(pkt) >= off+meowInstanceLen { + copy(id[:], pkt[off:]) + } + return id +} diff --git a/third_party/tailcat/disco_test.go b/third_party/tailcat/disco_test.go new file mode 100644 index 0000000..641fd19 --- /dev/null +++ b/third_party/tailcat/disco_test.go @@ -0,0 +1,38 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +package tailcat + +import ( + "testing" + + "tailscale.com/types/key" +) + +// TestMeowInstance checks the optional instance ID after the keys in a +// meow ping, including that a ping without one, from a client older than +// v0.9.0, reads as the zero ID. +func TestMeowInstance(t *testing.T) { + nodeKey := key.NewNode().Public() + discoKey := key.NewDisco().Public() + old := EncodeMeowPing(nodeKey, discoKey) + if got := parseMeowInstance(old); got != (meowInstanceID{}) { + t.Errorf("instance ID of a ping without one = %x; want zero", got) + } + + id := meowInstanceID{1, 2, 3, 4, 5, 6, 7, 8} + pkt := appendMeowInstance(EncodeMeowPing(nodeKey, discoKey), id) + if got := parseMeowInstance(pkt); got != id { + t.Errorf("instance ID = %x; want %x", got, id) + } + // ParseMeowPing, as in servers older than v0.9.0, must still accept + // the longer ping. + gotNode, gotDisco, ok := ParseMeowPing(pkt) + if !ok || gotNode != nodeKey || gotDisco != discoKey { + t.Errorf("ParseMeowPing of a ping with an instance ID = %v, %v, %v", gotNode, gotDisco, ok) + } + // A truncated instance ID reads as none. + if got := parseMeowInstance(pkt[:len(pkt)-1]); got != (meowInstanceID{}) { + t.Errorf("instance ID of a truncated ping = %x; want zero", got) + } +} diff --git a/third_party/tailcat/export_test.go b/third_party/tailcat/export_test.go index 7a3ab3b..c54ff9b 100644 --- a/third_party/tailcat/export_test.go +++ b/third_party/tailcat/export_test.go @@ -31,6 +31,20 @@ func WaitForDERPForTest(t testing.TB, s *Server, c *Client) { } } +// MeowForTest sets up c's network stack without going on the network and +// hands its meow straight to s, as if it had arrived over DERP. A test can +// then check how s took the client before c advertises any endpoints. +func MeowForTest(t testing.TB, s *Server, c *Client) { + t.Helper() + c.startMu.Lock() + err := c.initLocked() + c.startMu.Unlock() + if err != nil { + t.Fatalf("initializing client: %v", err) + } + s.lb.onMeow(c.lb.pub, c.lb.discoPublic(), c.lb.meowInstance) +} + // PingForTest waits for the client's DERP connection and performs the // meow/meowed handshake. func PingForTest(t testing.TB, s *Server, c *Client) PingResult { diff --git a/third_party/tailcat/go.mod b/third_party/tailcat/go.mod index 294e53b..96df2db 100644 --- a/third_party/tailcat/go.mod +++ b/third_party/tailcat/go.mod @@ -4,11 +4,12 @@ go 1.27.4 require ( github.com/fxamacker/cbor/v2 v2.9.6 - github.com/tailscale/wireguard-go v0.0.0-20260928213353-e61b6b78110b + github.com/google/go-cmp v0.7.0 + github.com/tailscale/wireguard-go v0.0.0-20261125191149-d74d4ff62061 go4.org/mem v0.0.0-20240501181205-ae6ca9944745 go4.org/netipx v0.0.0-20260823151212-3075585bcbeb - gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72 - tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5 + gvisor.dev/gvisor v0.0.0-20261129202619-2c60c87d5cf0 + tailscale.com v1.107.0-pre.0.20261201224323-cd4f62139953 ) require ( @@ -18,21 +19,21 @@ require ( github.com/akutz/memconn v0.1.0 // indirect github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect - github.com/aws/aws-sdk-go-v2 v1.46.0 // indirect - github.com/aws/aws-sdk-go-v2/config v1.33.3 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.20.3 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2 // indirect - github.com/aws/aws-sdk-go-v2/service/signin v1.9.0 // indirect + github.com/aws/aws-sdk-go-v2 v1.47.3 // indirect + github.com/aws/aws-sdk-go-v2/config v1.33.9 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.20.9 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.3 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.6 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.6 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.6 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.21 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.6 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.10.4 // indirect github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.37.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.49.0 // indirect - github.com/aws/smithy-go v1.28.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.38.4 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.51.4 // indirect + github.com/aws/smithy-go v1.28.5 // indirect github.com/axiomhq/hyperloglog v0.3.0 // indirect github.com/benbjohnson/immutable v0.4.3 // indirect github.com/bradfitz/reco v0.0.0-20260929154613-b883fbd17e3f // indirect @@ -48,22 +49,20 @@ require ( github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9 // indirect - github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737 // indirect + github.com/go4org/plan9netshell v0.0.0-20261130214832-f7dfc18b3ab6 // indirect github.com/godbus/dbus/v5 v5.2.2 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/go-cmp v0.7.0 // indirect github.com/google/go-tpm v0.9.8 // indirect github.com/google/nftables v0.3.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/huin/goupnp v1.3.0 // indirect - github.com/illarion/gonotify/v3 v3.0.2 // indirect github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae // indirect github.com/jellydator/ttlcache/v3 v3.4.1 // indirect github.com/jsimonetti/rtnetlink v1.4.2 // indirect github.com/kamstrup/intmap v0.5.2 // indirect - github.com/klauspost/compress v1.20.1 // indirect + github.com/klauspost/compress v1.20.2 // indirect github.com/kortschak/wol v0.0.0-20200729010619-da482cc4850a // indirect github.com/kr/fs v0.1.0 // indirect github.com/mdlayher/genetlink v1.4.0 // indirect @@ -73,10 +72,10 @@ require ( github.com/mitchellh/go-ps v1.0.0 // indirect github.com/pierrec/lz4/v4 v4.1.26 // indirect github.com/pires/go-proxyproto v0.15.0 // indirect - github.com/pkg/sftp v1.13.11 // indirect + github.com/pkg/sftp v1.13.13 // indirect github.com/safchain/ethtool v0.7.0 // indirect github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d // indirect - github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28 // indirect + github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a // indirect github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 // indirect github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f // indirect github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7 // indirect @@ -88,17 +87,17 @@ require ( github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect github.com/vishvananda/netns v0.0.5 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/crypto v0.57.0 // indirect + golang.org/x/crypto v0.59.0 // indirect golang.org/x/exp v0.0.0-20261007192929-f45ad48fbe92 // indirect golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f // indirect - golang.org/x/mod v0.41.0 // indirect - golang.org/x/net v0.60.0 // indirect - golang.org/x/sync v0.23.0 // indirect - golang.org/x/sys v0.48.0 // indirect - golang.org/x/term v0.46.0 // indirect - golang.org/x/text v0.42.0 // indirect + golang.org/x/mod v0.43.0 // indirect + golang.org/x/net v0.62.0 // indirect + golang.org/x/sync v0.25.0 // indirect + golang.org/x/sys v0.50.0 // indirect + golang.org/x/term v0.48.0 // indirect + golang.org/x/text v0.44.0 // indirect golang.org/x/time v0.16.0 // indirect - golang.org/x/tools v0.51.0 // indirect + golang.org/x/tools v0.52.0 // indirect golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect golang.zx2c4.com/wireguard/windows v1.1.1 // indirect honnef.co/go/tools v0.8.1 // indirect diff --git a/third_party/tailcat/go.sum b/third_party/tailcat/go.sum index f6ca27d..500f6c8 100644 --- a/third_party/tailcat/go.sum +++ b/third_party/tailcat/go.sum @@ -12,36 +12,36 @@ github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e h1:4dAU9FXIyQktp github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= -github.com/aws/aws-sdk-go-v2 v1.46.0 h1:1kt7m/EKcEHt5mlyyxx9cSlMddRPIKbjb6DIQsu4HPk= -github.com/aws/aws-sdk-go-v2 v1.46.0/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU= -github.com/aws/aws-sdk-go-v2/config v1.33.3 h1:h090b3O5S17bF87/0ysHZuIT/7DCb4EBRFQX2PMVPCw= -github.com/aws/aws-sdk-go-v2/config v1.33.3/go.mod h1:YYDB1kTejxbfAbEVUqgCtkVp26xvNCHev9cLKABMGAk= -github.com/aws/aws-sdk-go-v2/credentials v1.20.3 h1:tToOYM/LXev4NpfWlIYGDvBvjHmJ3HXpRU9ppl+pM6k= -github.com/aws/aws-sdk-go-v2/credentials v1.20.3/go.mod h1:wfGneWyncO7p67wqXV2IQhPk14JqIc25woKlaArT3WI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2 h1:Ldv7RPHs7qwwTscRjAl3YBud32f3BvdAGRmSvAx5L38= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2/go.mod h1:XyK6UV8xbo66ysVqLd2783C09pBYHOm8aKTRV5DVJ30= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2 h1:q/PSLGuRWCChWg+dLnb9dWOnrCxJtnboXbBtFoqqRrI= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2/go.mod h1:TD1jvU2LvXkJexct5vBqcd8QlNXh5EmRUeL/Z32p0n4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2 h1:6fl86IPqKEXoySqiOWdfgbEp9OVbn44zTfEICNEBDhY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2/go.mod h1:63HDfhFkdzBpI8WGXTSKUHPKS6mqldj4u3LJW7RZtSU= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2 h1:XMgIRS+uW9F3yFKnXGRrI9pkHi99CXTmoz2kz2/TGBA= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2/go.mod h1:vorxDzK+n3jiv9a5ST/LG0Eu9cSv1CRdKTpG6pDMs+M= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 h1:bAdDl/HkGCcGPoe25ToSHEw23VIxt6CT5fLcg111BKg= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19/go.mod h1:KaUzbLxv4CeSxh6ZCl9B4m7CuFenS8kUEaDs+f/DQr4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2 h1:ZtHYnumr6QyxhzEzNZwzQTFJEXOswrZqTTkRxthwvr4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2/go.mod h1:a1NXrYpBd311gBzn1UI5UzJyyvXktM4xNh/ydPiPpqY= -github.com/aws/aws-sdk-go-v2/service/signin v1.9.0 h1:c3k+k/CS4L+sAIH6fxikL+g5g2LpeNczaoyjjw1iMKI= -github.com/aws/aws-sdk-go-v2/service/signin v1.9.0/go.mod h1:AGIoQg99fBrOIQnF78TLx4lj18mc4gZ0hJx1UaLIFM4= +github.com/aws/aws-sdk-go-v2 v1.47.3 h1:HRoT/MkNi3bjO5xF4dCzLzvVmkvRGHj3/cLINDnJejk= +github.com/aws/aws-sdk-go-v2 v1.47.3/go.mod h1:xSl+OSI5ZUw6bSMupWc218zE5Pl+65MCCu3ySWFY99A= +github.com/aws/aws-sdk-go-v2/config v1.33.9 h1:Hv6bcQUJVnmuWaKjqD6Ot8sE75NrWsWV20oGT5aWle0= +github.com/aws/aws-sdk-go-v2/config v1.33.9/go.mod h1:ivowmrZNfBQLcg4QkaItgi5wae4Bzot9RzIdbY1hfTg= +github.com/aws/aws-sdk-go-v2/credentials v1.20.9 h1:SNO55PnWhaDafsOcv16lCA0kdoFMl/YlegWoVsU02s0= +github.com/aws/aws-sdk-go-v2/credentials v1.20.9/go.mod h1:+2reOTRtdD3VSBqpRDNwrZIYy8yMCYa7oK3WKTJ/I1I= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.3 h1:gr3b87OLB29jymWPzp/CAyXwQRJVE+sC4Wm0qBIKHsk= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.3/go.mod h1:BRjf4L/Yx2hY54o+ZibPbLJyMMeSwqYQXwcJfqW66a8= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.6 h1:CqL8NN3p4I0JTwwV5MEoatIl4Y2amZ2X9dRD+0hbRL0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.6/go.mod h1:exdJ32hMqXl0Wyo6NwqEC5yIhtua3+PDaKE8P29m4qE= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.6 h1:FpBq24TG6WVSObTNhQOv7Q0088rounUUlwn3zlNItkM= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.6/go.mod h1:ONzdPVYC95oBOu0VWNEsKEntcoemP3xVKjT+qWml1s4= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.6 h1:Qmn60RWuk9+bd2ddvJJqwf3Cpac3VvGMOdbGemtUhX4= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.6/go.mod h1:h/YJhe4AVyQxEUMluph10iqV7mjajH7A9L+BHF5ppis= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.21 h1:e6YW5uME30TkrElR+4/xcY7NB6CCj2dcv7vtmGXhfhQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.21/go.mod h1:obpHAMP693+f3/A8PkLhIqfK1C+NWWn8zXzqD3OH520= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.6 h1:LHHdobjo5le1sjJdolitV7uVvYg3wkaeM1Ju2fDgeZQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.6/go.mod h1:CBGB0evAiaMD3Lk4wPO7LQCcCZLuhzL5Qf/wfEUHQ5w= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.4 h1:tvpDjuUvgKURf3Yk4hOaGbZ4QdY+070OWcA5d6LUv2A= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.4/go.mod h1:3ibVKg5Ng82Zby8++jELTD2nHxiPk2DJRLEeW/LKp8M= github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0 h1:JqKSBJlS68F4nxoPLwD7tB3lJ3gWEK9p+7eOiBE/lsM= github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0/go.mod h1:5TMMHmQGjCODMeIopSNfxkan11jG0SmFpyjcMvCLzHA= -github.com/aws/aws-sdk-go-v2/service/sso v1.37.0 h1:+rqBaOq7jzInjY8M12hr+zEe85JpRll9BjMx38r33Ok= -github.com/aws/aws-sdk-go-v2/service/sso v1.37.0/go.mod h1:XFlVwUsw3sYh8Hw37umYVJnrcWrwXWRxbNw/JY0bblw= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0 h1:hzM3GslEAOBcLn3DHH6ENToFi+vXP+n02W+x6zejAIM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0/go.mod h1:588e7skMkYIYkSUseT8E3WKFfbAfrA1bj3Zf+qxJtJY= -github.com/aws/aws-sdk-go-v2/service/sts v1.49.0 h1:N7Ey8obY3uSui+cxl0OUzFlFmkxSucoJnrniFhw+cLc= -github.com/aws/aws-sdk-go-v2/service/sts v1.49.0/go.mod h1:zMBwjSf4Pt8a1OHYiZ5rPD0PJRK1kQrUaxhS/Dbld8E= -github.com/aws/smithy-go v1.28.1 h1:R/nXH00c8qcfCzQVELtRw+eLQWtzv+VAIEFJ1/xxXlQ= -github.com/aws/smithy-go v1.28.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.4 h1:ChCtagixSFOxltv0o6E3NT8F7ksvZtZGPwUBynO5Nmk= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.4/go.mod h1:+FEO9jrVMpc9oN3CdAxJbtlQEu3z8UddDPSedpeM3PY= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.4 h1:j6c+HA4AoS0EBEjArPjavFEBrucJEryfrQU0TffmACk= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.4/go.mod h1:RhghaXUk9q66VtOQUX1FdPddQuHnqQZzbB0fEYXmPRA= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.4 h1:OKEfbf2tcfsF2pBk/S9QqNpo6alaAtiBs4hysCsBjPw= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.4/go.mod h1:mCd6qGo9b8hTtfjgsmNkFlzwjyce4owd7HDVFnCLXhM= +github.com/aws/smithy-go v1.28.5 h1:OqbqKtzY9NUnr2yAe9+hiTdFb20tNaK/lI0PMOGXX9k= +github.com/aws/smithy-go v1.28.5/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/axiomhq/hyperloglog v0.3.0 h1:IQzzb1zjZiODMwCgBRHKak4oIp2Oj7K0Q0rVoAoFVuM= github.com/axiomhq/hyperloglog v0.3.0/go.mod h1:YjX/dQqCR/7QYX0g8mu8UZAjpIenz1FKM71UEsjFoTo= github.com/benbjohnson/immutable v0.4.3 h1:GYHcksoJ9K6HyAUpGxwZURrbTkXA0Dh4otXGqbhdrjA= @@ -88,8 +88,8 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9 h1:J8S+Ms89nvHX1F9Ma2m3KhdTl41ZhbFKMyAJqvDA+iE= github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9/go.mod h1:OGmRfY/9QEK2P5zCRtmqfbCF283xPkU2dvVA4MvbvpI= -github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737 h1:cf60tHxREO3g1nroKr2osU3JWZsJzkfi7rEg+oAB0Lo= -github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737/go.mod h1:MIS0jDzbU/vuM9MC4YnBITCv+RYuTRq8dJzmCrFsK9g= +github.com/go4org/plan9netshell v0.0.0-20261130214832-f7dfc18b3ab6 h1:CMyTWglRVWGWh9q2kNEm84/DewiLMsMQtcMmOjxbS0Q= +github.com/go4org/plan9netshell v0.0.0-20261130214832-f7dfc18b3ab6/go.mod h1:MIS0jDzbU/vuM9MC4YnBITCv+RYuTRq8dJzmCrFsK9g= github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= @@ -112,8 +112,6 @@ github.com/hugelgupf/vmtest v0.0.0-20240307030256-5d9f3d34a58d h1:nP8SfQJqruIVSW github.com/hugelgupf/vmtest v0.0.0-20240307030256-5d9f3d34a58d/go.mod h1:B63hDJMhTupLWCHwopAyEo7wRFowx9kOc8m8j1sfOqE= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/illarion/gonotify/v3 v3.0.2 h1:O7S6vcopHexutmpObkeWsnzMJt/r1hONIEogeVNmJMk= -github.com/illarion/gonotify/v3 v3.0.2/go.mod h1:HWGPdPe817GfvY3w7cx6zkbzNZfi3QjcBm/wgVvEL1U= github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae h1:nXGg65fXsylSUTNNWwvHuQsXev7mhIzQTnZREPTbWzs= github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae/go.mod h1:tGfUTcnFYGYvVNCaZZhwlJySU/fQQxh9TmpsFzWXnnY= github.com/jellydator/ttlcache/v3 v3.4.1 h1:bOdXmXiycyK6E6Qjyuj5vl+/vU3SCOoDs8a86NbHjAQ= @@ -124,8 +122,8 @@ github.com/kamstrup/intmap v0.5.2 h1:qnwBm1mh4XAnW9W9Ue9tZtTff8pS6+s6iKF6JRIV2Dk github.com/kamstrup/intmap v0.5.2/go.mod h1:gWUVWHKzWj8xpJVFf5GC0O26bWmv3GqdnIX/LMT6Aq4= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= -github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/compress v1.20.2 h1:v5tiZvm1KGLyg5d5oXdXe3lsSPrbEUiKoXGia//I7Qo= +github.com/klauspost/compress v1.20.2/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/kortschak/wol v0.0.0-20200729010619-da482cc4850a h1:+RR6SqnTkDLWyICxS1xpjCi/3dhyV+TgZwA6Ww3KncQ= github.com/kortschak/wol v0.0.0-20200729010619-da482cc4850a/go.mod h1:YTtCCM3ryyfiu4F7t8HQ1mxvp1UBdWM2r6Xa+nGWvDk= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= @@ -154,8 +152,8 @@ github.com/pierrec/lz4/v4 v4.1.26 h1:GrpZw1gZttORinvzBdXPUXATeqlJjqUG/D87TKMnhjY github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= github.com/pires/go-proxyproto v0.15.0 h1:dTshmNbFm/D+0+sbrxUuddPOZ5Y0B7c5NhtsBkm6LqI= github.com/pires/go-proxyproto v0.15.0/go.mod h1:OXsCrKwrK2tXS9YrI5tkHx5xaQlO8FH3lFW76orFh24= -github.com/pkg/sftp v1.13.11 h1:0N92SLTB8JqASJB14ZLHHzFnBV8mG9zw4K7jghEFWuE= -github.com/pkg/sftp v1.13.11/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0= +github.com/pkg/sftp v1.13.13 h1:lfbNTnT3zEilT8XxmwBBb5sdqJJBTunll5OVNCZPwrs= +github.com/pkg/sftp v1.13.13/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= github.com/prometheus/common v0.71.0 h1:9KDAKb7Mj3HEVKyFCK6Dc/HIwlBzZIN2l7/lrHl3KK8= @@ -170,8 +168,8 @@ github.com/studio-b12/gowebdav v0.13.0 h1:OcwSg6IQHOFNdYHn3bPOHwSE8looG8N56Y5xTT github.com/studio-b12/gowebdav v0.13.0/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE= github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d h1:JcGKBZAL7ePLwOhUdN8qGQZlP5GueEiIZwY7R62pejE= github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d/go.mod h1:XrBNfAFN+pwoWuksbFS9Ccxnopa15zJGgXRFN90l3K4= -github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28 h1:Azz5ILxxVsHN/KjIu3wkJPAmmtiijucZw4Ax5Ye8n+s= -github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28/go.mod h1:wn16Km1EZOX4UEAyaZa3dBwfFGOJ7neck40NcwosJUw= +github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a h1:LQfS++EBVN2Bk9/FbFjJmdP/CsebU0OupOX58tO4p04= +github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a/go.mod h1:wn16Km1EZOX4UEAyaZa3dBwfFGOJ7neck40NcwosJUw= github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 h1:Gzfnfk2TWrk8Jj4P4c1a3CtQyMaTVCznlkLZI++hok4= github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55/go.mod h1:4k4QO+dQ3R5FofL+SanAUZe+/QfeK0+OIuwDIRu2vSg= github.com/tailscale/golang-x-crypto v0.0.0-20260720160339-c86ca1284b96 h1:m9EAsCu/afUkg9YkknXaRqMPl/omkUNRol5yB7hbG0Y= @@ -186,8 +184,8 @@ github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea h1:a github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea/go.mod h1:agQPE6y6ldqCOui2gkIh7ZMztTkIQKH049tv8siLuNQ= github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6 h1:l10Gi6w9jxvinoiq15g8OToDdASBni4CyJOdHY1Hr8M= github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6/go.mod h1:ZXRML051h7o4OcI0d3AaILDIad/Xw0IkXaHM17dic1Y= -github.com/tailscale/wireguard-go v0.0.0-20260928213353-e61b6b78110b h1:roJhpZBsUsZayIDsfSSrgGKUNJjOPXXs1Ul/C/z7C0g= -github.com/tailscale/wireguard-go v0.0.0-20260928213353-e61b6b78110b/go.mod h1:rUelGmuK4UnSJYM5gl5Mknp6YbwwcL8+VAPMhNYe+jg= +github.com/tailscale/wireguard-go v0.0.0-20261125191149-d74d4ff62061 h1:wwKhjUjxTN7Xp9tEJb3I/O0CspKEPkDXy9Aje08A/gY= +github.com/tailscale/wireguard-go v0.0.0-20261125191149-d74d4ff62061/go.mod h1:Hl7pyu83xNjc1LY5e9apq2mWm8Hl76wRtJbwZ2XISqY= github.com/tailscale/xnet v0.0.0-20240729143630-8497ac4dab2e h1:zOGKqN5D5hHhiYUp091JqK7DPCqSARyUfduhGUY8Bek= github.com/tailscale/xnet v0.0.0-20240729143630-8497ac4dab2e/go.mod h1:orPd6JZXXRyuDusYilywte7k094d7dycXXU5YnWsrwg= github.com/tc-hib/winres v0.3.1 h1:CwRjEGrKdbi5CvZ4ID+iyVhgyfatxFoizjPhzez9Io4= @@ -211,35 +209,35 @@ go4.org/mem v0.0.0-20240501181205-ae6ca9944745 h1:Tl++JLUCe4sxGu8cTpDzRLd3tN7US4 go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g= go4.org/netipx v0.0.0-20260823151212-3075585bcbeb h1:XBM4hvfwGAttkkiTIFfeigdfcL1xIfdKXqFdgiHGtDs= go4.org/netipx v0.0.0-20260823151212-3075585bcbeb/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= +golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= golang.org/x/exp v0.0.0-20261007192929-f45ad48fbe92 h1:kc+Gi2MFkd0KWtdDlVxVwjw4KB98/77usJDFj+6YFQ8= golang.org/x/exp v0.0.0-20261007192929-f45ad48fbe92/go.mod h1:SRjTzy5WcYqRRqquLUvHeeovSwLO0CZ3xcltZNO4Fck= golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f h1:+lI8cDJ4uceLipg2f1ODay7fEuLkk0BIHXd6PB8icxo= golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f/go.mod h1:PqrXSW65cXDZH0k4IeUbhmg/bcAZDbzNz3byBpKCsXo= golang.org/x/image v0.46.0 h1:b1+oYj0Jbp6K5MDT4i4/eZpYlk3V8SJhhDKh6LBHAyQ= golang.org/x/image v0.46.0/go.mod h1:3B3W05VGVQyuXucLINLjXKrqISASfi4Xj+iCVkLMwew= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= +golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= -golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/term v0.48.0 h1:G6UU1eiSB8nl3DzeUGt7Mg+2SctI8tPS6Z5/mBt6cOk= +golang.org/x/term v0.48.0/go.mod h1:BRDLHCZr2SUjIeBHHpRyQeC9xzSAVbzY2rvKgafnHf4= +golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo= +golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY= golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= -golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= -golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg= @@ -250,13 +248,13 @@ golang.zx2c4.com/wireguard/windows v1.1.1 h1:8/H97U1v1PNDNcBsMZgU3KFuND9MQdTsU2N golang.zx2c4.com/wireguard/windows v1.1.1/go.mod h1:+fbT3FFdX4zzYDLwJh5+HPEcNN/3HyNdzhNSVsQM+zs= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72 h1:EytKYr5WrVs+Aah/0xDO8ZAZZzS/iTEVC8ln4ipDbL0= -gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72/go.mod h1:8aLQqUBHDH8fY5y60lzmwDpMMbQCcT3EBfoSwhfaGCY= +gvisor.dev/gvisor v0.0.0-20261129202619-2c60c87d5cf0 h1:4/UU5xawrGIa4pgw1HqA62zG+KCZAj4FLKMkngP2aIU= +gvisor.dev/gvisor v0.0.0-20261129202619-2c60c87d5cf0/go.mod h1:AGCFHJ8yer01MsPbOE1JJtEOoLx79kr4ranU2wAm67k= honnef.co/go/tools v0.8.1 h1:+JKf3xJ1ni4CwrhVg4/pqsfPGP6vNAXcKbMXJodYx3w= honnef.co/go/tools v0.8.1/go.mod h1:XA+OnlRA9EDh/ukGvXMNSZNKGwFQJ+5dER0ioUkOxks= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= software.sslmate.com/src/go-pkcs12 v0.7.3 h1:JBQD3FDqYjTeyDAeZQklj2ar88ykBLtALloPJHyAauU= software.sslmate.com/src/go-pkcs12 v0.7.3/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI= -tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5 h1:LDOp01qRD9ZWKk3BOKTM6nHdmMtWo+sz7Q+j6au9YBU= -tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5/go.mod h1:cwBO6r4TAtlbDIdnDFJZeJ20bSBW10lbKm/dyLC73Ic= +tailscale.com v1.107.0-pre.0.20261201224323-cd4f62139953 h1:tdv9m40ehE2Dqu+TqLsf/DyMW239ZbBwKnxIxsebphQ= +tailscale.com v1.107.0-pre.0.20261201224323-cd4f62139953/go.mod h1:5jqflrhAgMwdzJz8PHB0Iltk2BfhvRcH16esoXSyw/0= diff --git a/third_party/tailcat/pickregion.go b/third_party/tailcat/pickregion.go index 1a954d9..04fb74d 100644 --- a/third_party/tailcat/pickregion.go +++ b/third_party/tailcat/pickregion.go @@ -39,11 +39,17 @@ func PickBestRegion(ctx context.Context, dm *tailcfg.DERPMap) (regionID tailcfg. if Verbose { nc.Logf = log.Printf } - if err := nc.Standalone(ctx, ":0"); err != nil { + // Standalone's STUN sockets and their reader goroutines live + // until the context it's given is done. Callers' contexts often + // outlive this call (some are context.Background), so give it one + // that ends when we return. + probeCtx, cancel := context.WithCancel(ctx) + defer cancel() + if err := nc.Standalone(probeCtx, ":0"); err != nil { return 0, fmt.Errorf("netcheck.Standalone: %w", err) } t0 := time.Now() - nr, err := nc.GetReport(ctx, dm, &netcheck.GetReportOpts{}) + nr, err := nc.GetReport(probeCtx, dm, &netcheck.GetReportOpts{}) if err != nil { return 0, fmt.Errorf("failed to get netcheck report: %w", err) } diff --git a/third_party/tailcat/pickregion_test.go b/third_party/tailcat/pickregion_test.go new file mode 100644 index 0000000..611332e --- /dev/null +++ b/third_party/tailcat/pickregion_test.go @@ -0,0 +1,56 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +//go:build !js + +package tailcat + +import ( + "context" + "testing" + "testing/synctest" + + "tailscale.com/net/stun/stuntest" + "tailscale.com/tailcfg" + "tailscale.com/types/nettype" +) + +// TestPickBestRegionClosesSockets checks that PickBestRegion doesn't +// leave its netcheck STUN sockets open after it returns, even when +// the caller's context never ends. Previously they stayed open (with +// a goroutine each) for the life of the caller's context, which for +// "tailcat serve" was the life of the process. +func TestPickBestRegionClosesSockets(t *testing.T) { + stunAddr, stunCleanup := stuntest.ServeWithPacketListener(t, nettype.Std{}) + t.Cleanup(stunCleanup) + + dm := &tailcfg.DERPMap{ + Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{ + 1: { + RegionID: 1, + RegionCode: "test", + Nodes: []*tailcfg.DERPNode{{ + Name: "t1", + RegionID: 1, + HostName: "127.0.0.1", + IPv4: "127.0.0.1", + IPv6: "none", + STUNPort: stunAddr.Port, + STUNTestIP: "127.0.0.1", + }}, + }, + }, + } + + // synctest.Test fails if any goroutine started in the bubble + // outlives it, which catches leaked STUN reader goroutines. + synctest.Test(t, func(t *testing.T) { + got, err := PickBestRegion(context.Background(), dm) + if err != nil { + t.Fatalf("PickBestRegion: %v", err) + } + if got != 1 { + t.Errorf("PickBestRegion = %v; want 1", got) + } + }) +} diff --git a/third_party/tailcat/quantumcat.go b/third_party/tailcat/quantumcat.go index 5e7cad7..11b10a0 100644 --- a/third_party/tailcat/quantumcat.go +++ b/third_party/tailcat/quantumcat.go @@ -67,7 +67,7 @@ func (c *Client) Probe(ctx context.Context) error { func (c *Client) Status() *ipnstate.Status { c.startMu.Lock() defer c.startMu.Unlock() - if c.lb == nil { + if c.closed || c.lb == nil { return nil } return c.lb.Status() diff --git a/third_party/tailcat/resolve_stun_test.go b/third_party/tailcat/resolve_stun_test.go new file mode 100644 index 0000000..c4b7570 --- /dev/null +++ b/third_party/tailcat/resolve_stun_test.go @@ -0,0 +1,100 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +package tailcat + +import ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + "tailscale.com/tailcfg" + "tailscale.com/types/key" +) + +// TestResolveEmbedsRelayNodes checks that resolving a short address embeds +// usable DERP relay nodes. STUN-only nodes can't relay DERP traffic and are +// dropped when the address is encoded (see wireRegionOf), so truncating the +// region's raw node list before filtering them can leave a resolved address +// with fewer than two relay nodes, or none at all, breaking the promise that +// a resolved address is self-contained and works offline. +func TestResolveEmbedsRelayNodes(t *testing.T) { + stun := func(name string) *tailcfg.DERPNode { + return &tailcfg.DERPNode{ + Name: name, + HostName: name + ".stun.example", + STUNOnly: true, + STUNPort: 3478, + } + } + relay := func(name string) *tailcfg.DERPNode { + return &tailcfg.DERPNode{ + Name: name, + HostName: name + ".derp.example", + IPv4: "192.0.2.1", + STUNPort: 3478, + DERPPort: 443, + } + } + + tests := []struct { + name string + nodes []*tailcfg.DERPNode + want []string + }{ + { + name: "stun_only_prefix", + nodes: []*tailcfg.DERPNode{stun("s1"), stun("s2"), relay("d1"), relay("d2"), relay("d3")}, + want: []string{"d1.derp.example", "d2.derp.example"}, + }, + { + name: "interleaved_stun_only", + nodes: []*tailcfg.DERPNode{relay("d1"), stun("s1"), relay("d2"), stun("s2"), relay("d3")}, + want: []string{"d1.derp.example", "d2.derp.example"}, + }, + { + name: "three_relay_nodes", + nodes: []*tailcfg.DERPNode{relay("d1"), relay("d2"), relay("d3")}, + want: []string{"d1.derp.example", "d2.derp.example"}, + }, + { + name: "single_relay_node", + nodes: []*tailcfg.DERPNode{stun("s1"), relay("d1")}, + want: []string{"d1.derp.example"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + priv := key.NewNode() + short := (&ConnInfo{ + ServerPublic: NodePublic{priv.Public()}, + ServerDiscoPublic: DiscoPublicForNode(priv), + RegionID: 1, + }).Addr() + dm := &tailcfg.DERPMap{ + Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{ + 1: {RegionID: 1, RegionCode: "tst", Nodes: tt.nodes}, + }, + } + + resolved, err := short.Resolve(context.Background(), dm) + if err != nil { + t.Fatalf("Resolve: %v", err) + } + ci, err := ParseAddr(resolved) + if err != nil { + t.Fatalf("ParseAddr(resolved): %v", err) + } + if len(ci.Region) != 1 { + t.Fatalf("resolved address has %d regions; want 1", len(ci.Region)) + } + var hosts []string + for _, n := range ci.Region[0].Nodes { + hosts = append(hosts, n.HostName) + } + if diff := cmp.Diff(tt.want, hosts); diff != "" { + t.Errorf("resolved relay nodes (-want +got):\n%s", diff) + } + }) + } +} diff --git a/third_party/tailcat/tailcat.go b/third_party/tailcat/tailcat.go index 62119e5..043cb09 100644 --- a/third_party/tailcat/tailcat.go +++ b/third_party/tailcat/tailcat.go @@ -64,6 +64,7 @@ import ( "github.com/tailscale/wireguard-go/device" go4mem "go4.org/mem" "go4.org/netipx" + "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/adapters/gonet" "gvisor.dev/gvisor/pkg/tcpip/stack" "gvisor.dev/gvisor/pkg/tcpip/transport/tcp" @@ -376,6 +377,10 @@ type locoBackend struct { eps []netip.AddrPort // our current local UDP endpoints, sorted closeOnce sync.Once closed bool // guarded by mu; rejects late legacy hook results + + // Instance IDs distinguish restarted legacy clients that reuse their node key. + clientInstance map[key.NodePublic]meowInstanceID + meowInstance meowInstanceID } const maxSessionsPerIdentity = 16 @@ -712,14 +717,7 @@ func (s *Server) startLocked(ctx context.Context) error { sys.Set(bus) sys.Set(health.NewTracker(bus)) - netMon, err := netmon.New(bus, func(format string, args ...any) { - logf(format, args...) - }) - if err != nil { - lb.Close() // closes the subsystems started so far - return fmt.Errorf("netmon.New: %w", err) - } - sys.Set(netMon) + sys.Set(newNetMon(bus, logf)) dialer := &tsdial.Dialer{Logf: logf} // mutated below (before used) sys.Set(dialer) @@ -890,12 +888,13 @@ func (s *Server) startLocked(ctx context.Context) error { return true // server ignores meowed } if _, discoPub, ok := ParseMeowPing(pkt); ok { + inst := parseMeowInstance(pkt) mc := lb.sys.MagicSock.Get() go func() { // Only reply once the client is fully added as a peer: // "meowed" is the ack that tells the client it can // start dialing. Disallowed clients get no reply. - if lb.onMeow(src, discoPub) { + if lb.onMeow(src, discoPub, inst) { mc.SendDERPPacketTo(src, regionID, EncodeMeowed()) } }() @@ -1340,9 +1339,21 @@ func (a Addr) Resolve(ctx context.Context, opts ...any) (Addr, error) { if err := ci.Expand(ctx, opts...); err != nil { return "", err } - // Keep the address short: two relay nodes suffice. + // Keep the address short: two relay nodes suffice. STUN-only nodes + // are dropped by wireRegionOf when the address is encoded, so take + // the first two usable nodes here rather than a raw prefix of the + // region's node list, which STUN-only nodes may fill. for _, r := range ci.Region { - r.Nodes = r.Nodes[:min(2, len(r.Nodes))] + var nodes []*tailcfg.DERPNode + for _, n := range r.Nodes { + if !n.STUNOnly { + nodes = append(nodes, n) + if len(nodes) == 2 { + break + } + } + } + r.Nodes = nodes } ci.RegionID = 0 return ci.Addr(), nil @@ -1626,6 +1637,25 @@ func (ci *ConnInfo) Expand(ctx context.Context, opts ...any) error { return fmt.Errorf("fetching DERPMap for region %v: %w", ci.RegionID, err) } } + // A DERP map may come from an untrusted source (a provided map or a + // fetched URL). JSON nulls decode to nil pointers, which the region + // lookups and shuffles below dereference. Work on a copy that drops + // them, leaving the caller's map untouched. + cleaned := make(map[tailcfg.DERPRegionID]*tailcfg.DERPRegion, len(dm.Regions)) + for rid, r := range dm.Regions { + if r == nil { + continue + } + c := *r + c.Nodes = nil + for _, n := range r.Nodes { + if n != nil { + c.Nodes = append(c.Nodes, n) + } + } + cleaned[rid] = &c + } + dm = &tailcfg.DERPMap{Regions: cleaned} if ci.RegionID == -1 { // Shuffle each DERP region's nodes. for _, r := range dm.Regions { @@ -1953,11 +1983,16 @@ func (lb *locoBackend) Start() error { return nil } -// onMeow handles a MeowPing from the client with node key src and -// disco key discoPub, adding it as a WireGuard peer. It reports -// whether the client is allowed and configured, meaning a "meowed" -// acknowledgment may be sent. -func (b *locoBackend) onMeow(src key.NodePublic, discoPub key.DiscoPublic) bool { +// onMeow handles a MeowPing from the client with node key src, disco +// key discoPub, and instance ID inst, adding it as a WireGuard peer. It +// reports whether the client is allowed and configured, meaning a +// "meowed" acknowledgment may be sent. +// +// A meow from a known client with a different instance ID comes from a +// new process using the same node key, such as a restarted client. The +// server then stops trusting the old process's direct path (see +// resetClientPathLocked). +func (b *locoBackend) onMeow(src key.NodePublic, discoPub key.DiscoPublic, inst meowInstanceID) bool { b.logf("got meow from %v", src.String()) b.mu.Lock() defer b.mu.Unlock() @@ -1965,6 +2000,12 @@ func (b *locoBackend) onMeow(src key.NodePublic, discoPub key.DiscoPublic) bool return false } if _, ok := b.clients[src]; ok { + if b.clientInstance[src] != inst { + b.logf("client %v restarted; resetting its path", src.ShortString()) + b.clientInstance[src] = inst + b.resetClientPathLocked(src) + go b.advertiseEndpoints() + } return true } if b.allowClient != nil { @@ -1988,6 +2029,7 @@ func (b *locoBackend) onMeow(src key.NodePublic, discoPub key.DiscoPublic) bool } } + mak.Set(&b.clientInstance, src, inst) return b.addClientLocked(src, discoPub) } @@ -2068,6 +2110,7 @@ func (b *locoBackend) removeAuthenticatedPeer(k key.NodePublic) bool { job.cancelled = true } delete(b.clients, k) + delete(b.clientInstance, k) delete(b.peerPSKs, k) delete(b.peerValid, k) delete(b.peerOwners, k) @@ -2087,6 +2130,30 @@ func (b *locoBackend) removeAuthenticatedPeer(k key.NodePublic) bool { return removed } +// resetClientPathLocked makes magicsock stop trusting the direct UDP +// path it has for the connected client k, which may lead to an earlier +// process using k. Otherwise the server would keep sending only to that +// path, including its WireGuard handshake response to the new process, +// which would then wait about 5 s for the handshake retry (see issue +// #199). Until a new direct path is confirmed, magicsock also sends +// over DERP. +// +// Magicsock does this when a peer's disco key changes, but that can't +// signal a restarted client: its disco key is derived from its node key, +// so it's the same in every process. Instead, this briefly gives +// magicsock a throwaway disco key for k and then the real one again. +// Each change resets the path in place. Removing and re-adding k +// wouldn't work, because the WireGuard peer would keep sending through +// the removed magicsock endpoint. b.mu must be held. +func (b *locoBackend) resetClientPathLocked(k key.NodePublic) { + n := b.clients[k] + mc := b.sys.MagicSock.Get() + tmp := n.Clone() + tmp.DiscoKey = key.NewDisco().Public() + mc.UpsertPeer(tmp.View()) + mc.UpsertPeer(n.View()) +} + func (b *locoBackend) Status() *ipnstate.Status { mc := b.sys.MagicSock.Get() eng := b.sys.Engine.Get() @@ -2125,8 +2192,18 @@ func tcAddrForKey(k key.NodePublic) netip.Addr { return netip.AddrFrom16(a) } +// tcpTimeWaitTimeout is how long a closed TCP connection in the +// netstack stays in TIME-WAIT, replacing gVisor's 60 second default. +// +// TIME-WAIT endpoints cost memory, and while +// one exists, gVisor's TCP forwarder drops a new SYN for the same +// 4-tuple (gvisor/gvisor#15013), stalling dials that reuse a recent +// ephemeral port. Five seconds still covers a few retransmissions of +// the peer's FIN if our final ACK is lost. +const tcpTimeWaitTimeout = 5 * time.Second + func newNetstack(logf logger.Logf, sys *tsd.System) (*netstack.Impl, error) { - return netstack.Create(logf, + ns, err := netstack.Create(logf, sys.Tun.Get(), sys.Engine.Get(), sys.MagicSock.Get(), @@ -2134,6 +2211,31 @@ func newNetstack(logf logger.Logf, sys *tsd.System) (*netstack.Impl, error) { sys.DNSManager.Get(), sys.ProxyMapper(), ) + if err != nil { + return nil, err + } + opt := tcpip.TCPTimeWaitTimeoutOption(tcpTimeWaitTimeout) + if err := ns.SetTransportProtocolOption(tcp.ProtocolNumber, &opt); err != nil { + ns.Close() + return nil, fmt.Errorf("setting TCP TIME-WAIT timeout: %v", err) + } + return ns, nil +} + +// netmonNew is netmon.New, replaced in tests. +var netmonNew = netmon.New + +// newNetMon returns a network monitor for bus. If the OS network state +// can't be monitored, such as in sandboxes without netlink access, it +// returns a static monitor instead. Tailcat's userspace network stack +// works without one; it just can't react to network changes. +func newNetMon(bus *eventbus.Bus, logf logger.Logf) *netmon.Monitor { + netMon, err := netmonNew(bus, logf) + if err != nil { + logf("can't monitor network changes, continuing without: %v", err) + return netmon.NewStatic() + } + return netMon } // createEngine creates the wgengine.Engine with userspace networking. @@ -2266,6 +2368,8 @@ func (c *Client) initLocked() error { lb.authenticated = true lb.presharedKey = PresharedKey{} c.bootstrapInbox = make(chan []byte, 16) + } else { + cryptorand.Read(lb.meowInstance[:]) } lb.logf = logf lb.dm = &tailcfg.DERPMap{} @@ -2277,14 +2381,7 @@ func (c *Client) initLocked() error { sys.Set(bus) sys.Set(health.NewTracker(bus)) - netMon, err := netmon.New(bus, func(format string, args ...any) { - logf(format, args...) - }) - if err != nil { - lb.Close() // closes the subsystems started so far - return fmt.Errorf("netmon.New: %w", err) - } - sys.Set(netMon) + sys.Set(newNetMon(bus, logf)) dialer := &tsdial.Dialer{Logf: logf} // mutated below (before used) sys.Set(dialer) @@ -2399,12 +2496,15 @@ func (c *Client) Close() error { c.renewMu.Lock() defer c.renewMu.Unlock() c.startMu.Lock() - defer c.startMu.Unlock() c.closed = true - if c.lb == nil { + lb := c.lb + // Backend teardown can take time. The closed flag prevents new work, + // and renewMu keeps renewal serialized with teardown. + c.startMu.Unlock() + if lb == nil { return nil // never used } - return c.lb.Close() + return lb.Close() } // PingResult is the result of a successful [Client.Ping] call. @@ -2528,7 +2628,7 @@ func (c *Client) ping(ctx context.Context) (PingResult, error) { dstNode := c.ci.ServerPublic.NodePublic derpRegion := c.lb.derpRegionID() - pkt := EncodeMeowPing(c.lb.pub, mc.DiscoPublicKey()) + pkt := appendMeowInstance(EncodeMeowPing(c.lb.pub, mc.DiscoPublicKey()), c.lb.meowInstance) // DERP delivery is best effort: the relay drops packets sent to a // key that isn't connected yet, so the ping (or its ack) is lost diff --git a/third_party/tailcat/tailcat_derpmap_null_test.go b/third_party/tailcat/tailcat_derpmap_null_test.go new file mode 100644 index 0000000..30fc25c --- /dev/null +++ b/third_party/tailcat/tailcat_derpmap_null_test.go @@ -0,0 +1,23 @@ +package tailcat + +import ( + "context" + "encoding/json" + "testing" + + "tailscale.com/tailcfg" +) + +func TestExpandSkipsNullDERPRegions(t *testing.T) { + var dm tailcfg.DERPMap + if err := json.Unmarshal([]byte(`{"Regions":{"1":null}}`), &dm); err != nil { + t.Fatal(err) + } + ci := &ConnInfo{RegionID: 1} + if err := ci.Expand(context.Background(), &dm); err == nil { + t.Fatal("Expand with a null region: got nil error, want rejection") + } + if dm.Regions[1] != nil { + t.Fatal("Expand modified the caller's DERP map") + } +} diff --git a/third_party/tailcat/tailcat_test.go b/third_party/tailcat/tailcat_test.go new file mode 100644 index 0000000..bed3dbc --- /dev/null +++ b/third_party/tailcat/tailcat_test.go @@ -0,0 +1,318 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +package tailcat + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "sync" + "sync/atomic" + "testing" + "time" + + "gvisor.dev/gvisor/pkg/tcpip" + "gvisor.dev/gvisor/pkg/tcpip/transport/tcp" + "tailscale.com/net/netmon" + "tailscale.com/tstest" + "tailscale.com/tstest/integration" + "tailscale.com/types/key" + "tailscale.com/types/logger" + "tailscale.com/util/eventbus" + "tailscale.com/wgengine/filter" +) + +// TestNetmonFallback checks that a Server and Client still work when the +// OS network state can't be monitored, as in sandboxes without netlink. +// +// It isn't parallel because it replaces netmonNew for the whole package. +func TestNetmonFallback(t *testing.T) { + var failed atomic.Int32 + tstest.Replace(t, &netmonNew, func(*eventbus.Bus, logger.Logf) (*netmon.Monitor, error) { + failed.Add(1) + return nil, errors.New("netlink unavailable") + }) + + dm := integration.RunDERPAndSTUN(t, mkLogger(t, "derpstun"), "127.0.0.1") + s := &Server{Key: key.NewNode(), Logf: mkLogger(t, "server"), Region: dm.Regions[1]} + t.Cleanup(func() { s.Close() }) + s.OnTCP = func(port uint16) (handler func(net.Conn)) { + return func(c net.Conn) { + io.WriteString(c, "Hello without netmon\n") + c.Close() + } + } + if err := s.Start(); err != nil { + t.Fatalf("server Start: %v", err) + } + + c := &Client{Server: s.TailcatAddr(), Logf: mkLogger(t, "client")} + t.Cleanup(func() { c.Close() }) + PingForTest(t, s, c) + if got := failed.Load(); got != 2 { + t.Errorf("netmonNew called %d times; want 2 (server and client)", got) + } + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + conn, err := c.DialTCPPort(ctx, 80) + if err != nil { + t.Fatalf("DialTCPPort: %v", err) + } + defer conn.Close() + got, err := io.ReadAll(conn) + if err != nil { + t.Fatalf("ReadAll: %v", err) + } + if want := "Hello without netmon\n"; string(got) != want { + t.Errorf("got %q; want %q", got, want) + } +} + +// TestClientRestartSameKey checks that when a client process restarts +// with the same node key, the server stops using the old process's +// direct UDP path as soon as the new process's meow arrives. The server +// used to keep that path, so its WireGuard handshake response could go +// to a dead port and the new client waited for the handshake retry, +// about 5 s. +func TestClientRestartSameKey(t *testing.T) { + t.Parallel() + + dm := integration.RunDERPAndSTUN(t, mkLogger(t, "derpstun"), "127.0.0.1") + reg := dm.Regions[1] + if reg == nil { + t.Fatal("no region 1 in derpmap") + } + + s := &Server{Key: key.NewNode(), Logf: mkLogger(t, "server"), Region: reg} + t.Cleanup(func() { s.Close() }) + s.OnTCP = func(port uint16) func(net.Conn) { + if port != 80 { + return nil + } + return func(c net.Conn) { + io.WriteString(c, "hello\n") + c.Close() + } + } + if err := s.Start(); err != nil { + t.Fatalf("server Start: %v", err) + } + + dial := func(c *Client, timeout time.Duration) (time.Duration, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + t0 := time.Now() + conn, err := c.DialTCPPort(ctx, 80) + if err != nil { + return 0, err + } + defer conn.Close() + conn.SetReadDeadline(time.Now().Add(timeout)) + got, err := io.ReadAll(conn) + if err != nil { + return 0, err + } + if string(got) != "hello\n" { + return 0, fmt.Errorf("read %q; want %q", got, "hello\n") + } + return time.Since(t0), nil + } + + nodeKey := key.NewNode() + + // serverPath reports the direct address the server uses for nodeKey, + // or "" if it sends over DERP. + serverPath := func() string { + if ps, ok := s.Status().Peer[nodeKey.Public()]; ok { + return ps.CurAddr + } + return "" + } + // waitDirect waits until c and the server both use a direct path and + // returns the server's address for c. + waitDirect := func(c *Client) string { + t.Helper() + deadline := time.Now().Add(10 * time.Second) + for { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + res, err := c.DiscoPing(ctx) + cancel() + if err == nil && res.Endpoint != "" { + if p := serverPath(); p != "" { + return p + } + } + if time.Now().After(deadline) { + t.Fatalf("no direct path both ways (last ping %+v, %v; server path %q)", res, err, serverPath()) + } + time.Sleep(100 * time.Millisecond) + } + } + + prev := &Client{Server: s.TailcatAddr(), Key: nodeKey, Logf: mkLogger(t, "client0")} + t.Cleanup(func() { prev.Close() }) + PingForTest(t, s, prev) + if _, err := dial(prev, 10*time.Second); err != nil { + t.Fatalf("client0: %v", err) + } + + // Restart twice, so the second restart replaces a client that was + // itself a restart. + for i := 1; i <= 2; i++ { + oldPath := waitDirect(prev) + + // Another meow from the same Client, like a retry or a later + // Ping, must keep the direct path. + MeowForTest(t, s, prev) + if p := serverPath(); p == "" { + t.Errorf("client%d: a repeated meow from the same Client dropped its direct path %s", i-1, oldPath) + } + + prev.Close() + // WireGuard rounds handshake timestamps down to about 16.8 ms and + // rejects one that isn't newer than the last from the same key + // as a replay. A real process restart takes longer than that. + time.Sleep(50 * time.Millisecond) + + name := fmt.Sprintf("client%d", i) + c := &Client{Server: s.TailcatAddr(), Key: nodeKey, Logf: mkLogger(t, name)} + t.Cleanup(func() { c.Close() }) + + // Hand the new process's meow to the server before the client goes + // on the network. Once it is up, the client advertises its endpoints, + // and on a fast machine the server can find the new path that way + // before the first dial, which hides the bug. Here only the meow can + // make the server drop the previous process's path. + MeowForTest(t, s, c) + if p := serverPath(); p == oldPath { + t.Errorf("%s: after the new process's meow, the server still sends to the previous process at %s", name, p) + } + + PingForTest(t, s, c) + d, err := dial(c, 10*time.Second) + if err != nil { + t.Fatalf("%s: %v", name, err) + } + t.Logf("%s dialed in %v", name, d) + prev = c + } +} + +// TestCloseWithManyTimeWaitEndpoints checks that Server.Close and +// Client.Close return promptly when the netstack holds more TCP +// endpoints in TIME-WAIT than its 512-packet outbound queue. Before +// tailscale/tailscale#21668, netstack.Impl.Close blocked forever +// there (tailscale/tailcat#151). +func TestCloseWithManyTimeWaitEndpoints(t *testing.T) { + t.Parallel() + + dm := integration.RunDERPAndSTUN(t, mkLogger(t, "derpstun"), "127.0.0.1") + reg := dm.Regions[1] + if reg == nil { + t.Fatal("no region 1 in derpmap") + } + + clientKey := key.NewNode() + s := &Server{ + Logf: mkLogger(t, "server"), + Region: reg, + AllowClient: func(k key.NodePublic) bool { return k == clientKey.Public() }, + ServedTCPPorts: []filter.PortRange{{First: 80, Last: 80}}, + OnTCP: func(port uint16) func(net.Conn) { + if port != 80 { + return nil + } + // Closing first puts the server's endpoint in TIME-WAIT. + return func(conn net.Conn) { conn.Close() } + }, + } + if err := s.Start(); err != nil { + t.Fatalf("server Start: %v", err) + } + t.Cleanup(func() { s.Close() }) + + c := &Client{Server: s.TailcatAddr(), Key: clientKey, Logf: mkLogger(t, "client")} + t.Cleanup(func() { c.Close() }) + PingForTest(t, s, c) + + st := tcpipStackOf(s.lb.ns) + var got tcpip.TCPTimeWaitTimeoutOption + if err := st.TransportProtocolOption(tcp.ProtocolNumber, &got); err != nil { + t.Fatalf("getting TIME-WAIT timeout: %v", err) + } + if time.Duration(got) != tcpTimeWaitTimeout { + t.Errorf("TIME-WAIT timeout = %v; want %v", time.Duration(got), tcpTimeWaitTimeout) + } + // Restore gVisor's default for this test so no endpoint leaves + // TIME-WAIT before Close, however slowly the dials below go. + long := tcpip.TCPTimeWaitTimeoutOption(tcp.DefaultTCPTimeWaitTimeout) + if err := s.lb.ns.SetTransportProtocolOption(tcp.ProtocolNumber, &long); err != nil { + t.Fatalf("setting TIME-WAIT timeout: %v", err) + } + + const numConns = 600 // more than netstack's 512-packet outbound queue + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + // A dial whose ephemeral port matches a server endpoint still in + // TIME-WAIT has its SYN dropped (gvisor/gvisor#15013), so bound each + // dial and retry on failure until numConns connections complete. + var completed atomic.Int64 + var wg sync.WaitGroup + for range 32 { // dial concurrency + wg.Go(func() { + for completed.Load() < numConns && ctx.Err() == nil { + dctx, dcancel := context.WithTimeout(ctx, 2*time.Second) + conn, err := c.DialTCPPort(dctx, 80) + dcancel() + if err != nil { + continue + } + // Wait for the server's FIN so the server closed first. + _, err = io.Copy(io.Discard, conn) + conn.Close() + if err == nil { + completed.Add(1) + } + } + }) + } + wg.Wait() + if n := completed.Load(); n < numConns { + t.Fatalf("completed %d connections; want %d", n, numConns) + } + + timeWait := func() (n int) { + for _, ep := range st.RegisteredEndpoints() { + if se, ok := ep.(interface{ State() uint32 }); ok && tcp.EndpointState(se.State()) == tcp.StateTimeWait { + n++ + } + } + return n + } + // The server endpoints enter TIME-WAIT once they process the + // client's FIN, which may lag the client's Close. + for timeWait() < numConns { + if ctx.Err() != nil { + t.Fatalf("got %d server endpoints in TIME-WAIT; want %d", timeWait(), numConns) + } + time.Sleep(10 * time.Millisecond) + } + + closed := make(chan error, 2) + go func() { closed <- s.Close() }() + go func() { closed <- c.Close() }() + for range 2 { + select { + case err := <-closed: + if err != nil { + t.Errorf("Close: %v", err) + } + case <-time.After(10 * time.Second): + t.Fatal("Close hung with many TCP endpoints in TIME-WAIT") + } + } +} diff --git a/third_party/tailcat/useproxy.go b/third_party/tailcat/useproxy.go new file mode 100644 index 0000000..0c90e9e --- /dev/null +++ b/third_party/tailcat/useproxy.go @@ -0,0 +1,10 @@ +// Copyright (c) Tailscale Inc & contributors +// SPDX-License-Identifier: BSD-3-Clause + +package tailcat + +// Some sandboxes, such as ChatGPT Work's, reach the internet only through +// an HTTP proxy. This package makes DERP connections use the proxy named by +// HTTPS_PROXY (or the OS proxy settings, on Windows) via HTTP CONNECT. See +// https://github.com/tailscale/tailscale/issues/22412. +import _ "tailscale.com/feature/useproxy"