Thank you for your interest in contributing to Nerva! This document provides guidelines for contributing to the project.
- Go 1.18 or higher
- Git
# Clone the repository
git clone https://github.com/praetorian-inc/nerva.git
cd nerva
# Build the project
go build ./cmd/nerva
# Run tests
go test ./...- Check existing issues to avoid duplicates
- Create a new issue with:
- Clear, descriptive title
- Steps to reproduce
- Expected vs actual behavior
- Go version and OS information
- Open an issue describing the feature
- Explain the use case and benefits
- Wait for feedback before implementing
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Add tests for new functionality
- Ensure all tests pass:
go test ./... - Run linting:
go vet ./... - Commit with clear messages
- Push and create a Pull Request
Nerva uses a plugin architecture for service detection. To add a new protocol:
- Create a new directory under
pkg/plugins/services/ - Implement the
Plugininterface - Add tests in
*_test.go - Register the plugin in
pkg/plugins/plugins.go
package myprotocol
import (
"github.com/praetorian-inc/nerva/pkg/scan"
)
type Plugin struct{}
func (p *Plugin) Run(conn net.Conn, timeout time.Duration, target scan.Target) (*scan.Result, error) {
// Detection logic here
}
func (p *Plugin) PortPriority(port uint16) bool {
return port == 1234 // Default port for this protocol
}
func (p *Plugin) Name() string {
return "myprotocol"
}
func (p *Plugin) Type() scan.TransportProtocol {
return scan.TCP
}- Follow standard Go conventions
- Use
gofmtfor formatting - Add comments for exported functions
- Keep functions focused and testable
- All new features require tests
- Run the full test suite before submitting PRs
- Use the
pkg/testutilities for integration tests
Open an issue or reach out to the maintainers.