Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove all occurance of libtor #400

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Wukong247
Copy link

Draft:

Error message in case of no tor process detection and a nice detection logic rather than just pinging sites via socks.

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 78.26087% with 10 lines in your changes missing coverage. Please review.

Project coverage is 72.74%. Comparing base (4f3cae3) to head (7be1bb4).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
src/maker/error.rs 0.00% 2 Missing ⚠️
src/market/directory.rs 83.33% 2 Missing ⚠️
src/taker/error.rs 0.00% 2 Missing ⚠️
src/utill.rs 0.00% 2 Missing ⚠️
src/maker/rpc/server.rs 0.00% 1 Missing ⚠️
src/maker/server.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #400      +/-   ##
==========================================
+ Coverage   70.43%   72.74%   +2.31%     
==========================================
  Files          34       32       -2     
  Lines        4245     4099     -146     
==========================================
- Hits         2990     2982       -8     
+ Misses       1255     1117     -138     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Wukong247 Wukong247 force-pushed the 2025-02-06-remove-libtor branch 3 times, most recently from f418975 to 2c7410b Compare February 19, 2025 10:45
@Shourya742 Shourya742 marked this pull request as ready for review February 19, 2025 11:10
Copy link

@mojoX911 mojoX911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. Few questions.

Cargo.toml Outdated
Comment on lines 42 to 43
# Used for connecting to the Tor socks port
tor = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, we dont, its among those rough edges to remove...

Comment on lines +19 to +24
/// target listening port
pub target_port: u16,
/// service port
pub service_port: u16,
/// control port
pub control_port: u16,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this many ports?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target port, is the port on which the application run.
service port, is the port what we use after onion address: xyz:{}
control port, this helps to know about tor service.

@@ -57,6 +68,7 @@ impl Default for MakerConfig {
ConnectionType::CLEARNET
}
},
hostname: "ocqkq73acs4qryk5snoiwtpskb2w3wp65basfzw2xcw6mrp57yonygyd.onion".to_string(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using a random default, can we read the hostname from the etc/var files?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will require the user to provide that. The reason we don’t want to use etcd is due to permission restrictions.

Copy link

@mojoX911 mojoX911 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a problem with the flow currently.

When the maker is started for the first time, the config file doesn't exist, and there is nothing for user to update. Then a default config file is created, and the maker simply goes on with its process sending this default tor address to DNS, so the user then need to stop the server, update the file and restart again. It can happen that by that time the maker has already sent this address to DNS resulting in wrong DNS entry.

There is no visible error for user to notify if their tor address is wrong. Even if it changes for some reason, (maybe they deleted the torrc file) it will simply carry on with the old address, everything looks normal, just they will never receive any client connection.

We need to automate the tor address fetching somehow. asking user to manually ensure makes it prone to error.

@Wukong247 Wukong247 force-pushed the 2025-02-06-remove-libtor branch from 964e8c7 to 7be1bb4 Compare February 19, 2025 15:06
Add this to `torrc`:
```ini
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:8080

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed to 6102 to match with the defaults?

rpc_port: 6103,
min_swap_amount: MIN_SWAP_AMOUNT,
target_port: 6102,
service_port: 6102,
control_port: 9051,
socks_port: 19050,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 9050 as the default tor socks port.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for taker and dns.

/// RPC listening port
pub rpc_port: u16,
/// Minimum Coinswap amount
pub min_swap_amount: u64,
/// target listening port
pub target_port: u16,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets rename this back to network_port. This is the port where network connections are coming into, i.e, 6102. so that's a more intuitive name.

Comment on lines +21 to +22
/// service port
pub service_port: u16,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add a comment saying that we can keep this value same as the network_port, and explain in which cases they should differ.

})
}

// Method to serialize the MakerConfig into a TOML string and write it to a file
pub(crate) fn write_to_file(&self, path: &Path) -> std::io::Result<()> {
let toml_data = format!(
"network_port = {}
"target_port = {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also should add the service_port too.

Comment on lines 153 to 156
fidelity_timelock = {}
connection_type = {:?}",
self.network_port,
self.target_port,
self.rpc_port,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the hostname is not written to file, so theres no way to change the value in default config file right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants