@bumail/smtp 0.1.0 → 0.2.1

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.
Files changed (65) hide show
  1. package/README.md +149 -7
  2. package/dist/chunks/index-3423jxf9.js +249 -0
  3. package/dist/chunks/index-3423jxf9.js.map +14 -0
  4. package/dist/client/content.d.ts +25 -0
  5. package/dist/client/content.d.ts.map +1 -0
  6. package/dist/client/inbox.d.ts +18 -0
  7. package/dist/client/inbox.d.ts.map +1 -0
  8. package/dist/client/index.d.ts +6 -0
  9. package/dist/client/index.d.ts.map +1 -0
  10. package/dist/client/index.js +948 -0
  11. package/dist/client/index.js.map +22 -0
  12. package/dist/client/mx.d.ts +29 -0
  13. package/dist/client/mx.d.ts.map +1 -0
  14. package/dist/client/options.d.ts +136 -0
  15. package/dist/client/options.d.ts.map +1 -0
  16. package/dist/client/refusal.d.ts +15 -0
  17. package/dist/client/refusal.d.ts.map +1 -0
  18. package/dist/client/send.d.ts +13 -0
  19. package/dist/client/send.d.ts.map +1 -0
  20. package/dist/client/session.d.ts +11 -0
  21. package/dist/client/session.d.ts.map +1 -0
  22. package/dist/client/settings.d.ts +30 -0
  23. package/dist/client/settings.d.ts.map +1 -0
  24. package/dist/client/socket.d.ts +31 -0
  25. package/dist/client/socket.d.ts.map +1 -0
  26. package/dist/client/target.d.ts +29 -0
  27. package/dist/client/target.d.ts.map +1 -0
  28. package/dist/client/transaction.d.ts +15 -0
  29. package/dist/client/transaction.d.ts.map +1 -0
  30. package/dist/errors.d.ts +28 -4
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +164 -197
  35. package/dist/index.js.map +9 -13
  36. package/dist/io/outgoing.d.ts +21 -0
  37. package/dist/io/outgoing.d.ts.map +1 -0
  38. package/dist/protocol/data-writer.d.ts +22 -0
  39. package/dist/protocol/data-writer.d.ts.map +1 -0
  40. package/dist/protocol/ehlo.d.ts +7 -0
  41. package/dist/protocol/ehlo.d.ts.map +1 -0
  42. package/dist/{server → protocol}/lines.d.ts +9 -4
  43. package/dist/protocol/lines.d.ts.map +1 -0
  44. package/dist/protocol/path.d.ts +24 -3
  45. package/dist/protocol/path.d.ts.map +1 -1
  46. package/dist/protocol/reply-reader.d.ts +19 -0
  47. package/dist/protocol/reply-reader.d.ts.map +1 -0
  48. package/dist/protocol/sasl.d.ts +4 -0
  49. package/dist/protocol/sasl.d.ts.map +1 -1
  50. package/dist/server/commands.d.ts.map +1 -1
  51. package/dist/server/connection.d.ts +8 -0
  52. package/dist/server/connection.d.ts.map +1 -1
  53. package/dist/server/input.d.ts.map +1 -1
  54. package/dist/server/options.d.ts +2 -1
  55. package/dist/server/options.d.ts.map +1 -1
  56. package/dist/server/server.d.ts.map +1 -1
  57. package/dist/server/settings.d.ts.map +1 -1
  58. package/dist/server/transport.d.ts +40 -4
  59. package/dist/server/transport.d.ts.map +1 -1
  60. package/docs/README.md +3 -3
  61. package/docs/guide.md +407 -13
  62. package/docs/roadmap.md +43 -8
  63. package/docs/troubleshooting.md +706 -9
  64. package/package.json +12 -4
  65. package/dist/server/lines.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ehlo.d.ts","sourceRoot":"","sources":["../../src/protocol/ehlo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,KAAK,EAAE,SAAS,MAAM,EAAE,GACtB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7B"}
@@ -1,14 +1,17 @@
1
- /** The longest command line taken, CRLF included; RFC 5321 §4.5.3.1.4 asks for 512 at least. */
1
+ /**
2
+ * The longest line taken, CRLF included: a command (RFC 5321 §4.5.3.1.4
3
+ * asks for 512 at least) or a reply line (§4.5.3.1.5, 512 too).
4
+ */
2
5
  export declare const MAX_LINE = 2048;
3
- /** One line from the client, or a line that was too long and was skipped. */
6
+ /** One line from the peer, or a line that was too long and was skipped. */
4
7
  export type LineEvent = {
5
8
  line: string;
6
9
  } | {
7
10
  tooLong: true;
8
11
  };
9
12
  /**
10
- * Cuts the client's bytes into command lines, ending at LF with or without
11
- * CR. It holds one partial line at most: past `MAX_LINE`, the line is
13
+ * Cuts a peer's bytes into lines — a client's commands, a server's
14
+ * replies — ending at LF with or without CR. It holds one partial line at most: past `MAX_LINE`, the line is
12
15
  * skipped to its end and reported once.
13
16
  */
14
17
  export declare class LineSplitter {
@@ -17,6 +20,8 @@ export declare class LineSplitter {
17
20
  push(chunk: Uint8Array): void;
18
21
  /** The next line of the current chunk, or `undefined` when it has no more. */
19
22
  next(): LineEvent | undefined;
23
+ /** Bytes are held or left: a line begun, or lines not yet read. */
24
+ get holding(): boolean;
20
25
  /** What is left of the current chunk: message content pipelined after DATA. */
21
26
  takeRest(): Uint8Array;
22
27
  /** Forgets everything held: after STARTTLS, or after a refused DATA. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../src/protocol/lines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,QAAQ,OAAO,CAAC;AAE7B,2EAA2E;AAC3E,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,YAAY;;IAKxB,qDAAqD;IACrD,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAK7B,8EAA8E;IAC9E,IAAI,IAAI,SAAS,GAAG,SAAS;IAyB7B,mEAAmE;IACnE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,+EAA+E;IAC/E,QAAQ,IAAI,UAAU;IAMtB,wEAAwE;IACxE,KAAK,IAAI,IAAI;CAKb"}
@@ -7,8 +7,29 @@ export interface Path {
7
7
  readonly domain: string;
8
8
  }
9
9
  /**
10
- * Parses the `<path>` of RFC 5321 §4.1.2: `<local@domain>`, with a source
11
- * route to ignore (`<@a,@b:local@domain>`, §C), or `<>` when `allowNull`.
10
+ * An address literal (§4.1.3): `[IPv6:…]`, its tag in any case (a quoted
11
+ * string in RFC 5234 is), or `[a.b.c.d]` with each octet at most 255.
12
+ */
13
+ export declare function isAddressLiteral(text: string): boolean;
14
+ /**
15
+ * The argument of EHLO or HELO (RFC 5321 §4.1.1.1): a host name of
16
+ * letters, digits and hyphens, or an address literal.
17
+ */
18
+ export declare function isHelloName(text: string): boolean;
19
+ /**
20
+ * What `parsePath` does with a source route (`<@a,@b:local@domain>`, RFC 5321
21
+ * Appendix C): a server accepts and discards it (`'discard'`), a client
22
+ * refuses it, as §4.1.1.3 says clients should not send one (`'refuse'`).
23
+ */
24
+ export type SourceRoute = 'discard' | 'refuse';
25
+ /**
26
+ * Parses the `<path>` of RFC 5321 §4.1.2: `<local@domain>`, or `<>` when
27
+ * `allowNull`. A source route (`<@a,@b:local@domain>`, §C) is dropped when
28
+ * `sourceRoute` is `'discard'`, the default, provided each hop is
29
+ * `@domain`; with `'refuse'` the path is not one. A C0 control (CR, LF,
30
+ * NUL…), DEL or `>` anywhere refuses the path, as do C1 controls,
31
+ * Unicode format characters and lone surrogates. An IPv4 address literal
32
+ * takes octets up to 255.
12
33
  * Non-ASCII is allowed: whether the session may use it is SMTPUTF8's
13
34
  * question (RFC 6531), not the grammar's. `undefined` when it is not a path.
14
35
  *
@@ -16,5 +37,5 @@ export interface Path {
16
37
  * `v%x.example` are local parts of the domain after the last `@`, not
17
38
  * addresses elsewhere. Code that delivers must not split on the first `@`.
18
39
  */
19
- export declare function parsePath(text: string, allowNull: boolean): Path | undefined;
40
+ export declare function parsePath(text: string, allowNull: boolean, sourceRoute?: SourceRoute): Path | undefined;
20
41
  //# sourceMappingURL=path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/protocol/path.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,IAAI;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kBAAkB;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAgCD;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAoB5E"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/protocol/path.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,IAAI;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kBAAkB;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAwCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAItD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjD;AAUD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAgB/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CACxB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,OAAO,EAClB,WAAW,GAAE,WAAuB,GAClC,IAAI,GAAG,SAAS,CAuBlB"}
@@ -0,0 +1,19 @@
1
+ import type { Reply } from './reply';
2
+ /** The most lines one reply may have; an EHLO reply has a dozen or so. */
3
+ export declare const MAX_REPLY_LINES = 100;
4
+ /**
5
+ * Puts a server's reply lines together (RFC 5321 §4.2.1): `code-` lines,
6
+ * then a `code ` line, all with the same code. Each line costs one pass,
7
+ * and a reply holds `MAX_REPLY_LINES` at most; what is not a reply is an
8
+ * error, never guessed at.
9
+ */
10
+ export declare class ReplyReader {
11
+ #private;
12
+ /** One line, CRLF taken off: the reply it completes, `undefined` while it goes on, or why it is not one. */
13
+ line(text: string): Reply | {
14
+ readonly error: string;
15
+ } | undefined;
16
+ }
17
+ /** A reply's text as one line: its lines joined with a space. */
18
+ export declare function replyText(reply: Reply): string;
19
+ //# sourceMappingURL=reply-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply-reader.d.ts","sourceRoot":"","sources":["../../src/protocol/reply-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,0EAA0E;AAC1E,eAAO,MAAM,eAAe,MAAM,CAAC;AAoDnC;;;;;GAKG;AACH,qBAAa,WAAW;;IAIvB,4GAA4G;IAC5G,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;CAuBlE;AAED,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE9C"}
@@ -13,4 +13,8 @@ export interface Credentials {
13
13
  export declare function decodePlain(response: string): Credentials | undefined;
14
14
  /** One step of LOGIN: a base64 line to its text. */
15
15
  export declare function decodeLoginStep(response: string): string | undefined;
16
+ /** A client's PLAIN response (RFC 4616): `NUL username NUL password`, in base64, no authorization identity. */
17
+ export declare function encodePlain(username: string, password: string): string;
18
+ /** One step of LOGIN, the username or the password, in base64. */
19
+ export declare function encodeLoginStep(text: string): string;
16
20
  //# sourceMappingURL=sasl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sasl.d.ts","sourceRoot":"","sources":["../../src/protocol/sasl.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CAClC;AAcD,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAerE;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE"}
1
+ {"version":3,"file":"sasl.d.ts","sourceRoot":"","sources":["../../src/protocol/sasl.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CAClC;AAcD,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAerE;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAID,+GAA+G;AAC/G,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/server/commands.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA2G/C,0EAA0E;AAC1E,wBAAsB,UAAU,CAC/B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/server/commands.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAuG/C,0EAA0E;AAC1E,wBAAsB,UAAU,CAC/B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
@@ -24,7 +24,15 @@ export declare class Connection {
24
24
  get session(): Session;
25
25
  get closed(): boolean;
26
26
  send(answer: Reply): void;
27
+ /**
28
+ * Hangs up, the server's decision (a refusal, too many errors, the idle
29
+ * time): `answer` is written, but nothing waits for a client that
30
+ * stopped reading. The connection is closed at once, and what it has
31
+ * not read is dropped, so a close always completes.
32
+ */
27
33
  close(answer?: Reply): void;
34
+ /** QUIT: `answer` leaves whole, then the connection hangs up. */
35
+ quit(answer: Reply): void;
28
36
  /** Counts a failed command; past the limit, hangs up. */
29
37
  fail(answer: Reply): void;
30
38
  /** Hands an error to `onError`, which may not throw back. */
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/server/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAS,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,qBAAa,UAAU;;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE5B,QAAQ,CAAC,EAAE,SAAqD;IAChE,QAAQ,CAAC,IAAI,EAAE,MAA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":"input.d.ts","sourceRoot":"","sources":["../../src/server/input.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO/C;;;;;GAKG;AACH,qBAAa,KAAK;;IAajB,6CAA6C;IAC7C,KAAK,UAAS;gBAMF,UAAU,EAAE,UAAU;IAIlC,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAehC,4EAA4E;IAC5E,KAAK,IAAI,IAAI;IASb;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAQd,MAAM,IAAI,IAAI;IAId,yGAAyG;IACzG,IAAI,IAAI,IAAI;IAKZ,+EAA+E;IAC/E,SAAS,IAAI,IAAI;IAMjB,4DAA4D;IACtD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAkF3B"}
@@ -138,7 +138,8 @@ export interface SmtpServerOptions extends SmtpHooks {
138
138
  /**
139
139
  * Seconds a hook, `authenticate` or `localDomains` has to settle — and
140
140
  * `onData` to read the next part of a message, then to answer once it
141
- * ended. Past it, the command is refused with `451 4.3.0`. Default 60.
141
+ * ended. Past it, the command is refused with `451 4.3.0`. Default 60,
142
+ * at most 2 147 483 (the longest delay `setTimeout` takes).
142
143
  */
143
144
  readonly hookTimeout?: number;
144
145
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/server/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,sGAAsG;AACtG,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,MA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../src/server/server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAWnD,MAAM,WAAW,UAAU;IAC1B,0FAA0F;IAC1F,MAAM,CAAC,OAAO,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,wEAAwE;IACxE,IAAI,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,wBAAwB;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAqED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAuDvE"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAWnD,MAAM,WAAW,UAAU;IAC1B,0FAA0F;IAC1F,MAAM,CAAC,OAAO,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,wEAAwE;IACxE,IAAI,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,wBAAwB;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AA2ED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAqEvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/server/settings.ts"],"names":[],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EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AAkED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CA+C/D"}
@@ -7,8 +7,20 @@ export interface Transport {
7
7
  write(text: string): void;
8
8
  /** Resolves once everything written has left. */
9
9
  drained(): Promise<void>;
10
- /** Hangs up once everything written has left. */
10
+ /**
11
+ * Hangs up once everything written has left: a graceful close, as after
12
+ * QUIT. A socket not closed within `CLOSE_GRACE_MS` is terminated.
13
+ * If the server paused reading, it reads again first, since a half-close
14
+ * does not complete over input left unread.
15
+ */
11
16
  end(): void;
17
+ /**
18
+ * Hangs up now, the server's decision: what the socket already took
19
+ * leaves, but what still waits for a client that stopped reading is
20
+ * dropped and the connection reset, so the close never hangs on it.
21
+ * With nothing queued it hangs up as `end()` does, within the same grace.
22
+ */
23
+ abort(): void;
12
24
  /** Stops reading from the client, while the server catches up. */
13
25
  pause(): void;
14
26
  resume(): void;
@@ -18,9 +30,23 @@ export interface Transport {
18
30
  restartIdle(seconds: number): void;
19
31
  }
20
32
  /**
21
- * A Bun socket as a Transport. Bun's sockets do not buffer: `write` takes
22
- * what the kernel takes and says how much. The rest waits here for the
23
- * `drain` event, so no reply is lost to a client that reads slowly.
33
+ * How long any end may wait on the client — for what is queued to leave,
34
+ * then for the close itself — before the socket is terminated.
35
+ */
36
+ export declare const CLOSE_GRACE_MS = 5000;
37
+ /**
38
+ * A hang-up while the server paused reading lingers: it reads again and
39
+ * drops what the client sent until nothing came for `LINGER_QUIET_MS`,
40
+ * then half-closes. Bun closes the socket at once on `shutdown(true)`, and
41
+ * Linux answers a close over unread input with a reset that loses the last
42
+ * reply. A client still sending after `LINGER_MAX_MS` is reset.
43
+ */
44
+ export declare const LINGER_QUIET_MS = 20;
45
+ export declare const LINGER_MAX_MS = 500;
46
+ /**
47
+ * A Bun socket as a Transport. What the socket cannot take now waits in an
48
+ * `Outgoing` for the `drain` event, so no reply is lost to a client that
49
+ * reads slowly.
24
50
  */
25
51
  export declare class SocketTransport implements Transport {
26
52
  #private;
@@ -31,9 +57,19 @@ export declare class SocketTransport implements Transport {
31
57
  /** Bun's `drain`: the socket can take more. */
32
58
  drain(): void;
33
59
  drained(): Promise<void>;
60
+ /**
61
+ * Bun's `data`: the client sent bytes. While a hang-up lingers, they are
62
+ * dropped, and the half-close waits until they stop — `LINGER_MAX_MS` at
63
+ * most: a client still sending then is reset. Re-arming the timer on each
64
+ * chunk would let a client that never pauses keep it from firing, and a
65
+ * half-close over its input may never fire `close` (Linux).
66
+ */
67
+ received(): void;
34
68
  /** The socket closed: nothing more will leave. */
35
69
  closed(): void;
70
+ /** After `closed()`, does nothing: no grace is armed on a dead socket. */
36
71
  end(): void;
72
+ abort(): void;
37
73
  pause(): void;
38
74
  resume(): void;
39
75
  startTls(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/server/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,uFAAuF;IACvF,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iDAAiD;IACjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,iDAAiD;IACjD,GAAG,IAAI,IAAI,CAAC;IACZ,kEAAkE;IAClE,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,uEAAuE;IACvE,QAAQ,IAAI,IAAI,CAAC;IACjB,kEAAkE;IAClE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,qBA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;;GAGG;AACH,eAAO,MAAM,cAAc,OAAQ,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,SAAS;;IAEhD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAmBxB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,EACvB,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,MAAM,IAAI,EACpB,aAAa,SAAuB;IASrC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKzB,+CAA+C;IAC/C,KAAK,IAAI,IAAI;IAIb,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB;;;;;;OAMG;IACH,QAAQ,IAAI,IAAI;IAQhB,kDAAkD;IAClD,MAAM,IAAI,IAAI;IAOd,0EAA0E;IAC1E,GAAG,IAAI,IAAI;IAOX,KAAK,IAAI,IAAI;IA0Fb,KAAK,IAAI,IAAI;IAKb,MAAM,IAAI,IAAI;IAKd,QAAQ,IAAI,IAAI;IAIhB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAGlC"}
package/docs/README.md CHANGED
@@ -5,6 +5,6 @@ long one.
5
5
 
6
6
  | Page | Read it when |
7
7
  | --- | --- |
8
- | [Guide](guide.md) | running an MX, a submission server or implicit TLS; reading what a reply means; writing hooks and keeping state in `Session.data`; handling what `onData` receives; delivering into `@bumail/store`; setting TLS, limits and `greetingDelay`; or checking which RFC a behaviour follows |
9
- | [Troubleshooting](troubleshooting.md) | `createSmtpServer` threw, the server will not listen, or a client reports a reply you did not expect |
10
- | [Roadmap](roadmap.md) | wondering what is coming — the client, DSN, a ready-made delivery into the store — and what is not planned |
8
+ | [Guide](guide.md) | running an MX, a submission server or implicit TLS; reading what a reply means; writing hooks and keeping state in `Session.data`; handling what `onData` receives; delivering into `@bumail/store`; setting TLS, limits and `greetingDelay`; sending mail with `@bumail/smtp/client` and trying it with Mailpit; or checking which RFC a behaviour follows |
9
+ | [Troubleshooting](troubleshooting.md) | `createSmtpServer` threw, the server will not listen, a client reports a reply you did not expect, or `sendMail` rejected |
10
+ | [Roadmap](roadmap.md) | wondering what is coming — connection reuse in the client, DSN, a ready-made delivery into the store — and what is not planned |