mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-22 06:39:08 +02:00
Add peer-to-peer file drop
Files move directly between peers over the overlay, with no server in the path. The receiver listens on the WireGuard address only, so the port is unreachable from outside the tunnel, and every offer is matched to a known peer before anything is read. Consent is the default: an offer carries metadata alone, and no payload moves until the receiver accepts. Policy is per profile and device-local — off, ask, or auto-accept, with per-sender exceptions on top. Policy and history live in the profile's preferences, so removing a profile takes its file drop state with it. Transfers interrupted by a restart are settled on load; nothing survives to finish them, and left alone they would sit in the log as permanently pending. The Android bindings pull payload bytes through a chunk-returning stream: gomobile copies a []byte argument into a fresh Java array and never copies it back, so a fill-my-buffer method would hand back the right length with no data.
This commit is contained in:
@@ -41,6 +41,7 @@ const (
|
||||
// stays under the linter's parameter-count threshold.
|
||||
type TrayServices struct {
|
||||
Connection *services.Connection
|
||||
FileDrop *services.FileDrop
|
||||
Settings *services.Settings
|
||||
Profiles *services.Profiles
|
||||
Networks *services.Networks
|
||||
@@ -200,6 +201,7 @@ func NewTray(app *application.App, window *application.WebviewWindow, svc TraySe
|
||||
|
||||
app.Event.On(services.EventStatusSnapshot, t.onStatusEvent)
|
||||
app.Event.On(services.EventDaemonNotification, t.onSystemEvent)
|
||||
app.Event.On(services.EventFileDrop, t.onFileDropEvent)
|
||||
// Refresh the Profiles submenu on ProfileSwitcher's change event. A
|
||||
// switch on an idle daemon drives no status transition, so without this
|
||||
// hook a React-initiated switch leaves the tray's submenu stale.
|
||||
@@ -217,6 +219,8 @@ func NewTray(app *application.App, window *application.WebviewWindow, svc TraySe
|
||||
// Startup populates appName/registry path on Windows; before app.Run()
|
||||
// the category lookup silently falls back to a plain notification.
|
||||
t.registerSessionWarningCategory()
|
||||
t.registerFileDropCategory()
|
||||
t.registerNotificationResponses()
|
||||
})
|
||||
|
||||
t.loc.Watch(func(i18n.LanguageCode) { t.applyLanguage() })
|
||||
|
||||
Reference in New Issue
Block a user