add nio connection layer: tls bootstrap, response handler, command runner

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 21:05:44 +01:00
parent 300b583695
commit ec820b2785
3 changed files with 160 additions and 0 deletions
@@ -0,0 +1,21 @@
import NIOIMAPCore
struct IMAPCommandRunner {
private let connection: IMAPConnection
private var tagCounter: Int = 0
init(connection: IMAPConnection) {
self.connection = connection
}
mutating func nextTag() -> String {
tagCounter += 1
return "A\(tagCounter)"
}
mutating func run(_ command: Command) async throws -> [Response] {
let tag = nextTag()
let tagged = TaggedCommand(tag: tag, command: command)
return try await connection.sendCommand(tag, command: .tagged(tagged))
}
}