# third.kns

> ## 1. 简介

Latest version **0.1.4** (published 2021-07-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install third.kns
pnpm add third.kns
yarn add third.kns
bun add third.kns
```

Provides the command `third.kns`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2021-07-18 |
| First published | 2021-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 24.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | erriy |
| Maintainers | erriy |

## Links

- npm: https://www.npmjs.com/package/third.kns
- Repository: https://github.com/Erriy/third.kns-node.js
- Homepage: https://github.com/Erriy/third.kns-node.js#readme
- Issues: https://github.com/Erriy/third.kns-node.js/issues
- npm.io page: https://npm.io/package/third.kns

## Dependencies (8)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [sqlite](https://npm.io/package/sqlite.md) ^4.0.23
- [express](https://npm.io/package/express.md) ^4.17.1
- [sqlite3](https://npm.io/package/sqlite3.md) ^5.0.2
- [url-join](https://npm.io/package/url-join.md) ^4.0.1
- [commander](https://npm.io/package/commander.md) ^7.2.0
- [third.kit](https://npm.io/package/third.kit.md) ^0.1.0
- [appdata-path](https://npm.io/package/appdata-path.md) ^1.0.0

## Recent versions

- 0.1.4 (latest) — 2021-07-18
- 0.1.3 — 2021-07-14
- 0.1.2 — 2021-07-13

## README

# third.kns

## 1. 简介

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

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

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

## 2. 安装

```shell
npm i -g third.kns
```

## 3. 使用方法

### 3.1 服务端

#### 3.1.1 docker

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

#### 3.1.2 npm

```shell
# 启动服务
third.kns service
```

### 3.2 客户端

#### 3.2.1 npm

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

#### 3.2.2 nodejs 嵌入

```javascript
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](https://www.npmjs.com/package/multicast-dns))
- [ ] 验证 dht 稳定性（当前仅编写代码但并未测试）
- [ ] 完善单 key 多设备支持（已编写逻辑，但未完善使用方法）
  - 使用 gpg 签发信任设备，把设备 key 当作 subkey 使用
  - 查找 gpg 主 key，返回
- [ ] 支持存储任意格式数据

---
_Source: https://npm.io/package/third.kns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
