Skip to content

Commit

Permalink
init from imap-flow PR #174
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed May 27, 2024
0 parents commit 7bd70b0
Show file tree
Hide file tree
Showing 36 changed files with 4,079 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/target
/Cargo.lock

# IntelliJ, CLion, RustRover, ...
.idea

# direnv (https://direnv.net/)
.envrc
.direnv
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - YYYY-MM-DD

### Added

* Created README, CHANGELOG, badges, rustfmt.toml, ...
* Created project board
* Setup CI: Check, Build, Lint, Audit, Coverage, ...
* Licensed everything as "APACHE OR MIT"
* `imap-flow`
* Implemented literal handling, handles, events, and examples
* Implemented AUTHENTICATE and IDLE
* Implemented a self-test, and tested against a few providers
* `proxy`
* Implemented argument processing and configuration
* Smoke tested against a few providers (and a few MUAs)
* Provided a README
* Supported capabilities are ...
* AUTH={PLAIN,LOGIN,XOAUTH2,ScramSha1,ScramSha256}
* SASL-IR
* QUOTA*
* MOVE
* LITERAL+/LITERAL-
* UNSELECT
* ID
* IDLE
* Use ALPN==imap
* `imap-tasks` prototype
* Designed `Task`s trait
* Implemented `Task` for a few commands
* Implemented a task scheduler/manager
* `tag-generator`

[Unreleased]: https://github.com/duesee/imap-flow/compare/0a89b5e180ad7dfd3d67d1184370fa1028ea92b4...HEAD
22 changes: 22 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "imap-client"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
imap-flow = { git = "https://github.com/duesee/imap-flow" }
imap-types = "2"
once_cell = "1"
rustls-native-certs = "0.7.0"
thiserror = "1.0.50"
tokio = { version = "1.37.0", features = ["net", "time"] }
tokio-rustls = "0.26.0"
tracing = "0.1.40"

[dev-dependencies]
tokio = { version = "1.37.0", features = ["full"] }

[patch.crates-io]
imap-codec = { git = "https://github.com/duesee/imap-codec" }
imap-types = { git = "https://github.com/duesee/imap-codec" }
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[![main](https://github.com/duesee/imap-flow/actions/workflows/main.yml/badge.svg)](https://github.com/duesee/imap-flow/actions/workflows/main.yml)
[![audit](https://github.com/duesee/imap-flow/actions/workflows/audit.yml/badge.svg)](https://github.com/duesee/imap-flow/actions/workflows/audit.yml)
[![Coverage](https://coveralls.io/repos/github/duesee/imap-flow/badge.svg?branch=main)](https://coveralls.io/github/duesee/imap-flow?branch=main)

# imap-flow

`imap-flow` is a thin abstraction over IMAP's distinct "protocol flows".
These are literal handling, AUTHENTICATE, and IDLE.

The way these flows were defined in IMAP couples networking, parsing, and business logic.
`imap-flow` untangles these flows, providing a minimal interface allowing sending and receiving coherent messages.
It's a thin layer paving the ground for a correct client or server implementation.

## Playground

This repository also serves as a playground for crates built on `imap-flow`.
These will eventually be moved into their own repositories.

Notably, we have the `proxy`, `tasks`, and `tag-generator` workspace members.

* `proxy` is an already usable (but still not production-ready) IMAP proxy.
It gracefully forwards unsolicited responses, abstracts away literal processing, and `Debug`-prints messages.
Proxies are great for challenging the usability of a library, and we use them to validate our design decisions.
(See the [README](./proxy/README.md).)
* `tasks` is our prototype of a higher-level IMAP library that abstracts away command and response handling into `Task`s.
This crate will eventually become what a client or server implementor should use to get IMAP right.
Currently, only the client side is implemented.
* `tag-generator` generates process-wide unique (and unguessable) IMAP tags.
This crate is here for organizational reasons and may be moved (or inlined) eventually.

# License

This crate is dual-licensed under Apache 2.0 and MIT terms.

# Thanks

Thanks to the [NLnet Foundation](https://nlnet.nl/) for supporting `imap-flow` through their [NGI Assure](https://nlnet.nl/assure/) program!

<div align="right">
<img alt="NLnet logo" height="100px" src="https://user-images.githubusercontent.com/8997731/215262095-ab12d43a-ca8a-4d44-b79b-7e99ab91ca01.png"/>
<img alt="Whitespace" height="100px" src="https://user-images.githubusercontent.com/8997731/221422192-60d28ed4-10bb-441e-957d-93af58166707.png"/>
<img alt="NGI Assure logo" height="100px" src="https://user-images.githubusercontent.com/8997731/215262235-0db02da9-7c6c-498e-a3d2-7ea7901637bf.png"/>
</div>
17 changes: 17 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[sources]
unknown-registry = "deny"
unknown-git = "deny"

allow-git = [
"https://github.com/duesee/imap-codec",
]

[licenses]
allow = [ "Apache-2.0", "BSD-3-Clause", "MIT", "Unicode-DFS-2016", "ISC", "OpenSSL" ]

[[licenses.clarify]]
name = "ring"
expression = "MIT AND ISC AND OpenSSL"
license-files = [
{ path = "LICENSE", hash = 0xbd0eed23 }
]
83 changes: 83 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

# The rustup equivalent for Nix.
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};

# Allows non-flakes users to still be able to `nix-shell` based on
# `shell.nix` instead of this `flake.nix`.
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, fenix, ... }:
let
inherit (nixpkgs) lib;

eachSupportedSystem = lib.genAttrs supportedSystems;
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];

mkDevShells = system:
let
pkgs = import nixpkgs { inherit system; };

# get the rust toolchain from the rustup
# `rust-toolchain.toml` configuration file
rust-toolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "opUgs6ckUQCyDxcB9Wy51pqhd0MPGHUVbwRKKPGiwZU=";
};

in
{
default = pkgs.mkShell {
buildInputs = [ rust-toolchain ];
};
};

in
{
devShells = eachSupportedSystem mkDevShells;
};
}
Loading

0 comments on commit 7bd70b0

Please sign in to comment.