1
- use crate :: config:: default:: DefaultOrCustom ;
2
- use crate :: config:: macros:: config_struct;
3
- use cuprate_helper:: network:: Network ;
4
- use serde:: { Deserialize , Serialize } ;
5
- use std:: net:: IpAddr ;
6
1
use std:: {
7
- net:: { Ipv4Addr , SocketAddr , SocketAddrV4 } ,
2
+ net:: { IpAddr , Ipv4Addr , SocketAddr , SocketAddrV4 } ,
8
3
time:: Duration ,
9
4
} ;
10
5
6
+ use serde:: { Deserialize , Serialize } ;
7
+
8
+ use cuprate_helper:: network:: Network ;
9
+
10
+ use super :: { default:: DefaultOrCustom , macros:: config_struct} ;
11
+
11
12
config_struct ! {
12
13
/// RPC config.
13
14
#[ derive( Clone , Debug , Default , Deserialize , Serialize , PartialEq , Eq ) ]
@@ -28,14 +29,14 @@ config_struct! {
28
29
/// The address the RPC server will listen on.
29
30
///
30
31
/// Type | IPv4/IPv6 address
31
- /// Examples | "", "127.0.0.1:18081 ", "192.168.1.50:18085 "
32
+ /// Examples | "", "127.0.0.1", "192.168.1.50"
32
33
pub address: IpAddr ,
33
34
34
35
/// The port the RPC server will listen on.
35
36
///
36
37
/// Type | Number
37
38
/// Valid values | 0..65534
38
- /// Examples | 18080, 9999 , 5432
39
+ /// Examples | 18081, 18089 , 5432
39
40
pub port: DefaultOrCustom <u16 >,
40
41
41
42
/// Toggle the RPC server.
@@ -118,6 +119,7 @@ impl Default for RestrictedRpcConfig {
118
119
}
119
120
}
120
121
122
+ /// Gets the port to listen on for restricted RPC connections.
121
123
pub const fn restricted_rpc_port ( config : DefaultOrCustom < u16 > , network : Network ) -> u16 {
122
124
match config {
123
125
DefaultOrCustom :: Default => match network {
@@ -129,6 +131,7 @@ pub const fn restricted_rpc_port(config: DefaultOrCustom<u16>, network: Network)
129
131
}
130
132
}
131
133
134
+ /// Gets the port to listen on for unrestricted RPC connections.
132
135
pub const fn unrestricted_rpc_port ( config : DefaultOrCustom < u16 > , network : Network ) -> u16 {
133
136
match config {
134
137
DefaultOrCustom :: Default => match network {
0 commit comments