npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ddmaster

v3.1.10

Published

Позволяет опрашивать мастер-сервер дднета

Downloads

86

Readme

ddmaster

Пакет для работы с ДДНет серверами. Сделал я, 0374flop. MIT лицензия (./LICENSE)


Установка

npm i ddmaster

Импорт

const ddmaster = require('ddmaster'); // CommonJS
import * as ddmaster from 'ddmaster'; // ESM / TypeScript

API

getrawDDNetServers() Возвращает сырую инфу с мастер сервера ДДНета. Структура ответа — { servers: DDNetServer[] }.

getDDNetServers(data?) Возвращает список серверов в виде ['ip:port']. data — опционально, сырая data от getrawDDNetServers(). Если не передана, сама получит.

findDDNetPlayerByName(playerName, data?) Ищет игрока по имени (строгое сравнение через ===) на всех серверах. Возвращает массив серверов (та же структура что у getrawDDNetServers), но только те где есть этот игрок. data — опционально, сырая data от getrawDDNetServers().

getinfoserver(address) Возвращает полную инфу об одном сервере по адресу 'ip:port'. Или undefined если не найден.

convertudptw(addr) Берёт адрес типа "tw-0.6+udp://203.86.233.50:8352" и возвращает просто "203.86.233.50:8352". Если адрес невалидный — возвращает null.

filterbycommunity(servers, community) Фильтрует массив серверов по community (например 'ddnet').

filterbylocation(servers, location) Фильтрует массив серверов по локации, точное совпадение (например 'eu:de').

filterbylocationincludes(servers, location) То же самое но через includes (например 'eu' найдёт 'eu:de', 'eu:pl' и тд).


Пример

const ddmaster = require('ddmaster');

// список всех серверов
const servers = await ddmaster.getDDNetServers();
console.log(servers); // ['ip:port', ...]

// найти игрока
const found = await ddmaster.findDDNetPlayerByName('имя игрока');
console.log(found); // массив серверов где есть игрок

// получить только европейские сервера
const raw = await ddmaster.getrawDDNetServers();
const eu = ddmaster.filterbylocationincludes(raw.servers, 'eu');

Позже добавлю ещё функции.

(типы чтобы было понятно)

export interface DDNetServer {
    addresses: string[];
    community: string;
    location: string;
    info: ServerInfo;
}

export interface ServerInfo {
    max_clients: number;
    max_players: number;
    passworded: boolean;
    game_type: string;
    flag: number;
    name: string;
    map: ServerMap;
    version: string;
    client_score_kind: string;
    requires_login: boolean;
    clients: ServerClient[];
}

export interface ServerMap {
    name: string;
    sha256: string;
    size: number;
}

export interface ServerClient {
    name: string;
    clan: string;
    country: number;
    score: number;
    is_player: boolean;
    skin: ClientSkin;
    afk: boolean;
    team: number;
}

export interface ClientSkin {
    name: string;
    color_body?: number;
    color_feet?: number;
}