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.
In the daemon and ui folders, there is a file named network_aliases.json.
For the ui folder, there is a file network_aliases.py that handles interactions with the JSON file, such as retrieving a list of IPs associated with an alias. When we check whether an IP is present in the JSON file, if it is found, we add a line in the prompt.
When we click on LAN, the rules are saved as follows:
If we want to modify the rules, we print each possible alias:
The rules are then saved as follows:
For the daemon part: The JSON file is loaded when the daemon starts. For each connection, we check whether the rule is of type "network". If there is an alias and the destination IP is in the list from the JSON file, we use this information to proceed with the desired action.
I decided to keep this code for backward compatibility, but it can easily be deleted: