Contributing Guidelines
Thank you for considering contributing to nx9-dns-server! This document outlines the process for contributing to the project and provides guidelines to ensure your contributions can be efficiently reviewed and integrated.
Table of Contents
- Code of Conduct
- Getting Started
- Development Environment
- Contribution Workflow
- Code Style
- Testing Guidelines
- Documentation
- Priority Areas
- Issue and Pull Request Process
- Commit Message Guidelines
- Review Process
- Release Process
- Getting Help
Code of Conduct
All contributors are expected to adhere to our Code of Conduct. Please read CODE_OF_CONDUCT.md before contributing to ensure a respectful and inclusive environment for everyone.
Getting Started
- Fork the repository on GitHub
- Clone your fork to your local machine:
bash git clone https://github.com/YOUR_USERNAME/nx9-dns-server.git cd nx9-dns-server
- Add the upstream repository as a remote to keep your fork in sync:
bash git remote add upstream https://github.com/thakares/nx9-dns-server.git
- Create a new branch for your contribution:
bash git checkout -b feature/your-feature-name
Development Environment
Prerequisites
- Rust (latest stable version) - Installation instructions
- SQLite development libraries
- OpenSSL development libraries
Setup
-
Install Rust dependencies:
bash cargo install cargo-audit cargo-watch cargo-insta
-
Set up pre-commit hooks:
bash cp hooks/pre-commit .git/hooks/ chmod +x .git/hooks/pre-commit
-
Build the project:
bash cargo build
-
Create a development database:
bash cp conf/dns.db.sample dev-dns.db sqlite3 dev-dns.db < conf/dns_records.sql
-
Run the tests:
bash cargo test
-
Start the server in development mode:
bash DNS_DB_PATH=dev-dns.db DNS_BIND=127.0.0.1:5353 cargo run
Contribution Workflow
-
Sync your fork with the upstream repository:
bash git fetch upstream git checkout main git merge upstream/main git push origin main
-
Create a new branch for your work:
bash git checkout -b feature/your-feature-name
-
Implement your changes
-
Add tests for your changes
-
Update documentation if necessary
-
Run tests to ensure they pass:
bash cargo test
-
Format your code:
bash cargo fmt
-
Run lints:
bash cargo clippy
-
Commit your changes with meaningful commit messages
-
Push your branch to your fork:
bash git push origin feature/your-feature-name
-
Create a Pull Request from your fork to the upstream repository
Code Style
We follow the standard Rust style guidelines. All code should be formatted using rustfmt
and should pass clippy
checks:
```bash
Format code
cargo fmt
Run clippy
cargo clippy -- -D warnings ```
Additional style guidelines:
- Use meaningful variable names
- Add comments for complex logic
- Keep functions small and focused
- Use Rust idioms and patterns
- Avoid using
unsafe
code without strong justification - Use type-safe approaches rather than string manipulation when possible
Testing Guidelines
All new features and bug fixes should include appropriate tests:
- Unit tests: Test individual components in isolation
- Integration tests: Test components working together
- End-to-end tests: Test complete workflows
To run tests:
```bash
Run all tests
cargo test
Run specific test
cargo test test_name
Run tests with extended output
cargo test -- --nocapture ```
For DNS-specific testing, use the included test scripts in the tools/
directory:
bash
./tools/dnscheck.sh 127.0.0.1:5353
Documentation
Documentation is crucial for the project's usability:
- Code Documentation: All public API interfaces should have rustdoc comments
- Wiki: Update wiki pages when adding or changing features
- README: Keep the README up-to-date with current features and instructions
- Examples: Provide example configurations and usage scenarios
Generate documentation locally:
bash
cargo doc --open
Priority Areas
We're currently focusing on these key areas for contributions:
- Web UI Development:
- Implementation of administrative interface
- Record management components
- Dashboard visualizations
-
User experience improvements
-
API Service:
- RESTful API implementation
- Authentication and authorization
- Rate limiting and security
-
API documentation
-
User Management:
- Authentication mechanisms
- Role-based access control
- User profile management
-
Multi-factor authentication
-
Testing Improvements:
- Automated integration tests
- Performance benchmarks
- Security testing
-
Test coverage improvements
-
Documentation:
- User guides
- API documentation
- Deployment scenarios
- Troubleshooting guides
Issue and Pull Request Process
Creating Issues
- Use issue templates when available
- Provide clear reproduction steps for bugs
- Include environment details (OS, Rust version, etc.)
- For feature requests, explain the use case and benefits
Pull Request Process
- Reference any related issues using GitHub keywords (e.g., "Fixes #123")
- Provide a clear description of the changes
- Include screenshots for UI changes
- Add notes about testing done
- Update documentation as needed
- Ensure CI checks pass
Commit Message Guidelines
We follow a simplified version of the Conventional Commits format:
```
[optional body]
[optional footer] ```
Types include: - feat: A new feature - fix: A bug fix - docs: Documentation changes - style: Code style changes (formatting, etc.) - refactor: Code refactoring - test: Adding or updating tests - chore: Updates to build process, dependencies, etc.
Example: ``` feat(dns): add support for CAA record type
Implement support for Certificate Authority Authorization records according to RFC 6844.
Resolves: #45 ```
Review Process
All contributions undergo review before being merged:
- Automated checks: CI pipeline for tests, linting, and security scans
- Code review: At least one maintainer must approve the changes
- Discussion: Address any feedback or questions
- Final approval: Maintainer approves and merges
Expect feedback within 1-2 weeks. Please be responsive to review comments.
Release Process
nx9-dns-server follows semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR: Incompatible API changes
- MINOR: New functionality in a backward-compatible manner
- PATCH: Backward-compatible bug fixes
Release steps:
1. Update version in Cargo.toml
and other relevant files
2. Update CHANGELOG.md
with notable changes
3. Create a release tag
4. Build and publish release artifacts
Getting Help
If you need assistance with contributing:
- Open a discussion on GitHub
- Check existing issues and PRs for similar topics
- Join our community chat (link in project README)
- Email the maintainers directly for sensitive matters
Thank you for contributing to nx9-dns-server! Your efforts help improve DNS infrastructure for everyone.