Welcome Contributors!
WireGuird is an open-source project, and we welcome contributions from the community. Whether you’re fixing bugs, adding features, improving documentation, or reporting issues, your help is appreciated.Getting Started
Prerequisites
Before you begin developing WireGuird, ensure you have the following installed:System Dependencies
- GTK 3 development libraries
- libayatana-appindicator3 for system tray
- WireGuard tools (wg-quick, wg)
- resolvconf for DNS management
Development Tools
- Go 1.14+ (project uses Go modules)
- Git for version control
- Glade (optional, for UI editing)
Installing Dependencies
Ubuntu/Debian
Arch Linux
Fedora
Development Setup
Install Go Dependencies
gotk3- GTK 3 bindings for Gowgctrl- WireGuard control libraryzerolog- Structured logginggo-appindicator- System tray support
Generate Code
Run the code generators to create GTK helper functions and embed resources:This executes the
go:generate directives in main.go:- Generates
gui/get/gtk.go(GTK widget accessors) - Embeds
wireguird.gladeand other resources via fileb0x
Why sudo? WireGuird uses
wg-quick to manage tunnels, which requires root privileges to configure network interfaces, routing tables, and DNS settings.Project Structure
Understanding the codebase organization will help you contribute more effectively:Code Style and Guidelines
Go Code Style
WireGuird follows standard Go conventions:Formatting
Formatting
Always run Or use
gofmt before committing:go fmt:Naming Conventions
Naming Conventions
- Exported functions/types: Use
PascalCase - Unexported functions/types: Use
camelCase - Constants: Use
PascalCase(e.g.,TunnelsPath,IconPath) - Package names: Use lowercase, single word (e.g.,
gui,settings)
gui/gui.go:17-22
Error Handling
Error Handling
Always handle errors explicitly. Don’t ignore them:For user-facing errors, use the
ShowError() function:gui/gui.go:106-118
Logging
Logging
Use structured logging with For user-visible logs in the UI, use
zerolog:wlog():GTK-Specific Guidelines
Thread Safety: GTK is not thread-safe. Always use
glib.IdleAdd() when updating UI from goroutines.gui/tunnels.go:868-871
Resource Management
Always destroy GTK objects when done to prevent memory leaks:Making Changes
Working with the UI (Glade)
The UI is defined inwireguird.glade, an XML file created with Glade.
Make UI Changes
- Edit widgets, layouts, and properties
- Set widget IDs (used by
Builder.GetObject()) - Configure signals (e.g., “clicked”, “activate”)
Widget IDs: When adding new widgets, give them descriptive IDs in Glade. These IDs are used to access widgets in the code:
Adding New Features
When adding functionality, follow this pattern:Create Handler Functions
Add event handlers in the appropriate file:
- Tunnel-related:
gui/tunnels.go - General UI:
gui/gui.go - Settings:
settings/settings.go
Adding Settings
To add a new user setting:
The settings will automatically be persisted as JSON when the user clicks “Save” in the settings window.
Testing
Currently, WireGuird doesn’t have automated tests, but manual testing is essential.Testing Checklist
Before submitting a PR, test these core features:- Tunnel scanning - Does the app correctly list tunnels from
/etc/wireguard/? - Connection - Can you activate a tunnel? Does the icon change?
- Disconnection - Can you deactivate a tunnel?
- Multiple tunnels - With the setting enabled, can you activate multiple tunnels?
- Single tunnel mode - With the setting disabled, does activating a new tunnel disconnect the old one?
- Add tunnel - Can you import
.confand.zipfiles? - Delete tunnel - Can you delete a tunnel?
- Edit tunnel - Can you edit and save tunnel configurations?
- Export tunnels - Can you export tunnels as a
.zipfile? - Settings - Do settings persist after closing the app?
- System tray - Does the tray icon update correctly? Do tray menu items work?
- Window behavior - Does “Start on tray” work? Does hiding/showing work?
- Update check - Does the update checker work (may need to modify version)?
Testing Environment
Create test tunnel configurations in/etc/wireguard/:
You can generate test keys with:
wg genkey | tee privatekey | wg pubkey > publickeyDebugging
Enable debug logging by creating a settings file:Submitting Pull Requests
Fork the Repository
Click “Fork” on GitHub to create your own copy
Create a Branch
feature/add-auto-connect- New featuresfix/crash-on-disconnect- Bug fixesdocs/update-readme- Documentation
Make Your Changes
- Write clean, well-documented code
- Follow the code style guidelines
- Test your changes thoroughly
Commit Your Changes
- Use present tense (“Add feature” not “Added feature”)
- Be descriptive but concise
- Reference issues when applicable (
Fixes #123)
PR Example
Reporting Issues
Found a bug? Have a feature request? Create an issue on GitHub.Bug Reports
Include the following information:Feature Requests
Building Packages
Debian Package
WireGuird includes a script to build.deb packages:
wireguird_amd64.deb in the current directory.
The package structure is defined in the deb/ directory:
Installing Locally
For development, use the install script:/opt/wireguird/ and creates a desktop entry.
Additional Resources
GitHub Repository
View source code and contribute
WireGuard Documentation
Learn about WireGuard configuration
GTK 3 Documentation
GTK 3 API reference
gotk3 Repository
Go bindings for GTK 3
Code of Conduct
Be respectful and constructive in all interactions. WireGuird is a community project, and we want everyone to feel welcome.- Be respectful - Treat everyone with respect
- Be constructive - Provide helpful feedback
- Be patient - Maintainers are volunteers
- Be collaborative - Work together to improve the project
Questions?
If you have questions about contributing:- Check existing issues and pull requests
- Read the README
- Ask in a new issue with the “question” label
