third.kns

0.1.4 • Public • Published

third.kns

1. 简介

third 套件,类似 dns 服务解析的 key name service 解析服务,简称 kns

提交的数据只会在服务端临时保存 5 分钟,超时则自动删除。

provide 命令会自动每分钟提交一次数据(watchdog)

2. 安装

npm i -g third.kns

3. 使用方法

3.1 服务端

3.1.1 docker

git clone https://github.com/Erriy/third.kns-node.js.git &&
cd third.kns-node.js &&
docker-compose up --build

3.1.2 npm

# 启动服务
third.kns service

3.2 客户端

3.2.1 npm

# privode
third.kns provide -n test -s testservice
# lookup
third.kns lookup -n test # stdout: testservice

3.2.2 nodejs 嵌入

const third = require("third.kit");
const driver = require("third.kns").driver;

(async () => {
  await third.init();
  // 传入bootstrap启动服务器
  const d = await driver.init(["http://third.on1y.net:5353"]);
  // privode
  await d.provide({ name: "test", service: "service" });
  // lookup
  console.log(await d.lookup(third.runtime.key.fingerprint, "test"));
})();

todo

  • [ ] 支持 mdns 内网设备发现(使用multicast-dns)
  • [ ] 验证 dht 稳定性(当前仅编写代码但并未测试)
  • [ ] 完善单 key 多设备支持(已编写逻辑,但未完善使用方法)
    • 使用 gpg 签发信任设备,把设备 key 当作 subkey 使用
    • 查找 gpg 主 key,返回
  • [ ] 支持存储任意格式数据

Readme

Keywords

none

Package Sidebar

Install

npm i third.kns

Weekly Downloads

3

Version

0.1.4

License

MIT

Unpacked Size

24.6 kB

Total Files

17

Last publish

Collaborators

  • erriy