Skip to content

Commit d745376

Browse files
style: add prettier
1 parent ec23fa7 commit d745376

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/dist
2+
/node_modules
3+
pnpm-lock.yaml

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"license": "MIT",
99
"scripts": {
1010
"build": "rollup -c",
11-
"watch": "rollup -c -w"
11+
"watch": "rollup -c -w",
12+
"format": "prettier -w ."
1213
},
1314
"devDependencies": {
1415
"@rollup/plugin-commonjs": "^25.0.2",
@@ -20,6 +21,7 @@
2021
"node-fetch": "^3.3.1",
2122
"pino": "^8.14.1",
2223
"pino-pretty": "^10.0.0",
24+
"prettier": "^2.8.8",
2325
"rollup": "^3.25.1",
2426
"rollup-plugin-esbuild": "^5.0.0",
2527
"tslib": "^2.5.3",

pnpm-lock.yaml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ export const config = {
33
port: 5351,
44
exec: "natmap",
55

6-
bindPort: Object.defineProperty([9000, 9999] as readonly [number, number], "toJSON", {
7-
value() {
8-
return `${this[0]}-${this[1]}`;
9-
},
10-
}),
6+
bindPort: Object.defineProperty(
7+
[9000, 9999] as readonly [number, number],
8+
"toJSON",
9+
{
10+
value() {
11+
return `${this[0]}-${this[1]}`;
12+
},
13+
}
14+
),
1115
stunServer: "stunserver.stunprotocol.org",
1216
holdServer: "qq.com",
1317

src/server/nat-pmp-handler.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,7 @@ export class NatPmpHandler extends Handler {
111111
this.logger.info(
112112
`Request new ${Protocol[protocol]} port mapping: ${this.remote.address}:${sourcePort} => ${externalPort}, lifetime ${lifetime}s`
113113
);
114-
const info = start(
115-
this.remote.address,
116-
sourcePort,
117-
protocol,
118-
lifetime
119-
);
114+
const info = start(this.remote.address, sourcePort, protocol, lifetime);
120115
await info.ready;
121116
const buf = this.allocResponse(16);
122117
buf.writeUInt16BE(sourcePort, 8);

0 commit comments

Comments
 (0)