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

ip2vn

v1.1.0

Published

SDK chính thức của IP2.VN — điều khiển proxy xoay IP dân cư Viettel cho bên làm tool tích hợp.

Readme

ip2vn

SDK JavaScript chính thức của IP2.VN — điều khiển proxy xoay IP dân cư Viettel cho bên làm tool tích hợp. Không phụ thuộc thư viện ngoài, cần Node 18+ (có sẵn fetch).

npm install ip2vn

Mô hình giới thiệu (hoa hồng 10%)

Tool của bạn nhúng mã giới thiệu công khai của bạn và đưa người dùng đăng ký qua IP2.refLink('MÃ'). Người dùng tự mua proxy, tự tạo key theo từng cổng rồi dán vào tool; bạn ăn 10% chi tiêu của họ.

An toàn: chỉ nhúng mã giới thiệu (công khai). TUYỆT ĐỐI không nhúng key, mật khẩu hay token vào tool phát đi — tool nào cũng bung xem được. Key là của chính người dùng cuối, không phải của bạn.

Dùng

import { IP2, IP2Error } from 'ip2vn';

// Link đưa cho người dùng để họ gắn với bạn:
console.log(IP2.refLink('MÃ_GIỚI_THIỆU_CỦA_BẠN'));  // https://ip2.vn/?ref=...

// Người dùng dán key cổng của họ vào tool của bạn:
const cong = new IP2('ip2_xxxxxxxxxxxx');

const tin = await cong.info();        // host, port, ip, cooldown, expire_at, ...
const kq  = await cong.rotate();      // { ip, previous_ip, took, next_allowed_in }
await cong.auto(300);                 // hẹn tự xoay mỗi 300s (0 để tắt, thấp nhất 180)
const ls  = await cong.history({ limit: 20 });
await cong.renew(30);                 // gia hạn 1/7/30 ngày, trừ ví người dùng

// Chuỗi proxy sẵn dùng (user/pass proxy do người dùng nhập):
const px = await cong.proxy({ username: 'u', password: 'p' });
console.log(px.url);   // http://u:p@host:port
console.log(px.tho);   // host:port:u:p

try { await cong.rotate(); }
catch (e) {
  if (e instanceof IP2Error) console.error(e.code, e.message, e.retryAfter);
}

Khoá theo mã giới thiệu (tuỳ chọn)

Muốn tool chỉ chạy cho khách đã đăng ký qua bạn? Truyền ref là mã giới thiệu của bạn — SDK sẽ hỏi máy chủ xem chủ key có phải khách của bạn không, không phải thì mọi lệnh ném IP2Error code sai_ref:

const cong = new IP2(keyNguoiDung, { ref: 'MÃ_GIỚI_THIỆU_CỦA_BẠN' });
await cong.rotate();   // chỉ chạy nếu key thuộc khách bạn giới thiệu

Không truyền ref thì không khoá gì. Lưu ý: đây là khoá mềm — phép kiểm đúng ở máy chủ, nhưng quyết định khoá nằm trong SDK nên người bẻ khoá tool vẫn qua được, và nó chỉ chặn lệnh đi qua SDK, không chặn ai cắm thẳng host:port:user:pass.

Phương thức

| Gọi | Trả về | |---|---| | info() | host, port, line, ip, protocol, auto, cooldown, expire_at, rotations | | rotate({wait}) | ip, previous_ip, took, next_allowed_in | | auto(giây) | auto, every, next_at | | history({limit, since}) | total, items[{ip, at}] | | renew(1\|7\|30) | days_added, charged, wallet_balance, expire_at | | proxy({username, password, protocol}) | host, port, url, tho | | IP2.refLink(mã) | https://ip2.vn/?ref=mã |

Lỗi ném ra IP2Error với .code (máy đọc), .message (tiếng Việt), .status (HTTP), .retryAfter (giây, khi dính cooldown).

Cổng nghe cả HTTP lẫn SOCKS5 trên cùng một port — chọn giao thức chỉ đổi cách viết chuỗi, không đổi port.

MIT © IP2.VN