PeerCapabilityTaildriveSharer says a peer may share with us, not that it
does, so listDrivePeers is a superset of the peers actually exposing
shares. listDrivePeers now takes an options object; with
{hasShares: true} each candidate's taildrive root is probed with a
Depth-1 PROPFIND and only peers listing at least one share are kept.
The probe and its multistatus parsing live in cmd/tsconnect/driveprobe
so they can be tested without syscall/js. Probes run in parallel with a
bounded worker count, a per-probe timeout and a bounded response read;
a probe that fails drops that peer and is logged rather than failing
the call, so the filter is positive-only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
28 lines
687 B
Go
28 lines
687 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build ts_omit_drive
|
|
|
|
package main
|
|
|
|
import (
|
|
"syscall/js"
|
|
|
|
"tailscale.com/tsd"
|
|
)
|
|
|
|
type jsFileSystemForRemote struct{}
|
|
|
|
// initDriveForRemote is a no-op when the drive feature is omitted.
|
|
func initDriveForRemote(_ *tsd.System) *jsFileSystemForRemote { return nil }
|
|
|
|
// wireDriveJS is a no-op when the drive feature is omitted.
|
|
func wireDriveJS(_ *jsIPN, _ *jsFileSystemForRemote, _ map[string]any) {}
|
|
|
|
// listDrivePeers returns an empty list when the drive feature is omitted.
|
|
func (i *jsIPN) listDrivePeers(_ bool) js.Value {
|
|
return makePromise(func() (any, error) {
|
|
return "[]", nil
|
|
})
|
|
}
|