Skip to content
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

[Hosts] Duplicate check improvement #32805

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

davidegiacometti
Copy link
Collaborator

Summary of the Pull Request

The duplicate check logic degraded overtime with the additional logics introduced (max 9 hosts per line, etc..).

  • This PR aims to move the current logic from the view model to a dedicated service and make it async.
  • Since a typical usage of the hosts file is to block domains mapping them to 0.0.0.0 I have added 0.0.0.0 (and IPv6 equivalent) to the list of loopback addresses in order to skip the check.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

  • Manually tested with a hosts file containing more than 100K entries:
    • Verified that duplicate check is working as before but in an async way
    • Tested file reload
    • Tested "Consider loopback addresses as duplicate" enable/disable (it does trigger a hosts file reload)
    • Edited an entry with a huge number of duplicates and verified that UI doesn't freeze

{
"0.0.0.0",
"::0",
"0:0:0:0:0:0:0:0",

This comment was marked as outdated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

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

Not quite sure about all rules for duplicates, but changes look good to me and the tests I did seem to make it work as it was before.
Thank you for the contribution.

@jaimecbernardo jaimecbernardo merged commit c00f37c into main Jun 3, 2024
15 checks passed
@davidegiacometti davidegiacometti deleted the users/davidegiacometti/hosts-dup-service branch June 4, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants