Skip to content

[client] Refactor exclude list handling to use a map for permanent connections #3901

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

Merged
merged 1 commit into from
May 30, 2025

Conversation

hakansa
Copy link
Member

@hakansa hakansa commented May 30, 2025

Describe your changes

[client] Refactor exclude list handling to use a map for permanent connections

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

@hakansa hakansa requested review from pappz and Copilot May 30, 2025 13:34
Copy link

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactor the permanent connection exclusion logic to use a map for more efficient lookups.

  • Update toExcludedLazyPeers to return a map[string]bool instead of a slice.
  • Adjust SetExcludeList to accept a map[string]bool and iterate map keys.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
client/internal/engine.go toExcludedLazyPeers now builds and returns a map of excluded peers
client/internal/conn_mgr.go SetExcludeList signature updated to take a map and loop over keys
Comments suppressed due to low confidence (2)

client/internal/conn_mgr.go:100

  • The comment still refers to a "list" but the method now accepts a map of peer IDs; update it to reflect the map-based parameter, e.g., "Sets the map of peer IDs..." or "Sets the set of peer IDs...".
// SetExcludeList sets the list of peer IDs that should always have permanent connections.

client/internal/engine.go:1930

  • Consider adding or updating unit tests for toExcludedLazyPeers to ensure the map-based exclusion correctly handles duplicates, empty peers, and includes all intended entries.
func (e *Engine) toExcludedLazyPeers(routes []*route.Route, rules []firewallManager.ForwardRule, peers []*mgmProto.RemotePeerConfig) map[string]bool {

@hakansa hakansa merged commit cfb2d82 into main May 30, 2025
31 of 32 checks passed
@hakansa hakansa deleted the fix/lazy-excluded-log branch May 30, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants