sing-box-kit 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,44 @@
1
- # sing-box Kit
1
+ # sing-box-kit
2
2
 
3
3
  Build and validate sing-box v1.14.4 configurations in TypeScript.
4
4
 
5
5
  ## Quick start
6
6
 
7
- Install the package with `bun add sing-box-kit`, then create `config.ts`.
7
+ Install the package with `bun add sing-box-kit`, then save this local proxy configuration as `config.ts`.
8
8
 
9
9
  ```ts
10
- import { compile, outbound } from "sing-box-kit";
11
-
12
- const config = compile({ outbounds: [outbound.direct({ tag: "direct" })] });
10
+ import { compile, inbound, outbound } from "sing-box-kit";
11
+
12
+ const proxy = inbound.mixed({ tag: "proxy" }).listen("127.0.0.1", { port: 1080 });
13
+ const direct = outbound.direct({ tag: "direct" });
14
+ const config = compile({
15
+ inbounds: [proxy],
16
+ outbounds: [direct],
17
+ route: { final: direct },
18
+ });
13
19
  console.log(JSON.stringify(config, null, 2));
14
20
  ```
15
21
 
16
- Generate JSON with `bun config.ts > config.json`.
22
+ Generate and check the config with sing-box.
23
+
24
+ ```sh
25
+ bun config.ts > config.json
26
+ sing-box check -c config.json
27
+ ```
17
28
 
18
- On Node.js 22.1 or later, save the same example as `config.mjs` and run `node config.mjs > config.json`.
29
+ On Node.js 22.1 or later, install with `npm install sing-box-kit`, save the same example as `config.mjs`, and generate JSON with `node config.mjs > config.json`.
19
30
 
20
31
  To run the example from a source checkout, run `vp install --frozen-lockfile` and use `./index` as the import path.
21
32
 
22
33
  ## Documentation
23
34
 
24
- - [Configuration reference](docs/configuration.md)
25
- - [Route and DNS rules](docs/rules.md)
35
+ - [Build and validate a configuration](docs/configuration.md)
36
+ - [Resource factories and registration](docs/resources.md)
37
+ - [Listen, dial, resolver, and TLS settings](docs/settings.md)
38
+ - [Routing rules and shared conditions](docs/rules.md)
39
+ - [DNS rules and response evaluation](docs/dns-rules.md)
40
+
41
+ ## Contributing
42
+
43
+ - [SBKit internals](docs/internal/README.md)
26
44
  - [Schema and type generation](schema/README.md)