diff options
| author | Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> | 2026-03-07 09:32:06 -0500 |
|---|---|---|
| committer | Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> | 2026-03-07 09:32:06 -0500 |
| commit | 9cce0baa43eddf3e75b31ffecf3649093a07e7a1 (patch) | |
| tree | 83c304758b8acdfa2f38b38b3e6e133bdc644dbd /ipn/ipnlocal | |
| parent | 6e71a15e595a3461c719e5ede6581f9e7b46621f (diff) | |
| download | tailscale-jasonodonnell/sync.tar.xz tailscale-jasonodonnell/sync.zip | |
tailsyncjasonodonnell/sync
Diffstat (limited to 'ipn/ipnlocal')
| -rw-r--r-- | ipn/ipnlocal/sync.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ipn/ipnlocal/sync.go b/ipn/ipnlocal/sync.go index 0daaa92bb..58bb156cf 100644 --- a/ipn/ipnlocal/sync.go +++ b/ipn/ipnlocal/sync.go @@ -10,6 +10,28 @@ import ( "tailscale.com/tailsync" ) +// SyncSetTransport configures the sync service with the PeerAPI transport. +func (b *LocalBackend) SyncSetTransport() { + svc, ok := b.sys.FileSync.GetOK() + if !ok { + return + } + transport := b.Dialer().PeerAPITransport() + peerURL := func(peerID string) string { + cn := b.currentNode() + for _, p := range cn.Peers() { + if string(p.StableID()) == peerID || p.DisplayName(false) == peerID || p.Name() == peerID { + base := cn.PeerAPIBase(p) + if base != "" { + return base + } + } + } + return "" + } + svc.SetTransport(transport, peerURL) +} + // SyncSharingEnabled reports whether sharing sync roots via Tailsync is // enabled. This is currently based on checking for the sync:share node // attribute. @@ -50,6 +72,8 @@ func (b *LocalBackend) SyncSetSession(session *tailsync.Session) error { if !ok { return tailsync.ErrSyncNotEnabled } + // Ensure transport is configured before starting session. + b.SyncSetTransport() return svc.SetSession(session) } |
