-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[client, management] Phase 3.7i of #5989: peer-status visibility — RemotePeerConfig + conn-state pusher + Peers UI (stack 3/4) #6083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MichaelUray
wants to merge
108
commits into
netbirdio:main
Choose a base branch
from
MichaelUray:pr/c-phase3.7i-visibility
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
108 commits
Select commit
Hold shift + click to select a range
c4844cc
proto: add ConnectionMode enum and p2p/relay timeout fields to PeerCo…
MichaelUray e0ed831
client: add connectionmode package with Mode type and proto bridge
MichaelUray c71c951
client/peer: ResolveModeFromEnv with NB_CONNECTION_MODE and deprecati…
MichaelUray 7d90a5b
client: add --connection-mode, --relay-timeout, --p2p-timeout CLI flags
MichaelUray cc10c9f
client/conn_mgr: replace asymmetric Lazy/ForceRelay precedence with Mode
MichaelUray dfd48e9
client/peer: connection mode drives skip-ICE branch in Open()
MichaelUray 82877f0
client/engine: forward resolved Mode to per-peer ConnConfig
MichaelUray cd0abe8
mgmt/types: add ConnectionMode + p2p/relay timeout to Settings
MichaelUray 0022145
openapi: add connection_mode + p2p/relay timeout fields to AccountSet…
MichaelUray b22128e
mgmt/handlers/accounts: accept connection_mode + timeout settings on PUT
MichaelUray 3d8cc98
mgmt/activity: add three new account-scoped event codes
MichaelUray b53322d
mgmt/account: emit audit events for connection_mode + timeout changes
MichaelUray f63e2a7
move connectionmode package + extend toPeerConfig to fill new wire fi…
MichaelUray 77852a9
mgmt/grpc: tests for toPeerConfig connection-mode resolution
MichaelUray 0304dc2
client/peer/handshaker: add RemoveICEListener + lock the listener-read
MichaelUray ec2b46e
client/lazyconn/inactivity: two-timer per-peer with separate channels
MichaelUray 3528248
client/lazyconn/manager: Config gains ICEInactivityThreshold + Relay
MichaelUray 5c18a23
feat(peer): add Conn.AttachICE / DetachICE for p2p-dynamic mode
MichaelUray ad789e3
client/peer/conn: Open() defers ICE-listener registration in p2p-dynamic
MichaelUray a9710d9
client/conn_mgr: per-mode DeactivatePeer + DetachICEForPeer
MichaelUray d662d9b
client/conn_mgr: wire p2p-dynamic two-timer lifecycle
MichaelUray 76e2d0b
client/conn_mgr: resolve P2pTimeoutSeconds from server-pushed PeerConfig
MichaelUray efaa2b1
client/conn_mgr: ActivatePeer attaches ICE listener in p2p-dynamic
MichaelUray 838702d
proto: add P2pRetryMaxSeconds field to PeerConfig (Phase 3 #5989)
MichaelUray 90c3d9f
mgmt/types: add P2pRetryMaxSeconds to Settings
MichaelUray 74265f3
openapi: add p2p_retry_max_seconds to AccountSettings
MichaelUray 9f60f1a
mgmt/handlers/accounts: accept p2p_retry_max_seconds setting on PUT
MichaelUray 37276ea
mgmt/account+activity: emit audit event for p2p_retry_max changes
MichaelUray f9db3b0
mgmt/grpc: include P2pRetryMaxSeconds in toPeerConfig with sentinel m…
MichaelUray f63852d
client/peer: add iceBackoffState with truncated exponential schedule
MichaelUray 7928f05
client/peer/conn: hook iceBackoffState into Conn lifecycle
MichaelUray 4bb38b6
client/peer/conn: AttachICE returns nil-no-op during ice backoff
MichaelUray a49534f
client/peer: hook pion ICE state changes into iceBackoff
MichaelUray 68dd578
client/conn_mgr: resolve P2pRetryMaxSeconds from server PeerConfig
MichaelUray 7349b95
client/conn_mgr: propagate P2pRetryMaxSeconds changes to active Conns
MichaelUray 75713b9
client: --p2p-retry-max CLI flag + EngineConfig + profile field
MichaelUray 32c4efb
client/engine: forward P2pRetryMaxSeconds to ConnConfig
MichaelUray 451872e
client/cmd/status: show ICE-backoff state in --detail output
MichaelUray 19fb079
client/status: suppress ICE-backoff line when nextRetry has passed
MichaelUray b22143d
client/proto+shared/management: regenerate after ConnectionMode + P2p…
MichaelUray bfdc73e
client/server: cover Phase 3.7i ConnectionMode fields in SetConfigReq…
MichaelUray 7c1a7a1
client+shared: pin proto version headers to upstream values
MichaelUray 701a20f
client/peer: fix codespell typo in env_test.go (unparseable -> unpars…
MichaelUray 58eb4f8
client+shared: golangci-lint cleanups + proxy_service.pb.go protoc ve…
MichaelUray 6dd1e44
client/internal/debug: render Phase 1+2+3 connection-mode fields in d…
MichaelUray 7c80838
client/peer: reset ICE backoff + recreate workerICE on network change
MichaelUray b9a967f
client/peer/conn: send offer after workerICE recreate (Phase 3.5 foll…
MichaelUray 8760fa1
client/peer/worker_ice: buffer remote candidates that race ahead of a…
MichaelUray 6f86055
Revert "client/peer/worker_ice: buffer remote candidates that race ah…
MichaelUray 939d946
client/peer/conn: refactor onNetworkChange to use the in-place agent …
MichaelUray 15c6d90
client/peer/conn: drop SendOffer from onNetworkChange to fix offer-storm
MichaelUray 78d2fdc
client/peer/worker_ice: skip new offers while ICE agent is connecting…
MichaelUray 90dba34
client/internal: re-attach ICE on every signal trigger (Phase 3.7d)
MichaelUray bcb30b9
client/peer/conn: re-attach ICE listener inside onNetworkChange (Phas…
MichaelUray 9e444b5
client/peer/ice_backoff: short delay for first failure post-network-c…
MichaelUray 67e7f36
client/peer: skip workerICE.Close on network change when ICE still Co…
MichaelUray ddd1f87
client/peer/ice_backoff: widen post-network-change grace window (Phas…
MichaelUray 34300d5
client/cmd/service: persist connection-mode + timeouts on install/rec…
MichaelUray b12be21
client/ui: Connection Mode + timeouts in Network tab (Phase 3.7h GUI)
MichaelUray f4ff7c7
client: surface server-pushed connection-mode/timeouts via daemon-RPC
MichaelUray 0b85cf5
client/ui: Follow-Server (currently: ...) display + Lazy menu removal
MichaelUray 672a9bc
client/android: gomobile getters for ConnectionMode + ServerPushed va…
MichaelUray abeecc6
client+shared: regenerate proto after Phase 3.7h GUI proto changes
MichaelUray 3730df0
client+shared: regenerate proto on rebased PR-B + pin protoc version …
MichaelUray ef13e66
client: surface server-pushed connection-mode/timeouts via daemon-RPC
MichaelUray 36c2f14
proto/management: RemotePeerConfig + PeerSystemMeta extensions for pe…
MichaelUray 7c1ae62
mgmt/peer: store effective_connection_mode in PeerSystemMeta
MichaelUray 44d1939
mgmt/conversion: appendRemotePeerConfig fills effective+configured+gr…
MichaelUray 601b25c
mgmt/client+engine: report effective_connection_mode + SyncMeta debounce
MichaelUray 8b76795
proto/management: SyncPeerConnections unary RPC + PeerConnectionMap msgs
MichaelUray 3468538
mgmt/peer_connections: Store interface + MemoryStore impl
MichaelUray 4244e49
mgmt/peer_connections: SnapshotRouter for on-demand refresh dispatch
MichaelUray 988c219
mgmt: shared peer_connections bootstrap + SyncPeerConnections handler
MichaelUray 3f4de29
mgmt/client: SyncPeerConnections unary client method + interface + mock
MichaelUray 82ca06a
mgmt/client/test: update NewServer call for Phase-3.7i bootstrap params
MichaelUray 5f47408
mgmt/grpc: route SnapshotRequest via Sync server-stream, bypass debou…
MichaelUray ed6c44b
client/internal: conn_state_pusher with adaptive heartbeat + snapshot
MichaelUray 39fe648
client/internal: wire conn_state_pusher into Engine + Sync receive
MichaelUray 48b2ef5
proto/daemon: FullStatus aggregate counters + PeerState enrichment
MichaelUray e02ea87
client/peer/status: counters in FullStatus + UpdatePeerRemoteMeta
MichaelUray e96f4ec
client/engine: plumb RemotePeerConfig into peer.UpdatePeerRemoteMeta
MichaelUray 35eaa67
mgmt/http: GET + POST /api/peers/{id}/connections handlers with RBAC
MichaelUray aa77c5a
mgmt/router: register /api/peers/{id}/connections + /refresh routes
MichaelUray 87f5491
client/ui: new "Peers" tab in Networks window
MichaelUray f486956
client/android: gomobile getters for 6 peer-status aggregate counters
MichaelUray 88d50e6
client/android: enrich PeerInfo with peer.State fields for Android UI
MichaelUray 5a408f3
client/ui: Peers tab first + tray rename + Stack-wrapped Accordion fill
MichaelUray a00edda
peer-status: live_online from peer.Status.Connected for accurate counter
MichaelUray 0236cc5
client/ui: rename to "Peers and Networks" + force Peers tab to fill
MichaelUray accade5
client/ui: per-peer expandable rows + outer-footer Show-Full + tab-aw…
MichaelUray 045fd16
client/ui: peer rows use dynamic add/remove + scroll has 600px floor
MichaelUray d05e3dd
client/ui: persist peer-row expand state across Refresh + size to con…
MichaelUray d9cc9f4
client/conn_mgr: lazy/dynamic mode change resets peers to Idle + tole…
MichaelUray 301d8d1
mgmt/peer_connections: nonce/router/refresh hardening per code review
MichaelUray db1af91
client/conn_state_pusher: dirty-on-fail + initial-snapshot gating
MichaelUray 6197a3c
peer/status: endpoint+relay-server changes trigger immediate state push
MichaelUray a116998
proto+mgmt: server_liveness_known marker for authoritative LiveOnline
MichaelUray ceb9a4c
client/conn+ui: ICE handover packet-loss fix + nil-Latency guard
MichaelUray a81a01b
mgmt/store: getAccountPgx selects Phase-3 connection-mode columns
MichaelUray aca8500
client: Android refresh wg-stats on PeersList + bump default relay-ti…
MichaelUray 0fc4ccc
client/lazyconn: IsSupported also accepts "0.0.0-dev-…" semver-padded…
MichaelUray 7e737db
client+shared: regenerate proto after Phase 3.7i visibility extensions
MichaelUray 20fa31b
client/peer/status: add notifyPeerListChanged + notifyPeerStateChange…
MichaelUray 550c830
client+shared: regenerate proto on rebased PR-C + pin protoc version …
MichaelUray 17705d8
client/cmd: testutil_test.go nbgrpc.NewServer call to 13 args (peer_c…
MichaelUray eb60bf3
mgmt/grpc: nil-default peer_connections store+router + 13-arg test fi…
MichaelUray 395f771
PR-C linter cleanups for golangci-lint
MichaelUray c8fcd96
client/conn_state_pusher: nil-receiver safe On* entry points
MichaelUray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -307,6 +307,91 @@ func (p *Preferences) SetBlockInbound(block bool) { | |
| p.configInput.BlockInbound = &block | ||
| } | ||
|
|
||
| // GetConnectionMode returns the locally configured connection-mode override | ||
| // (canonical lower-kebab-case: "relay-forced", "p2p", "p2p-lazy", | ||
| // "p2p-dynamic", "follow-server"), or empty string if no local override | ||
| // is configured -- the daemon will then follow the server-pushed value. | ||
| func (p *Preferences) GetConnectionMode() (string, error) { | ||
| if p.configInput.ConnectionMode != nil { | ||
| return *p.configInput.ConnectionMode, nil | ||
| } | ||
| cfg, err := profilemanager.ReadConfig(p.configInput.ConfigPath) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| return cfg.ConnectionMode, nil | ||
| } | ||
|
|
||
| // SetConnectionMode stores a local override for the connection mode. | ||
| // Pass an empty string to clear the override (revert to following the | ||
| // server-pushed value). | ||
| func (p *Preferences) SetConnectionMode(mode string) { | ||
| m := mode | ||
| p.configInput.ConnectionMode = &m | ||
| } | ||
|
|
||
| // GetRelayTimeoutSeconds returns the locally configured relay-worker | ||
| // inactivity timeout in seconds, or 0 if no override is set (follow | ||
| // server-pushed value, or built-in default if the server has none). | ||
| func (p *Preferences) GetRelayTimeoutSeconds() (int64, error) { | ||
| if p.configInput.RelayTimeoutSeconds != nil { | ||
| return int64(*p.configInput.RelayTimeoutSeconds), nil | ||
| } | ||
| cfg, err := profilemanager.ReadConfig(p.configInput.ConfigPath) | ||
| if err != nil { | ||
| return 0, err | ||
| } | ||
| return int64(cfg.RelayTimeoutSeconds), nil | ||
| } | ||
|
|
||
| // SetRelayTimeoutSeconds stores a local override for the relay timeout. | ||
| // Pass 0 to clear the override. | ||
| func (p *Preferences) SetRelayTimeoutSeconds(secs int64) { | ||
| v := uint32(secs) | ||
| p.configInput.RelayTimeoutSeconds = &v | ||
| } | ||
|
|
||
| // GetP2pTimeoutSeconds returns the locally configured ICE-worker | ||
| // inactivity timeout in seconds (only effective in p2p-dynamic mode), | ||
| // or 0 if no override is set. | ||
| func (p *Preferences) GetP2pTimeoutSeconds() (int64, error) { | ||
| if p.configInput.P2pTimeoutSeconds != nil { | ||
| return int64(*p.configInput.P2pTimeoutSeconds), nil | ||
| } | ||
| cfg, err := profilemanager.ReadConfig(p.configInput.ConfigPath) | ||
| if err != nil { | ||
| return 0, err | ||
| } | ||
| return int64(cfg.P2pTimeoutSeconds), nil | ||
| } | ||
|
|
||
| // SetP2pTimeoutSeconds stores a local override for the p2p timeout. | ||
| // Pass 0 to clear the override. | ||
| func (p *Preferences) SetP2pTimeoutSeconds(secs int64) { | ||
| v := uint32(secs) | ||
| p.configInput.P2pTimeoutSeconds = &v | ||
| } | ||
|
|
||
| // GetP2pRetryMaxSeconds returns the locally configured cap on the | ||
| // per-peer ICE-failure backoff schedule, or 0 if no override is set. | ||
| func (p *Preferences) GetP2pRetryMaxSeconds() (int64, error) { | ||
| if p.configInput.P2pRetryMaxSeconds != nil { | ||
| return int64(*p.configInput.P2pRetryMaxSeconds), nil | ||
| } | ||
| cfg, err := profilemanager.ReadConfig(p.configInput.ConfigPath) | ||
| if err != nil { | ||
| return 0, err | ||
| } | ||
| return int64(cfg.P2pRetryMaxSeconds), nil | ||
| } | ||
|
|
||
| // SetP2pRetryMaxSeconds stores a local override for the backoff cap. | ||
| // Pass 0 to clear the override. | ||
| func (p *Preferences) SetP2pRetryMaxSeconds(secs int64) { | ||
| v := uint32(secs) | ||
| p.configInput.P2pRetryMaxSeconds = &v | ||
|
Comment on lines
+349
to
+392
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard the These setters silently wrap invalid inputs; for example, 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| // Commit writes out the changes to the config file | ||
| func (p *Preferences) Commit() error { | ||
| _, err := profilemanager.UpdateOrCreateConfig(p.configInput) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetConnectionMode("")does not actually clear the override.The doc says "Pass an empty string to clear the override (revert to following the server-pushed value)", but the implementation stores
&""(non-nil pointer to an empty string).GetConnectionModechecksp.configInput.ConnectionMode != nilfirst, so afterSetConnectionMode("")the getter returns""and never falls through to readcfg.ConnectionMode— the local override is set-to-empty rather than cleared, which is observably different from "follow server".🛡️ Proposed fix
func (p *Preferences) SetConnectionMode(mode string) { - m := mode - p.configInput.ConnectionMode = &m + if mode == "" { + p.configInput.ConnectionMode = nil + return + } + m := mode + p.configInput.ConnectionMode = &m }📝 Committable suggestion
🤖 Prompt for AI Agents