Thank you for considering contributing to the DNS-Server-Rust project! 🎉 This document provides guidelines to help you successfully contribute, whether you’re fixing bugs, improving documentation, or adding features.
- How Can I Contribute?
- Project Structure
- Code Guidelines
- Pull Request Process
- Testing
- Getting Started
- Code of Conduct
If you encounter a bug or unexpected behavior:
- Check if it has already been reported in Issues.
- If not, open a new issue with the following details:
- A clear and descriptive title.
- Steps to reproduce the problem.
- The version of Rust and operating system.
- Any error messages or relevant logs.
- Screenshots (if applicable).
We’re always open to suggestions! If you have an idea:
- Check the Issues to see if the feature has already been requested.
- Open a new issue using the "Feature Request" template:
- Describe the feature clearly.
- Explain the use case or problem it solves.
- Include any references or links that might help.
Documentation is key for a successful project. If you notice any gaps:
- Update existing README or inline comments.
- Add examples or clarify confusing areas.
- Submit a Pull Request for documentation changes.
Follow these steps to contribute code:
-
Fork the Repository
Go to the project repository and click the Fork button. -
Clone the Repository
Clone your forked repository:git clone https://github.com/SkySingh04/DNS-Server-Rust/DNS-Server-Rust.git cd DNS-Server-Rust
-
Create a Branch
Use a descriptive branch name:git checkout -b feature/my-new-feature
-
Implement Your Changes
Follow the Code Guidelines. -
Test Your Code
Ensure your changes do not break existing functionality:cargo test
-
Commit Your Changes
Write meaningful commit messages:git add . git commit -m "Add support for MX record type"
-
Push and Submit a PR
Push your changes:git push origin feature/my-new-feature
Then create a Pull Request on GitHub.
Here’s an overview of the key files and directories:
DNS-Server-Rust/
│
├── src/
│ ├── main.rs # Entry point of the application
│ ├── protocol/
│ │ ├── dnsheader.rs # DNS Header implementation
│ │ ├── dnsquestion.rs # DNS Question section
│ │ ├── dnsrecord.rs # DNS Record section
│ │ ├── dnspacket.rs # DNS Packet handling
│ │ ├── byte_packet_buffer.rs # Reads/writes DNS packets
│ │ ├── querytype.rs # Query type implementation
│ │ ├── resultcode.rs # DNS response codes
│ │
├── response_packet.txt # Sample DNS response packet
├── Cargo.toml # Rust dependencies
├── README.md # Project overview and notes
└── CONTRIBUTING.md # Contribution guidelines
Follow these coding standards for consistency:
-
Formatting: Use
rustfmt
for consistent formatting.rustfmt src/*.rs
-
Linting: Ensure clean code using
clippy
.cargo clippy
-
Error Handling: Use
Result
and proper error handling instead of panics. -
Testing: Write unit tests for all new features and edge cases.
-
Naming: Use snake_case for variables and functions, and PascalCase for types.
-
Documentation: Add comments and Rust docstrings (
///
) for public modules and functions.
- Ensure your PR targets the main branch.
- Include a concise description of the changes.
- Reference any related issues (e.g.,
Fixes #123
). - Ensure the code compiles without errors or warnings.
- Write or update tests, if applicable.
- Add documentation if needed.
Once submitted, maintainers will review your PR. Be open to feedback and iterate as necessary.
Run tests locally using Cargo:
cargo test
For any new feature, write tests in the corresponding file under src/protocol/
.
To set up the project locally:
-
Ensure you have Rust installed. If not, install it using rustup.
-
Clone the repository:
git clone https://github.com/SkySingh04/DNS-Server-Rust/DNS-Server-Rust.git cd DNS-Server-Rust
-
Build and run the project:
cargo run
-
Test the DNS server using
dig
:dig @127.0.0.1 -p 2053 google.com
This project adheres to the Contributor Covenant. Please be respectful to others, whether you’re contributing code, opening an issue, or participating in discussions.
Thank you for contributing to DNS-Server-Rust! Let’s build something awesome together. 🚀