Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c4844cc
proto: add ConnectionMode enum and p2p/relay timeout fields to PeerCo…
MichaelUray May 1, 2026
e0ed831
client: add connectionmode package with Mode type and proto bridge
MichaelUray May 1, 2026
c71c951
client/peer: ResolveModeFromEnv with NB_CONNECTION_MODE and deprecati…
MichaelUray May 1, 2026
7d90a5b
client: add --connection-mode, --relay-timeout, --p2p-timeout CLI flags
MichaelUray May 1, 2026
cc10c9f
client/conn_mgr: replace asymmetric Lazy/ForceRelay precedence with Mode
MichaelUray May 1, 2026
dfd48e9
client/peer: connection mode drives skip-ICE branch in Open()
MichaelUray May 1, 2026
82877f0
client/engine: forward resolved Mode to per-peer ConnConfig
MichaelUray May 1, 2026
cd0abe8
mgmt/types: add ConnectionMode + p2p/relay timeout to Settings
MichaelUray May 1, 2026
0022145
openapi: add connection_mode + p2p/relay timeout fields to AccountSet…
MichaelUray May 1, 2026
b22128e
mgmt/handlers/accounts: accept connection_mode + timeout settings on PUT
MichaelUray May 1, 2026
3d8cc98
mgmt/activity: add three new account-scoped event codes
MichaelUray May 1, 2026
b53322d
mgmt/account: emit audit events for connection_mode + timeout changes
MichaelUray May 1, 2026
f63e2a7
move connectionmode package + extend toPeerConfig to fill new wire fi…
MichaelUray May 1, 2026
77852a9
mgmt/grpc: tests for toPeerConfig connection-mode resolution
MichaelUray May 1, 2026
0304dc2
client/peer/handshaker: add RemoveICEListener + lock the listener-read
MichaelUray May 1, 2026
ec2b46e
client/lazyconn/inactivity: two-timer per-peer with separate channels
MichaelUray May 1, 2026
3528248
client/lazyconn/manager: Config gains ICEInactivityThreshold + Relay
MichaelUray May 1, 2026
5c18a23
feat(peer): add Conn.AttachICE / DetachICE for p2p-dynamic mode
MichaelUray May 1, 2026
ad789e3
client/peer/conn: Open() defers ICE-listener registration in p2p-dynamic
MichaelUray May 1, 2026
a9710d9
client/conn_mgr: per-mode DeactivatePeer + DetachICEForPeer
MichaelUray May 1, 2026
d662d9b
client/conn_mgr: wire p2p-dynamic two-timer lifecycle
MichaelUray May 1, 2026
76e2d0b
client/conn_mgr: resolve P2pTimeoutSeconds from server-pushed PeerConfig
MichaelUray May 1, 2026
efaa2b1
client/conn_mgr: ActivatePeer attaches ICE listener in p2p-dynamic
MichaelUray May 1, 2026
838702d
proto: add P2pRetryMaxSeconds field to PeerConfig (Phase 3 #5989)
MichaelUray May 1, 2026
90c3d9f
mgmt/types: add P2pRetryMaxSeconds to Settings
MichaelUray May 1, 2026
74265f3
openapi: add p2p_retry_max_seconds to AccountSettings
MichaelUray May 1, 2026
9f60f1a
mgmt/handlers/accounts: accept p2p_retry_max_seconds setting on PUT
MichaelUray May 1, 2026
37276ea
mgmt/account+activity: emit audit event for p2p_retry_max changes
MichaelUray May 1, 2026
f9db3b0
mgmt/grpc: include P2pRetryMaxSeconds in toPeerConfig with sentinel m…
MichaelUray May 1, 2026
f63852d
client/peer: add iceBackoffState with truncated exponential schedule
MichaelUray May 1, 2026
7928f05
client/peer/conn: hook iceBackoffState into Conn lifecycle
MichaelUray May 1, 2026
4bb38b6
client/peer/conn: AttachICE returns nil-no-op during ice backoff
MichaelUray May 1, 2026
a49534f
client/peer: hook pion ICE state changes into iceBackoff
MichaelUray May 1, 2026
68dd578
client/conn_mgr: resolve P2pRetryMaxSeconds from server PeerConfig
MichaelUray May 1, 2026
7349b95
client/conn_mgr: propagate P2pRetryMaxSeconds changes to active Conns
MichaelUray May 1, 2026
75713b9
client: --p2p-retry-max CLI flag + EngineConfig + profile field
MichaelUray May 1, 2026
32c4efb
client/engine: forward P2pRetryMaxSeconds to ConnConfig
MichaelUray May 1, 2026
451872e
client/cmd/status: show ICE-backoff state in --detail output
MichaelUray May 1, 2026
19fb079
client/status: suppress ICE-backoff line when nextRetry has passed
MichaelUray May 1, 2026
b22143d
client/proto+shared/management: regenerate after ConnectionMode + P2p…
MichaelUray May 5, 2026
bfdc73e
client/server: cover Phase 3.7i ConnectionMode fields in SetConfigReq…
MichaelUray May 6, 2026
7c1a7a1
client+shared: pin proto version headers to upstream values
MichaelUray May 6, 2026
701a20f
client/peer: fix codespell typo in env_test.go (unparseable -> unpars…
MichaelUray May 6, 2026
58eb4f8
client+shared: golangci-lint cleanups + proxy_service.pb.go protoc ve…
MichaelUray May 6, 2026
6dd1e44
client/internal/debug: render Phase 1+2+3 connection-mode fields in d…
MichaelUray May 6, 2026
5088011
Merge upstream/main into pr/a-p2p-dynamic-foundation
MichaelUray May 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions client/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const (
extraIFaceBlackListFlag = "extra-iface-blacklist"
dnsRouteIntervalFlag = "dns-router-interval"
enableLazyConnectionFlag = "enable-lazy-connection"
connectionModeFlag = "connection-mode"
relayTimeoutFlag = "relay-timeout"
p2pTimeoutFlag = "p2p-timeout"
p2pRetryMaxFlag = "p2p-retry-max"
mtuFlag = "mtu"
)

Expand Down Expand Up @@ -72,6 +76,10 @@ var (
anonymizeFlag bool
dnsRouteInterval time.Duration
lazyConnEnabled bool
connectionMode string
relayTimeoutSecs uint32
p2pTimeoutSecs uint32
p2pRetryMaxSecs uint32
mtu uint16
profilesDisabled bool
updateSettingsDisabled bool
Expand Down Expand Up @@ -192,6 +200,15 @@ func init() {
upCmd.PersistentFlags().BoolVar(&rosenpassPermissive, rosenpassPermissiveFlag, false, "[Experimental] Enable Rosenpass in permissive mode to allow this peer to accept WireGuard connections without requiring Rosenpass functionality from peers that do not have Rosenpass enabled.")
upCmd.PersistentFlags().BoolVar(&autoConnectDisabled, disableAutoConnectFlag, false, "Disables auto-connect feature. If enabled, then the client won't connect automatically when the service starts.")
upCmd.PersistentFlags().BoolVar(&lazyConnEnabled, enableLazyConnectionFlag, false, "[Experimental] Enable the lazy connection feature. If enabled, the client will establish connections on-demand. Note: this setting may be overridden by management configuration.")
upCmd.PersistentFlags().StringVar(&connectionMode, connectionModeFlag, "",
"[Experimental] Peer connection mode: relay-forced, p2p, p2p-lazy, p2p-dynamic, or follow-server. "+
"Overrides the server-pushed value when set. Use follow-server to clear a previously-set local override.")
upCmd.PersistentFlags().Uint32Var(&relayTimeoutSecs, relayTimeoutFlag, 0,
"[Experimental] Relay-worker idle timeout in seconds. 0 = use server-pushed value (or built-in default).")
upCmd.PersistentFlags().Uint32Var(&p2pTimeoutSecs, p2pTimeoutFlag, 0,
"[Experimental] ICE-worker idle timeout in seconds. 0 = use server-pushed value (or built-in default). Only effective in p2p-dynamic mode (Phase 2).")
upCmd.PersistentFlags().Uint32Var(&p2pRetryMaxSecs, p2pRetryMaxFlag, 0,
"[Experimental] Maximum ICE-failure-backoff interval in seconds. 0 = use server-pushed value (or built-in default 15 min). Effective in p2p-dynamic mode (Phase 3 of #5989).")

}

Expand Down
39 changes: 39 additions & 0 deletions client/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
return nil
}

func setupSetConfigReq(customDNSAddressConverted []byte, cmd *cobra.Command, profileName, username string) *proto.SetConfigRequest {

Check warning on line 341 in client/cmd/up.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function has 105 lines of code, which is greater than the 100 authorized. Split it into smaller functions.

See more on https://sonarcloud.io/project/issues?id=netbirdio_netbird&issues=AZ36TTp8wQuoEp6UcmHq&open=AZ36TTp8wQuoEp6UcmHq&pullRequest=6081
var req proto.SetConfigRequest
req.ProfileName = profileName
req.Username = username
Expand Down Expand Up @@ -443,10 +443,23 @@
req.LazyConnectionEnabled = &lazyConnEnabled
}

if cmd.Flag(connectionModeFlag).Changed {
req.ConnectionMode = &connectionMode
}
if cmd.Flag(relayTimeoutFlag).Changed {
req.RelayTimeoutSeconds = &relayTimeoutSecs
}
if cmd.Flag(p2pTimeoutFlag).Changed {
req.P2PTimeoutSeconds = &p2pTimeoutSecs
}
if cmd.Flag(p2pRetryMaxFlag).Changed {
req.P2PRetryMaxSeconds = &p2pRetryMaxSecs
}

return &req
}

func setupConfig(customDNSAddressConverted []byte, cmd *cobra.Command, configFilePath string) (*profilemanager.ConfigInput, error) {

Check warning on line 462 in client/cmd/up.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function has 108 lines of code, which is greater than the 100 authorized. Split it into smaller functions.

See more on https://sonarcloud.io/project/issues?id=netbirdio_netbird&issues=AZ36TTp8wQuoEp6UcmHr&open=AZ36TTp8wQuoEp6UcmHr&pullRequest=6081
ic := profilemanager.ConfigInput{
ManagementURL: managementURL,
ConfigPath: configFilePath,
Expand Down Expand Up @@ -563,10 +576,23 @@
if cmd.Flag(enableLazyConnectionFlag).Changed {
ic.LazyConnectionEnabled = &lazyConnEnabled
}

if cmd.Flag(connectionModeFlag).Changed {
ic.ConnectionMode = &connectionMode
}
if cmd.Flag(relayTimeoutFlag).Changed {
ic.RelayTimeoutSeconds = &relayTimeoutSecs
}
if cmd.Flag(p2pTimeoutFlag).Changed {
ic.P2pTimeoutSeconds = &p2pTimeoutSecs
}
if cmd.Flag(p2pRetryMaxFlag).Changed {
ic.P2pRetryMaxSeconds = &p2pRetryMaxSecs
}
return &ic, nil
}

func setupLoginRequest(providedSetupKey string, customDNSAddressConverted []byte, cmd *cobra.Command) (*proto.LoginRequest, error) {

Check warning on line 595 in client/cmd/up.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function has 108 lines of code, which is greater than the 100 authorized. Split it into smaller functions.

See more on https://sonarcloud.io/project/issues?id=netbirdio_netbird&issues=AZ36TTp8wQuoEp6UcmHs&open=AZ36TTp8wQuoEp6UcmHs&pullRequest=6081
loginRequest := proto.LoginRequest{
SetupKey: providedSetupKey,
ManagementUrl: managementURL,
Expand Down Expand Up @@ -681,6 +707,19 @@
if cmd.Flag(enableLazyConnectionFlag).Changed {
loginRequest.LazyConnectionEnabled = &lazyConnEnabled
}

if cmd.Flag(connectionModeFlag).Changed {
loginRequest.ConnectionMode = &connectionMode
}
if cmd.Flag(relayTimeoutFlag).Changed {
loginRequest.RelayTimeoutSeconds = &relayTimeoutSecs
}
if cmd.Flag(p2pTimeoutFlag).Changed {
loginRequest.P2PTimeoutSeconds = &p2pTimeoutSecs
}
if cmd.Flag(p2pRetryMaxFlag).Changed {
loginRequest.P2PRetryMaxSeconds = &p2pRetryMaxSecs
}
return &loginRequest, nil
}

Expand Down
Loading
Loading