Crates.io | conec |
lib.rs | conec |
version | 0.2.0 |
source | src |
created_at | 2020-08-01 21:40:02.105092 |
updated_at | 2020-09-21 06:25:23.929269 |
description | COordinated NEtwork Channels |
homepage | |
repository | https://github.com/kwantam/conec |
max_upload_size | |
id | 272019 |
size | 310,808 |
A coordinated network channels instance comprises one Coordinator and one or more Clients.
Clients know (by configuration) the identity of Coordinator (say, a hostname for which Coordinator has a TLS server cert).
Clients authenticate to Coordinator with a TLS certificate. By default, clients generate ephemeral self-signed certificates; they can also be configured to use long-lived certs signed by a CA that Coordinator trusts.
The basic abstraction is a channel, which connects two entities (Client or Coordinator). A channel comprises one bi-directional control stream and zero or more bidirectional data streams (streams defined below).
Every Client shares a channel with Coordinator: at startup, Client connects to Coordinator.
Clients can ask Coordinator to help them open a channel to another Client. By default, Clients will attempt to use holepunching for NAT traversal; this ought to work except when the Client receiving the connection is behind a symmetric NAT. Please post an issue on the GitHub repo if this doesn't work for you!
A data stream accepts a sequence of (known length) messages from its writer. The data stream's reader receives these messages in order. The stream handles all message framing: a read yields a full message or nothing. No support for out-of-order reads; use multiple data streams instead.
Control streams are used internally to manage the connection. The user code does not interact with them except via the API (e.g., in most cases opening a data stream entails sending and receiving messages on a control stream).
map(|x| x.map_err(FooError))
to get rid of multiple unwrapstracing
anyhow
in favor of unboxed Error typesCopyright 2020 Riad S. Wahby
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.