-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Eval EXEC <[email protected]>
- Loading branch information
Showing
7 changed files
with
381 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,9 +111,32 @@ pub struct ProxyConfig { | |
|
||
/// Onion related config options | ||
#[derive(Clone, Debug, Serialize, Deserialize, Default)] | ||
#[serde(deny_unknown_fields)] | ||
pub struct OnionConfig { | ||
// like: socks5://username:[email protected]:1080 | ||
pub onion_url: Option<String>, | ||
// Automatically create Tor onion service, default: true | ||
#[serde(default = "default_listen_on_onion")] | ||
pub listen_on_onion: bool, | ||
// onion service target, if CKB's p2p listen address not on default 127.0.0.1:8115, you should set this | ||
pub onion_service_target: Option<String>, | ||
// Tor server url: like: 127.0.0.1:9050 | ||
pub onion_server: Option<String>, | ||
// path to store onion private key, default is ./data/network/onion/onion_private_key | ||
pub onion_private_key_path: Option<String>, | ||
// tor controllr url, example: 127.0.0.1:9050 | ||
#[serde(default = "default_tor_controller")] | ||
pub tor_controller: String, | ||
// tor controller hashed password | ||
pub tor_password: Option<String>, | ||
} | ||
|
||
/// By default, allow ckb to listen on onion address | ||
const fn default_listen_on_onion() -> bool { | ||
true | ||
} | ||
|
||
/// By default, use tor controller on "127.0.0.1:9051" | ||
fn default_tor_controller() -> String { | ||
"127.0.0.1:9051".to_string() | ||
} | ||
|
||
/// Chain synchronization config options. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::net::SocketAddr; | ||
|
||
pub mod onion_service; | ||
mod tests; | ||
|
||
pub struct OnionServiceConfig { | ||
// Tor server url: like: 127.0.0.1:9050 | ||
pub onion_server: String, | ||
// path to store onion private key, default is ./data/network/onion/onion_private_key | ||
pub onion_private_key_path: String, | ||
// tor controllr url, example: 127.0.0.1:9050 | ||
pub tor_controller: String, | ||
// tor controller hashed password | ||
pub tor_password: Option<String>, | ||
// onion service will bind to CKB's p2p listen address, default is "127.0.0.1:8115" | ||
// if you want to use other address, you should set it to the address you want | ||
pub onion_service_target: SocketAddr, | ||
} |
Oops, something went wrong.