10 KiB
Contributing to NodePass
Thank you for your interest in contributing to NodePass! We welcome all kinds of contributions, from bug reports and feature requests to code improvements and documentation updates.
Table of Contents
- Organization
- Code of Conduct
- Getting Started
- Development Setup
- Contributing Guidelines
- Code Style and Standards
- Testing
- Documentation
- Submitting Changes
- Community and Support
Code of Conduct
Please read and follow our Code of Conduct. We are committed to providing a welcoming and inclusive environment for all contributors.
Getting Started
Prerequisites
- Go (as specified in
go.mod
) - Git for version control
- Docker (optional, for container-based development and testing)
- Basic knowledge of TCP/UDP networking concepts
- Familiarity with TLS/SSL concepts for security features
Understanding the Architecture
NodePass is built on a three-tier architecture:
- Server Mode: Accepts incoming tunnel connections with configurable security
- Client Mode: Establishes outbound connections to tunnel servers
- Master Mode: Provides RESTful API for dynamic instance management
Key components:
/cmd/nodepass/
: Main application entry point and core dispatch logic/internal/
: Core implementation packages (server, client, master, common utilities)/docs/
: Comprehensive documentation in English and Chinese- External dependencies: NodePassProject ecosystem libraries for certificates, connections, logging, and pooling
Development Setup
1. Fork and Clone
# Fork the repository on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/nodepass.git
cd nodepass
# Add the upstream repository
git remote add upstream https://github.com/yosebyte/nodepass.git
2. Install Dependencies
# Download and install dependencies
go mod download
# Verify dependencies
go mod verify
3. Build and Test
# Build the application
go build -o nodepass ./cmd/nodepass
# Test the build
./nodepass "server://localhost:10101/127.0.0.1:8080?log=debug&tls=0"
4. Development with Docker (Optional)
# Build development container
docker build --build-arg VERSION=dev -t nodepass:dev .
# Run in container
docker run --rm -p 10101:10101 nodepass:dev "server://:10101/127.0.0.1:8080?log=debug&tls=0"
Contributing Guidelines
Types of Contributions
- 🐛 Bug Reports: Help us identify and fix issues
- ✨ Feature Requests: Suggest new features or improvements
- 📝 Documentation: Improve existing docs or add new ones
- 🔧 Code Contributions: Bug fixes, feature implementations, refactoring
- 🌐 Translations: Help translate documentation to other languages
- 🧪 Testing: Add test cases and improve test coverage
Reporting Issues
When reporting bugs or requesting features, please:
- Search existing issues to avoid duplicates
- Use our issue templates when available
- Provide detailed information:
- NodePass version and build information
- Operating system and architecture
- Network configuration details
- Complete command-line arguments used
- Expected vs. actual behavior
- Relevant log output (use
log=debug
for detailed logs) - Steps to reproduce the issue
Feature Requests
For new features:
- Check the roadmap and existing feature requests
- Describe the use case clearly
- Explain the expected behavior
- Consider backwards compatibility
- Discuss implementation approach if you plan to contribute code
Code Style and Standards
Go Code Style
We follow standard Go conventions with project-specific guidelines:
- Write idiomatic Go code following Effective Go
- Use
gofmt
for consistent formatting andgo vet
to catch common errors - Follow the single responsibility principle and prefer composition over inheritance
- Use descriptive variable and function names with proper Go naming conventions
- Include both Chinese and English comments for public APIs (maintaining project tradition)
- Implement proper error handling with context wrapping
- Use the project's logging framework consistently with appropriate log levels
- Protect shared state with mutexes and use channels for goroutine coordination
- Always handle goroutine cleanup with proper defer and recover patterns
Configuration and CLI
- Use URL-based configuration syntax:
scheme://[password@]host:port/target?param=value
- Support environment variables for sensitive configuration
- Provide sensible defaults for all optional parameters
- Validate configuration early in the application lifecycle
Performance Considerations
- Minimize allocations in hot paths
- Use connection pooling for frequent connections
- Implement graceful degradation under load
- Profile memory and CPU usage for critical paths
- Use buffered I/O where appropriate
Testing
Testing Strategy
Currently, the project focuses on integration testing through real-world usage scenarios. We welcome contributions to improve test coverage:
Manual Testing
- Basic Functionality: Test server, client, and master modes with debug logging
- TLS Modes: Verify all three TLS security levels (0, 1, 2)
- Protocol Support: Test TCP tunneling and UDP forwarding with various applications
Future Testing Goals
We encourage contributions in these areas:
- Unit Tests for individual functions and methods
- Integration Tests for component interactions
- Benchmark Tests for performance regression detection
- Fuzzing Tests for security and robustness
- End-to-End Tests for complete workflow validation
Testing Guidelines
When adding tests:
- Use Go's standard testing package with
*_test.go
naming convention - Write table-driven tests where applicable
- Include both positive and negative test cases
- Test error conditions and edge cases
- Use meaningful test names that describe the scenario
Documentation
Documentation Standards
- Write in clear, simple English
- Include practical examples for all features
- Maintain both English and Chinese versions when possible
- Use consistent formatting and structure
- Test all code examples to ensure they work
Documentation Structure
README.md
: Project overview and quick startdocs/en/
: English documentationdocs/zh/
: Chinese documentation- Inline code comments for complex logic
- API documentation for master mode endpoints
Contributing to Documentation
- Update both language versions when possible
- Test all examples before submitting
- Use proper Markdown formatting
- Include relevant screenshots for UI components
- Cross-reference related documentation
Submitting Changes
Pull Request Process
-
Create a feature branch from the latest
main
:git checkout main git pull upstream main git checkout -b feature/your-feature-name
-
Make your changes following the guidelines above
-
Test your changes thoroughly by building the application and running real scenarios
-
Commit your changes with descriptive messages using Conventional Commits format:
feat
: New featurefix
: Bug fixdocs
: Documentation changesrefactor
: Code refactoringperf
: Performance improvementstest
: Adding or updating tests
-
Push to your fork and create a pull request
Commit Message Guidelines
Use Conventional Commits format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Examples:
feat(server): add support for IPv6 addresses
fix(client): resolve connection timeout issues in high-latency networks
docs: update installation guide with Docker instructions
refactor(common): simplify address parsing logic
Pull Request Guidelines
Before submitting:
- Code follows the project style guidelines
- All tests pass (or explain why they should be skipped)
- Documentation is updated if needed
- Commit messages follow the conventional format
- No merge conflicts with the main branch
In your pull request:
- Provide a clear description of changes
- Reference any related issues
- Include testing instructions
- Add screenshots for UI changes
- List any breaking changes
Review Process
- Automated checks run on all pull requests
- Code review by project maintainers
- Testing in various environments
- Documentation review for user-facing changes
- Final approval and merge
Community and Support
Communication Channels
- GitHub Issues: Bug reports and feature requests
- Telegram Channel: @NodePassChannel - Updates and announcements
- Telegram Group: @NodePassGroup - Community discussion
- Discord: Join our server - Real-time chat
Getting Help
If you need help:
- Check the documentation in the
docs/
directory - Search existing issues for similar problems
- Ask in our community channels for general questions
- Create a GitHub issue for bugs or feature requests
Recognition
We appreciate all contributions! Contributors will be:
- Listed in our contributors section
- Mentioned in release notes for significant contributions
- Invited to become maintainers for consistent, high-quality contributions
Maintainer Responsibilities
Current maintainers handle:
- Code review and pull request management
- Release planning and version management
- Community management and support
- Security issue handling
- Roadmap planning and prioritization
Thank you for contributing to NodePass! Your contributions help make universal TCP/UDP tunneling more accessible and reliable for everyone.
For questions about contributing, please reach out through our community channels or create a GitHub issue.