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

[bug] WireGuard backend is missing parsers fixes #276 #338

Closed
wants to merge 2 commits into from

Conversation

Unnati-Gupta24
Copy link

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • [] I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • [] I have updated the documentation.

Reference to Existing Issue

Closes #276.

Please open a new issue if there isn't an existing issue yet.

Description of Changes

This PR implements the missing WireGuard parsers in WireguardParser inside netjsonconfig/netjsonconfig/backends/wireguard/parser.py.

Changes made:

✅ Implemented parse_text() to parse WireGuard config files into structured dictionaries.
✅ Implemented parse_tar() to handle .tar.gz archives containing multiple WireGuard configurations.
✅ Added helper methods _get_vpns() and _get_config() to extract VPN details.
✅ Updated wireguard.py to integrate the parser.

Example Config Parsed:

[Interface]
Address = 10.0.0.1/24
PrivateKey = abcdefghijklmnopqrstuvwxyz
ListenPort = 51820
DNS = 8.8.8.8

[Peer]
PublicKey = mnopqrstuvwxyzabcdefghij
AllowedIPs = 10.0.0.2/32
Endpoint = 192.168.1.1:51820

Screenshot

Please include any relevant screenshots.

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.

[bug] WireGuard backend is missing parsers
1 participant