Skip to content

Commit 46e097f

Browse files
committed
Enforce NoLogsNoSupport
1 parent 789a85a commit 46e097f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

envknob/envknob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ var crashOnUnexpected = RegisterOptBool("TS_DEBUG_CRASH_ON_UNEXPECTED")
456456
// NoLogsNoSupport reports whether the client's opted out of log uploads and
457457
// technical support.
458458
func NoLogsNoSupport() bool {
459-
return Bool("TS_NO_LOGS_NO_SUPPORT")
459+
return true
460460
}
461461

462462
var allowRemoteUpdate = RegisterBool("TS_ALLOW_ADMIN_CONSOLE_REMOTE_UPDATE")

logpolicy/logpolicy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ func (opts Options) init(disableLogging bool) (*logtail.Config, *Policy) {
629629
}
630630

631631
if disableLogging {
632-
opts.Logf("You have disabled logging. Tailscale will not be able to provide support.")
633-
conf.HTTPC = &http.Client{Transport: noopPretendSuccessTransport{}}
632+
opts.Logf("Tailscale logging is disabled by sing-box. Tailscale will not be able to provide support.")
633+
conf.HTTPC = &http.Client{Transport: NoopPretendSuccessTransport{}}
634634
} else {
635635
// Only attach an on-disk filch buffer if we are going to be sending logs.
636636
// No reason to persist them locally just to drop them later.
@@ -871,7 +871,7 @@ type TransportOptions struct {
871871
// to the given host name. See [DialContext] for details on how it works.
872872
func (opts TransportOptions) New() http.RoundTripper {
873873
if testenv.InTest() || envknob.NoLogsNoSupport() {
874-
return noopPretendSuccessTransport{}
874+
return NoopPretendSuccessTransport{}
875875
}
876876
if opts.NetMon == nil {
877877
opts.NetMon = netmon.NewStatic()
@@ -935,9 +935,9 @@ func goVersion() string {
935935
return v
936936
}
937937

938-
type noopPretendSuccessTransport struct{}
938+
type NoopPretendSuccessTransport struct{}
939939

940-
func (noopPretendSuccessTransport) RoundTrip(req *http.Request) (*http.Response, error) {
940+
func (NoopPretendSuccessTransport) RoundTrip(req *http.Request) (*http.Response, error) {
941941
io.Copy(io.Discard, req.Body)
942942
req.Body.Close()
943943
return &http.Response{

tsnet/tsnet.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,10 @@ func (s *Server) startLogger(closePool *closeOnErrorPool, health *health.Tracker
772772
HTTPC: &http.Client{Transport: logpolicy.NewLogtailTransport(logtail.DefaultHost, s.netMon, health, tsLogf)},
773773
MetricsDelta: clientmetric.EncodeLogTailMetricsDelta,
774774
}
775+
if envknob.NoLogsNoSupport() || testenv.InTest() {
776+
s.Logf("Tailscale logging is disabled by sing-box. Tailscale will not be able to provide support.")
777+
c.HTTPC = &http.Client{Transport: logpolicy.NoopPretendSuccessTransport{}}
778+
}
775779
s.logtail = logtail.NewLogger(c, tsLogf)
776780
closePool.addFunc(func() { s.logtail.Shutdown(context.Background()) })
777781
return nil

0 commit comments

Comments
 (0)