Commit e3ee45b8 authored by Stavros Korokithakis's avatar Stavros Korokithakis

Add Eternum pinging

parent 80128908
...@@ -236,6 +236,8 @@ fn start_ipfs() { ...@@ -236,6 +236,8 @@ fn start_ipfs() {
info!("Daemon is up, continuing..."); info!("Daemon is up, continuing...");
thread::sleep(Duration::from_secs(1)); thread::sleep(Duration::from_secs(1));
thread::spawn(ping_eternum);
// Connect this node to Eternum directly. // Connect this node to Eternum directly.
Command::new(IPFS_EXECUTABLE) Command::new(IPFS_EXECUTABLE)
.env("IPFS_PATH", &*IPFS_PATH) .env("IPFS_PATH", &*IPFS_PATH)
...@@ -320,6 +322,21 @@ fn create_watcher() { ...@@ -320,6 +322,21 @@ fn create_watcher() {
} }
} }
/// Send a request to Eternum, for estimating how many Hearth installations there are.
/// IP addresses or other identifying data is not stored.
fn ping_eternum() {
let output = Command::new(IPFS_EXECUTABLE)
.env("IPFS_PATH", &*IPFS_PATH)
.args(&["id", "-f", "<id>"])
.output()
.expect("Could not get peer ID.");
let peer_id = String::from_utf8(output.stdout).unwrap();
let client = reqwest::Client::new();
let _ = client.get(format!("https://www.eternum.io/track/hearth/?id={}", peer_id).as_str()).send();
}
fn main() { fn main() {
let matches = App::new("Hearth") let matches = App::new("Hearth")
.author("by Stavros and Stelios") .author("by Stavros and Stelios")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment