Contributing to asnmap

Thank you for your interest in contributing to asnmap! We welcome contributions from the community to help make this tool even better. Whether it's a bug report, a new feature, or documentation improvements, your help is appreciated.

Setting Up the Development Environment

To get started with development, you'll need to set up a local environment.

  1. Prerequisites:

    • Go version 1.21 or later.
    • Git.
  2. Clone the Repository:

    git clone https://github.com/projectdiscovery/asnmap.git
    cd asnmap

  3. Install Dependencies: The dependencies are managed by Go modules. You can tidy them up to ensure everything is in place.

    go mod tidy

Building from Source

The project includes a Makefile to simplify the build process.

make cli

This will compile the source code and create an asnmap binary in the current directory.

Running Tests

asnmap has a suite of tests to ensure code quality and correctness. Before submitting any changes, please run the tests to make sure everything is working as expected.

Note: The test suite requires a valid ProjectDiscovery Cloud Platform (PDCP) API key to be set as an environment variable, as it makes live API calls.

export PDCP_API_KEY="YOUR_API_KEY_HERE"
make test

Code Style and Linting

We use golangci-lint to maintain a consistent code style and catch common errors. The CI/CD pipeline will automatically run the linter on all pull requests.

You can run the linter locally by installing golangci-lint and executing it in the project root:

golangci-lint run

Submitting a Pull Request

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or bug fix: git checkout -b my-new-feature.
  3. Make your changes and commit them with a clear, descriptive message.
  4. Push your branch to your fork: git push origin my-new-feature.
  5. Open a Pull Request against the dev branch of the official projectdiscovery/asnmap repository.

Please provide a detailed description of your changes in the pull request. The maintainers will review your contribution, provide feedback, and merge it when it's ready.