From 5b10def43d134e5735bfcec1237c04cf66e8610b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 19 Sep 2017 15:36:06 -0400 Subject: Feat: Refactor tor services In order to refactor the tor services, we need to split them out into three different services. This adds the hidden service class that is necessary to support the previous commits. Fixes #8864. --- provider_base/services/hidden_service.json | 11 ----------- provider_base/services/hidden_service.rb | 4 ---- provider_base/services/tor_exit.rb | 4 ++-- provider_base/services/tor_hidden_service.json | 11 +++++++++++ provider_base/services/tor_hidden_service.rb | 4 ++++ provider_base/services/tor_relay.rb | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 provider_base/services/hidden_service.json delete mode 100644 provider_base/services/hidden_service.rb create mode 100644 provider_base/services/tor_hidden_service.json create mode 100644 provider_base/services/tor_hidden_service.rb (limited to 'provider_base/services') diff --git a/provider_base/services/hidden_service.json b/provider_base/services/hidden_service.json deleted file mode 100644 index 137932fa..00000000 --- a/provider_base/services/hidden_service.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "tor": { - "hidden_service": { - "key_type": "RSA", - "public_key": "= tor_public_key_path(:node_tor_pub_key, tor.hidden_service.key_type)", - "private_key": "= tor_private_key_path(:node_tor_priv_key, tor.hidden_service.key_type)", - "address": "=> onion_address(:node_tor_pub_key)", - "single_hop": false - } - } -} diff --git a/provider_base/services/hidden_service.rb b/provider_base/services/hidden_service.rb deleted file mode 100644 index 50701681..00000000 --- a/provider_base/services/hidden_service.rb +++ /dev/null @@ -1,4 +0,0 @@ -if self.services.include?("tor_exit") || self.services.include?("tor_relay") - LeapCli.log :error, "service `hidden_service` is not compatible with tor_exit or tor_relay (node #{self.name})." -end -self.tor['type'] = "hidden_service" \ No newline at end of file diff --git a/provider_base/services/tor_exit.rb b/provider_base/services/tor_exit.rb index 05c67438..bd801a3d 100644 --- a/provider_base/services/tor_exit.rb +++ b/provider_base/services/tor_exit.rb @@ -1,5 +1,5 @@ -if self.services.include?("hidden_service") || self.services.include?("tor_relay") - LeapCli.log :error, "service `tor_exit` is not compatible with tor_relay or hidden_service (node #{self.name})." +if self.services.include?("tor_hidden_service") || self.services.include?("tor_relay") + LeapCli.log :error, "service `tor_exit` is not compatible with tor_relay or tor_hidden_service (node #{self.name})." exit(1) end apply_partial("_tor_common") diff --git a/provider_base/services/tor_hidden_service.json b/provider_base/services/tor_hidden_service.json new file mode 100644 index 00000000..137932fa --- /dev/null +++ b/provider_base/services/tor_hidden_service.json @@ -0,0 +1,11 @@ +{ + "tor": { + "hidden_service": { + "key_type": "RSA", + "public_key": "= tor_public_key_path(:node_tor_pub_key, tor.hidden_service.key_type)", + "private_key": "= tor_private_key_path(:node_tor_priv_key, tor.hidden_service.key_type)", + "address": "=> onion_address(:node_tor_pub_key)", + "single_hop": false + } + } +} diff --git a/provider_base/services/tor_hidden_service.rb b/provider_base/services/tor_hidden_service.rb new file mode 100644 index 00000000..8b8eb24d --- /dev/null +++ b/provider_base/services/tor_hidden_service.rb @@ -0,0 +1,4 @@ +if self.services.include?("tor_exit") || self.services.include?("tor_relay") + LeapCli.log :error, "service `tor_hidden_service` is not compatible with tor_exit or tor_relay (node #{self.name})." +end +self.tor['type'] = "hidden_service" diff --git a/provider_base/services/tor_relay.rb b/provider_base/services/tor_relay.rb index 42bafb94..7fce6ae4 100644 --- a/provider_base/services/tor_relay.rb +++ b/provider_base/services/tor_relay.rb @@ -1,6 +1,6 @@ -if self.services.include?("tor_exit") || self.services.include?("hidden_service") - LeapCli.log :error, "service `tor_relay` is not compatible with tor_exit or hidden_service (node #{self.name})." +if self.services.include?("tor_exit") || self.services.include?("tor_hidden_service") + LeapCli.log :error, "service `tor_relay` is not compatible with tor_exit or tor_hidden_service (node #{self.name})." end apply_partial("_tor_common") self.tor['type'] = "relay" -- cgit v1.2.3