From 765bc6616259c02fbc8d211d3c2b69b2f4014fc9 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 4 Feb 2025 10:50:46 +0100 Subject: [PATCH] Sets up empty project --- .gitignore | 16 ++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ codexcrawler.nim | 5 +++++ codexcrawler.nimble | 27 +++++++++++++++++++++++++++ codexcrawler/todo.nim | 2 ++ tests/codexcrawler/exampletest.nim | 7 +++++++ tests/test.nim | 3 +++ tests/test.nimble | 14 ++++++++++++++ 8 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 codexcrawler.nim create mode 100644 codexcrawler.nimble create mode 100644 codexcrawler/todo.nim create mode 100644 tests/codexcrawler/exampletest.nim create mode 100644 tests/test.nim create mode 100644 tests/test.nimble diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ab1e78 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +* +!*.* +!*/ +coverage +nimcache +tests/testAll +nimble.develop +nimble.paths +nim.cfg +nimbus-build-system.paths +vendor/* +NimBinaries +.update.timestamp +*.dSYM +.vscode/* +*.exe diff --git a/README.md b/README.md new file mode 100644 index 0000000..57a023c --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Codex Network Crawler + +[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) +[![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](#stability) +[![CI (GitHub Actions)](https://github.com/codex-storage/nim-codex-dht/workflows/CI/badge.svg?branch=master)](https://github.com/codex-storage/nim-codex-dht/actions/workflows/ci.yml?query=workflow%3ACI+branch%3Amaster) +[![codecov](https://codecov.io/gh/codex-storage/nim-codex-dht/branch/master/graph/badge.svg?token=tlmMJgU4l7)](https://codecov.io/gh/codex-storage/nim-codex-dht) + +# !! Work in Progress !! + +This project uses nim-codex-dht, nim-libp2p, nim-ethers, and nim-metrics to create a metrics service. The crawler will traverse the Codex network and produce metrics such as: +- Number of DHT nodes (alive vs total) +- P2P connectivity (percentage) +- Storage contract statistics (created, total size, average size, average duration, pricing information??) + +Metrics are published from a scrape target. + +# Usage + +```sh +nimble build +nimble test +nimble run +``` diff --git a/codexcrawler.nim b/codexcrawler.nim new file mode 100644 index 0000000..c690b76 --- /dev/null +++ b/codexcrawler.nim @@ -0,0 +1,5 @@ +import + ./codexcrawler/todo + +when isMainModule: + run() diff --git a/codexcrawler.nimble b/codexcrawler.nimble new file mode 100644 index 0000000..34e9622 --- /dev/null +++ b/codexcrawler.nimble @@ -0,0 +1,27 @@ +# Package + +version = "0.0.1" +author = "Codex core contributors" +description = "Crawler for Codex networks" +license = "MIT" +skipDirs = @["tests"] +bin = @["codexcrawler"] + +# Dependencies +# requires "secp256k1#2acbbdcc0e63002a013fff49f015708522875832" # >= 0.5.2 & < 0.6.0 +# requires "protobuf_serialization" # >= 0.2.0 & < 0.3.0 +# requires "nimcrypto >= 0.5.4" +# requires "bearssl == 0.2.5" +# requires "chronicles >= 0.10.2 & < 0.11.0" +# requires "chronos >= 4.0.3 & < 5.0.0" +# requires "libp2p == 1.5.0" +# requires "metrics" +# requires "stew#head" +# requires "stint" +# requires "https://github.com/codex-storage/nim-datastore >= 0.1.0 & < 0.2.0" +# requires "questionable" + +task test, "Run tests": + exec "nimble install -d -y" + withDir "tests": + exec "nimble test" diff --git a/codexcrawler/todo.nim b/codexcrawler/todo.nim new file mode 100644 index 0000000..d59f01f --- /dev/null +++ b/codexcrawler/todo.nim @@ -0,0 +1,2 @@ +proc run*() = + echo "Run!" diff --git a/tests/codexcrawler/exampletest.nim b/tests/codexcrawler/exampletest.nim new file mode 100644 index 0000000..ca0d9b4 --- /dev/null +++ b/tests/codexcrawler/exampletest.nim @@ -0,0 +1,7 @@ +import pkg/asynctest/chronos/unittest + +suite "Example tests": + test "Example": + echo "Woo!" + check: + 1 == 1 diff --git a/tests/test.nim b/tests/test.nim new file mode 100644 index 0000000..d7c2006 --- /dev/null +++ b/tests/test.nim @@ -0,0 +1,3 @@ +import ./codexcrawler/exampletest + +{.warning[UnusedImport]: off.} diff --git a/tests/test.nimble b/tests/test.nimble new file mode 100644 index 0000000..fc00119 --- /dev/null +++ b/tests/test.nimble @@ -0,0 +1,14 @@ +# Package + +version = "0.0.1" +author = "Codex core contributors" +description = "Tests for crawler for Codex networks" +license = "MIT" +installFiles = @["build.nims"] + +# Dependencies +requires "asynctest >= 0.5.2 & < 0.6.0" +requires "unittest2 <= 0.0.9" + +task test, "Run tests": + exec "nim c -r test.nim"