Skip to content

Refined scripts to use peers.json - #9

Closed
terjeinnerdal wants to merge 1 commit into
mainfrom
refine_exit_node
Closed

Refined scripts to use peers.json#9
terjeinnerdal wants to merge 1 commit into
mainfrom
refine_exit_node

Conversation

@terjeinnerdal

@terjeinnerdal terjeinnerdal commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added --help support to configuration and routing setup scripts
    • Introduced JSON-based configuration file for peer management and permission controls
  • Refactor

    • Replaced hardcoded peer settings with dynamic configuration sourced from external file
  • Chores

    • Added prerequisite validation for required tools
    • Improved error handling and command-line argument validation

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Two NordVPN Meshnet configuration scripts are refactored to read peer permissions from a JSON configuration file instead of using hardcoded values. Both scripts now require jq, validate arguments, support --help, and dynamically apply routing, file-sharing, and local-access rules based on peer allowlists.

Changes

Cohort / File(s) Summary
NordVPN Configuration Scripts
bash/nord/config.sh, bash/nord/exit_node.sh
Both scripts now require jq as a prerequisite, add help/argument validation, and replace hardcoded peer rules with dynamic configuration read from peers.json. config.sh introduces display_help() and disable_fileshare_for_unallowed_peers() functions; exit_node.sh changes its interface to require a device nickname parameter and adds deny-logic for non-allowed peers.
Peer Configuration Data
bash/nord/peers.json
New JSON file defining peer groupings with four top-level arrays: all_peers (6 peers), allowed_for_routing (5 peers), allowed_for_local (2 peers), and allowed_for_fileshare (2 peers).

Sequence Diagram(s)

sequenceDiagram
    participant Script as config.sh
    participant FS as Filesystem
    participant jq as jq Parser
    participant NordVPN as NordVPN CLI
    
    Script->>FS: Read peers.json
    FS-->>Script: JSON content
    Script->>jq: Parse allowed_for_fileshare & all_peers
    jq-->>Script: Parsed arrays
    Script->>Script: Iterate allowed peers
    Script->>NordVPN: meshnet peer fileshare allow
    NordVPN-->>Script: Success
    Script->>Script: Call disable_fileshare_for_unallowed_peers()
    Script->>NordVPN: meshnet peer fileshare deny (for non-allowed)
    NordVPN-->>Script: Success
Loading
sequenceDiagram
    participant Script as exit_node.sh
    participant FS as Filesystem
    participant jq as jq Parser
    participant NordVPN as NordVPN CLI
    
    Script->>Script: Validate nickname argument
    Script->>FS: Read peers.json
    FS-->>Script: JSON content
    Script->>jq: Parse allowed_for_routing & all_peers
    jq-->>Script: Parsed arrays
    Script->>NordVPN: Enable Meshnet
    NordVPN-->>Script: Success
    Script->>Script: Iterate allowed_for_routing peers
    Script->>NordVPN: meshnet peer routing allow
    NordVPN-->>Script: Success
    Script->>Script: Deny routing for non-allowed peers
    Script->>NordVPN: meshnet peer routing deny
    NordVPN-->>Script: Success
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A rabbit's ode to JSON dreams,
No hardcoded peers in sight—
With jq and allowlists, it all seems
Dynamically delightful and right!
Hops of joy for cleaner scripts. 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: refactoring scripts to use a new peers.json configuration file instead of hardcoded values.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refine_exit_node

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@terjeinnerdal
terjeinnerdal deleted the refine_exit_node branch April 13, 2026 14:25
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.

1 participant