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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#![recursion_limit = "256"]
#![deny(
non_upper_case_globals,
non_camel_case_types,
non_snake_case,
unused_mut,
unused_imports,
)]
#![cfg_attr(feature = "async", allow(where_clauses_object_safety))]
#[macro_use]
extern crate amplify;
#[macro_use]
extern crate amplify_derive;
#[macro_use]
extern crate strict_encoding;
#[macro_use]
extern crate lazy_static;
extern crate chacha20poly1305;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde_with;
#[cfg(feature = "serde")]
extern crate serde_crate as serde;
#[cfg(feature = "derive")]
pub extern crate inet2_derive;
#[cfg(feature = "derive")]
pub use inet2_derive::{LightningDecode, LightningEncode, LnpApi};
pub mod addr {
pub use inet2_addr::*;
}
pub mod presentation;
pub mod session;
pub mod transport;
pub use presentation::encoding as lightning_encoding;
pub use presentation::payload::{TypeId, TypedEnum};
pub use presentation::{
encoding, payload, tlv, CreateUnmarshaller, Payload, UnknownTypeError,
Unmarshall, UnmarshallFn, Unmarshaller,
};
pub use session::{
Accept, Connect, Decrypt, Encrypt, LocalNode, NodeAddr, NoiseDecryptor,
NoiseEncryptor, NoiseTranscoder, PartialNodeAddr, PlainTranscoder,
RemoteNodeAddr, Session, Split, ToNodeAddr, ToRemoteNodeAddr, Transcode,
};
#[cfg(feature = "websockets")]
pub use transport::websocket;
#[cfg(feature = "zmq")]
pub use transport::zmqsocket;
pub use transport::{
ftcp, Duplex, FramingProtocol, LocalSocketAddr, RemoteSocketAddr,
RoutedFrame,
};
pub const LNP_MSG_MAX_LEN: usize = core::u16::MAX as usize;
pub const LIGHTNING_P2P_DEFAULT_PORT: u16 = 9735;
#[cfg(feature = "zmq")]
pub use transport::{ZmqSocketAddr, ZmqType, ZMQ_CONTEXT};
pub trait UrlString {
fn url_scheme(&self) -> &'static str;
fn to_url_string(&self) -> String;
}
pub use inet2_addr::NoOnionSupportError;
#[derive(Clone, PartialEq, Eq, Debug, Display, Error, From)]
#[display(doc_comments)]
pub enum AddrError {
UnknownProtocol(String),
UnknownUrlScheme(String),
#[cfg(feature = "url")]
#[from]
MalformedUrl(url::ParseError),
#[from]
MalformedIpAddr(std::net::AddrParseError),
#[from]
MalformedInetAddr(inet2_addr::AddrParseError),
#[from(bitcoin::secp256k1::Error)]
InvalidPubkey,
HostRequired,
PortRequired,
UnexpectedAuthority,
UnexpectedHost,
UnexpectedPort,
InvalidZmqType(String),
ZmqTypeRequired,
ZmqContextRequired,
Unsupported(&'static str),
#[from(NoOnionSupportError)]
NoOnionSupport,
}