mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-11 04:26:48 -04:00
Android startup opened a throwaway Sync stream to management before creating the TUN device, only to learn the initial routes, DNS config and the DNS feature flag. Server side this computed a full network map and broadcast a false connect/disconnect pair to every peer in the account on every Android start; client side it put a blocking network round trip on the critical startup path and failed the whole engine start when management was unreachable. None of its outputs are needed upfront anymore: the TUN is created empty and the first sync triggers a rebuild that pulls the fresh route and search domain state, the permanent DNS server starts with an empty config that the first sync populates, and the fake IP manager is created lazily when the DNS feature flag turns on. Remove readInitialSettings and its plumbing: the InitialRoutes and DNSFeatureFlag manager config fields, the android construction-time route setup, the initial-route bookkeeping in the notifiers and the now-unused GetNetworkMap client method.
38 lines
1.7 KiB
Go
38 lines
1.7 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/netbirdio/netbird/client/system"
|
|
"github.com/netbirdio/netbird/shared/management/domain"
|
|
"github.com/netbirdio/netbird/shared/management/proto"
|
|
)
|
|
|
|
// Client is the interface for the management service client.
|
|
type Client interface {
|
|
io.Closer
|
|
Sync(ctx context.Context, sysInfo *system.Info, msgHandler func(msg *proto.SyncResponse) error) error
|
|
Job(ctx context.Context, msgHandler func(msg *proto.JobRequest) *proto.JobResponse) error
|
|
Register(setupKey string, jwtToken string, sysInfo *system.Info, sshKey []byte, dnsLabels domain.List) (*proto.LoginResponse, error)
|
|
Login(sysInfo *system.Info, sshKey []byte, dnsLabels domain.List) (*proto.LoginResponse, error)
|
|
// ExtendAuthSession refreshes the peer's SSO session deadline using a fresh JWT.
|
|
// Returns the new absolute deadline; zero time when the server reports the peer
|
|
// is not eligible for session extension.
|
|
ExtendAuthSession(sysInfo *system.Info, jwtToken string) (*proto.ExtendAuthSessionResponse, error)
|
|
GetDeviceAuthorizationFlow() (*proto.DeviceAuthorizationFlow, error)
|
|
GetPKCEAuthorizationFlow() (*proto.PKCEAuthorizationFlow, error)
|
|
GetServerURL() string
|
|
// IsHealthy returns the current connection status without blocking.
|
|
// Used by the engine to monitor connectivity in the background.
|
|
IsHealthy() bool
|
|
// HealthCheck actively probes the management server and returns an error if unreachable.
|
|
// Used to validate connectivity before committing configuration changes.
|
|
HealthCheck() error
|
|
SyncMeta(sysInfo *system.Info) error
|
|
Logout() error
|
|
CreateExpose(ctx context.Context, req ExposeRequest) (*ExposeResponse, error)
|
|
RenewExpose(ctx context.Context, domain string) error
|
|
StopExpose(ctx context.Context, domain string) error
|
|
}
|