[client] Keep file drop out of the wasm build

File drop needs a local filesystem to deliver into and a receiver it can bind,
so wasm supports neither and never sets a manager. The code still linked in,
because the Engine reached filedrop through an untagged field, and with it the
net/http server and client. That put the wasm binary 0.97MiB over the 60MB
budget, on a main that had 0.34MiB of headroom left.

Split the feature on the js tag: the logic file and the OS dialer become !js,
a js no-op carries the start, stop and rebind entry points the engine calls on
its lifecycle paths, and a build-tagged alias types the manager so engine.go
and connect.go stay untagged and lose the import. iOS keeps the full feature:
the logic file is !js and the iOS dialer stays behind the ios tag.

Drops the wasm binary to 59.89MiB, with no filedrop symbol left in it.
This commit is contained in:
Zoltán Papp
2026-09-08 20:43:40 +02:00
parent ddefc990ec
commit 09715fabd3
7 changed files with 37 additions and 7 deletions
+2 -3
View File
@@ -40,7 +40,6 @@ import (
dnsconfig "github.com/netbirdio/netbird/client/internal/dns/config"
"github.com/netbirdio/netbird/client/internal/dnsfwd"
"github.com/netbirdio/netbird/client/internal/expose"
"github.com/netbirdio/netbird/client/internal/filedrop"
"github.com/netbirdio/netbird/client/internal/ingressgw"
"github.com/netbirdio/netbird/client/internal/lazyconn"
"github.com/netbirdio/netbird/client/internal/metrics"
@@ -191,7 +190,7 @@ type EngineServices struct {
UpdateManager *updater.Manager
ClientMetrics *metrics.ClientMetrics
MetricsCtx context.Context
FileDrop *filedrop.Manager
FileDrop fileDropManager
// NetMgr gates the reconnection loops on OS-reported network
// availability; nil disables gating.
NetMgr *netevents.Manager
@@ -254,7 +253,7 @@ type Engine struct {
sshServer sshServer
fileDrop *filedrop.Manager
fileDrop fileDropManager
fileDropRunning bool
fileDropPort uint16
overlayWait overlayWaiter //nolint:unused // only read by the iOS overlay wait