d106a542fd368156f0a4f7959c37919d8e1821ec
[rust-lightning] / lightning / src / onion_message / mod.rs
1 // This file is Copyright its original authors, visible in version control
2 // history.
3 //
4 // This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
5 // or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
7 // You may not use this file except in accordance with one or both of these
8 // licenses.
9
10 //! Onion Messages: sending, receiving, forwarding, and ancillary utilities live here
11 //!
12 //! Onion messages are multi-purpose messages sent between peers over the lightning network. In the
13 //! near future, they will be used to communicate invoices for [offers], unlocking use cases such as
14 //! static invoices, refunds and proof of payer. Further, you will be able to accept payments
15 //! without revealing your node id through the use of [blinded paths].
16 //!
17 //! LDK sends and receives onion messages via the [`OnionMessenger`]. See its documentation for more
18 //! information on its usage.
19 //!
20 //! [offers]: <https://github.com/lightning/bolts/pull/798>
21 //! [blinded paths]: crate::blinded_path::BlindedPath
22
23 mod messenger;
24 mod offers;
25 mod packet;
26 #[cfg(test)]
27 mod functional_tests;
28
29 // Re-export structs so they can be imported with just the `onion_message::` module prefix.
30 pub use self::messenger::{CustomOnionMessageHandler, DefaultMessageRouter, Destination, MessageRouter, OnionMessageContents, OnionMessagePath, OnionMessenger, PeeledOnion, PendingOnionMessage, SendError};
31 pub use self::messenger::{create_onion_message, peel_onion_message};
32 #[cfg(not(c_bindings))]
33 pub use self::messenger::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
34 pub use self::offers::{OffersMessage, OffersMessageHandler};
35 pub use self::packet::{Packet, ParsedOnionMessageContents};
36 pub(crate) use self::packet::ControlTlvs;
37 pub(crate) use self::messenger::new_pending_onion_message;