yandex_internetometer

Yandex Internetometer client for Dart.

Package on pub.dev: yandex_internetometer
Русская версия README: README.ru.md

yandex_internetometer is primarily a reusable Dart library. The CLI in this package is only a thin wrapper around the library API.

The package can be used in two ways:

  • as a reusable Dart library for collecting IP, region, ISP and speed test data;
  • as a CLI executable that prints the same data in text, JSON, JSONL or Prometheus format.

The package is unofficial and is not affiliated with Yandex.

Features

  • Detects IPv4 and IPv6 addresses
  • Parses region and ISP/ASN from the Yandex Internetometer page
  • Measures latency, download speed and upload speed
  • Exposes a focused public API for library usage
  • Ships with a CLI executable
  • Supports text, JSON, JSONL and Prometheus output

Installation

Add the package:

dart pub add yandex_internetometer

For local development:

git clone https://github.com/GiaNTizmO/yandex_internetometer.git
cd yandex_internetometer
dart pub get

Library Usage

import 'dart:io';

import 'package:yandex_internetometer/yandex_internetometer.dart';

Future<void> main() async {
  final client = InternetometerClient(
    config: InternetometerConfig(
      language: InternetometerLanguage.en,
      concurrency: 4,
      requestTimeout: const Duration(seconds: 30),
    ),
  );

  try {
    final metadata = await client.getPageMetadata();
    final ipv4 = await client.getIPv4();
    final speed = await client.runSpeedTest();

    final record = MeasurementRecord(
      ipv4: ipv4,
      region: metadata.regionName,
      isp: metadata.isp?.name,
      asn: metadata.isp?.asn,
      downloadMbps: speed.downloadMbps,
      uploadMbps: speed.uploadMbps,
      latencyMs: speed.latency.inMilliseconds,
    );

    const formatter = MeasurementFormatter();
    stdout.writeln(formatter.toPrettyJson(record));
  } finally {
    client.close();
  }
}

A runnable version of this sample is available in example/main.dart.

CLI Usage

Run the package executable:

dart run internetometer --all

Or run the entrypoint directly:

dart run bin/internetometer.dart --json --speed

CLI Options

  • --ip prints IPv4, IPv6, region and ISP information
  • --speed runs latency, download and upload checks
  • --all runs the full measurement set
  • --json prints pretty JSON
  • --prometheus prints Prometheus metrics
  • --save path.jsonl appends the result as a JSONL record
  • --lang ru|en selects the Yandex page locale used for the region name
  • --concurrency 4 sets speed test parallelism
  • --timeout 60 sets the total timeout in seconds
  • --tui enables live terminal progress during the speed test

Output Example

{
  "ipv4": "203.0.113.10",
  "region": "Moscow",
  "isp": "Example Telecom",
  "asn": 64512,
  "download_mbps": 123.45,
  "upload_mbps": 98.76,
  "latency_ms": 11
}

Package Layout

  • lib/ public library API
  • bin/ CLI executable
  • example/ runnable example
  • test/ unit tests

Development

dart format .
dart analyze
dart test
dart pub publish --dry-run

CI And Release

This repository now includes:

  • .github/workflows/ci.yml for format, analyze, test, pub publish --dry-run and pana
  • .github/workflows/publish.yml for tag-based automated publishing to pub.dev
  • scripts/release.ps1 and scripts/release.sh for local release checks

Typical local release flow:

./scripts/release.sh --pana
git tag v0.1.0
git push origin v0.1.0

On Windows PowerShell:

./scripts/release.ps1 -RunPana -CreateTag -PushTag

Important: according to the official Dart publishing docs, the first release of a package must still be published manually with dart pub publish. GitHub Actions based automated publishing only works after the package already exists on pub.dev and automated publishing has been enabled in the package admin settings with a matching tag pattern such as v{{version}}.