pyre-cli 2.0.0 → 3.1.0
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 +98 -13
- package/dist/index.js +1278 -824
- package/package.json +1 -1
- package/src/formatters/index.ts +1 -1
- package/src/formatters/render.ts +2 -1
- package/src/index.ts +63 -3
- package/src/live/input.ts +99 -1
- package/src/live/render.ts +70 -32
- package/src/live/state.ts +22 -15
- package/src/live/types.ts +1 -1
- package/src/monitors/collectors.ts +1 -1
- package/src/p2p/client.ts +99 -25
- package/src/p2p/protocol.ts +45 -4
- package/src/p2p/server.ts +237 -29
- package/src/p2p/types.ts +30 -2
package/src/p2p/types.ts
CHANGED
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
* (host) and a pyre client (peer) over a TCP connection.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export type P2PMessageKind = 'auth' | 'auth-ok' | 'auth-fail' | 'data' | 'ping' | 'pong' | 'disconnect';
|
|
8
|
+
export type P2PMessageKind = 'auth' | 'auth-ok' | 'auth-fail' | 'data' | 'ping' | 'pong' | 'disconnect' | 'challenge';
|
|
9
9
|
|
|
10
10
|
export interface P2PMessage {
|
|
11
11
|
kind: P2PMessageKind;
|
|
12
12
|
payload: unknown;
|
|
13
|
+
hmac?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ChallengeMessage {
|
|
17
|
+
nonce: string;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
export interface AuthMessage {
|
|
16
|
-
|
|
21
|
+
passwordHash: string;
|
|
22
|
+
nonce: string;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
export interface AuthOkMessage {
|
|
@@ -42,6 +48,7 @@ export interface DisconnectMessage {
|
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export type P2PPayload =
|
|
51
|
+
| ChallengeMessage
|
|
45
52
|
| AuthMessage
|
|
46
53
|
| AuthOkMessage
|
|
47
54
|
| AuthFailMessage
|
|
@@ -56,16 +63,37 @@ export interface P2PServerOptions {
|
|
|
56
63
|
password: string;
|
|
57
64
|
intervalMs: number;
|
|
58
65
|
detailed: boolean;
|
|
66
|
+
tlsCert?: string;
|
|
67
|
+
tlsKey?: string;
|
|
68
|
+
tlsCA?: string;
|
|
69
|
+
rateLimitMaxAttempts?: number;
|
|
70
|
+
rateLimitWindowMs?: number;
|
|
71
|
+
allowedIPs?: string[];
|
|
72
|
+
deniedIPs?: string[];
|
|
73
|
+
auditLog?: string;
|
|
74
|
+
hmacKey?: string;
|
|
75
|
+
onLog?: (msg: string) => void;
|
|
76
|
+
onPeerEvent?: (event: { type: 'connect' | 'auth' | 'disconnect' | 'error' | 'blocked' | 'rate_limited'; detail: string; ts: number }) => void;
|
|
59
77
|
}
|
|
60
78
|
|
|
61
79
|
export interface P2PClientOptions {
|
|
62
80
|
host: string;
|
|
63
81
|
port: number;
|
|
64
82
|
password: string;
|
|
83
|
+
tls?: boolean;
|
|
84
|
+
tlsCA?: string;
|
|
85
|
+
tlsInsecure?: boolean;
|
|
86
|
+
auditLog?: string;
|
|
87
|
+
hmacKey?: string;
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
export interface P2PConnectionInfo {
|
|
68
91
|
host: string;
|
|
69
92
|
port: number;
|
|
70
93
|
peersConnected: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface RateLimitEntry {
|
|
97
|
+
attempts: number;
|
|
98
|
+
firstAttempt: number;
|
|
71
99
|
}
|