1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Set of libraries for privacy-preserving networking apps
//
// SPDX-License-Identifier: Apache-2.0
//
// Written in 2019-2023 by
//     Dr. Maxim Orlovsky <orlovsky@cyphernet.org>
//
// Copyright 2022-2023 Cyphernet DAO, Switzerland
//
// 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.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! Cyphernet is a set of libraries for privacy-preserving networking & internet
//! applications.
//!
//! The set of libraries supports mix networks (Tor, I2P, Nym), proxies,
//! end-to-end encryption without central authorities/PKI (Noise-based
//! encryption protocols like lightning wire protocol, NTLS etc).
//! The library provides three main components, structured as modules:
//! - **Network addresses** (module `addr`), which allow simple use of
//! - Tor, Nym, I2P and other mix networks and SOCKS proxies
//! - P2P addresses with node public keys
//! - May be used in a way that prevents using DNS names (outside mixnet scope).
//! - **Noise protocol framework** (module `noise`) for end-to-end encrypted
//! network communications.
//!
//! The library tries to minimize number of dependencies. Most of its
//! functionality is available via non-default features, like:
//! - `noise`: support for noise protocols
//! - `mixnets`: supports for mixnet network addresses, including `tor`, `nym`, `i2p` (may require
//!   additional crypto libraries for parsing public keys)
//! - `serde`: encoding for addresses types
//! - `dns`: enable use of DNS names alongside IP addresses and mixnet names.
//!
//! Network addresses provided by the library include the following types:
//! * [`addr::InetHost`] - IP addr or DNS name
//! * [`addr::HostName`] - IP, DNS, Tor, I2P, Nym host name (no port or proxy information)
//! * [`addr::NetAddr`] - any type of host name + port information
//! * [`addr::PartialAddr`] - any type of host name + optional port, which defaults to generic const
//!   if not provided
//! * [`addr::PeerAddr`] - any of the above addresses + node public key for authentication
//! * [`addr::ProxiedHost`] - host name + proxy (there are IP/DNS w/o proxy and with proxy)
//! * [`addr::ProxiedAddr`] - any of the above addresses + proxy (thus IP/DNS is always proxied)

pub extern crate cypheraddr as addr;

pub mod encrypt {
    #[cfg(feature = "noise-framework")]
    pub extern crate noise;
}

#[cfg(any(feature = "eidolon"))]
pub mod auth {
    #[cfg(feature = "eidolon")]
    pub extern crate eidolon;
}

pub mod proxy {
    pub extern crate socks5_client as socks5;
}

pub use cypher::*;