Drop IPFS support (#11532)
This commit is contained in:
@@ -321,7 +321,7 @@ usage! {
|
||||
["Convenience Options"]
|
||||
FLAG flag_unsafe_expose: (bool) = false, or |c: &Config| c.misc.as_ref()?.unsafe_expose,
|
||||
"--unsafe-expose",
|
||||
"All servers will listen on external interfaces and will be remotely accessible. It's equivalent with setting the following: --[ws,jsonrpc,ipfs-api,secretstore,stratum,dapps,secretstore-http]-interface=all --*-hosts=all This option is UNSAFE and should be used with great care!",
|
||||
"All servers will listen on external interfaces and will be remotely accessible. It's equivalent with setting the following: --[ws,jsonrpc,secretstore,stratum,dapps,secretstore-http]-interface=all --*-hosts=all This option is UNSAFE and should be used with great care!",
|
||||
|
||||
ARG arg_config: (String) = "$BASE/config.toml", or |_| None,
|
||||
"-c, --config=[CONFIG]",
|
||||
@@ -329,7 +329,7 @@ usage! {
|
||||
|
||||
ARG arg_ports_shift: (u16) = 0u16, or |c: &Config| c.misc.as_ref()?.ports_shift,
|
||||
"--ports-shift=[SHIFT]",
|
||||
"Add SHIFT to all port numbers Parity is listening on. Includes network port and all servers (HTTP JSON-RPC, WebSockets JSON-RPC, IPFS, SecretStore).",
|
||||
"Add SHIFT to all port numbers Parity is listening on. Includes network port and all servers (HTTP JSON-RPC, WebSockets JSON-RPC, SecretStore).",
|
||||
|
||||
["Account Options"]
|
||||
FLAG flag_fast_unlock: (bool) = false, or |c: &Config| c.account.as_ref()?.fast_unlock.clone(),
|
||||
@@ -576,27 +576,6 @@ usage! {
|
||||
"--ipc-apis=[APIS]",
|
||||
"Specify custom API set available via JSON-RPC over IPC using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc",
|
||||
|
||||
["API and Console Options – IPFS"]
|
||||
FLAG flag_ipfs_api: (bool) = false, or |c: &Config| c.ipfs.as_ref()?.enable.clone(),
|
||||
"--ipfs-api",
|
||||
"Enable IPFS-compatible HTTP API.",
|
||||
|
||||
ARG arg_ipfs_api_port: (u16) = 5001u16, or |c: &Config| c.ipfs.as_ref()?.port.clone(),
|
||||
"--ipfs-api-port=[PORT]",
|
||||
"Configure on which port the IPFS HTTP API should listen.",
|
||||
|
||||
ARG arg_ipfs_api_interface: (String) = "local", or |c: &Config| c.ipfs.as_ref()?.interface.clone(),
|
||||
"--ipfs-api-interface=[IP]",
|
||||
"Specify the hostname portion of the IPFS API server, IP should be an interface's IP address or local.",
|
||||
|
||||
ARG arg_ipfs_api_hosts: (String) = "none", or |c: &Config| c.ipfs.as_ref()?.hosts.as_ref().map(|vec| vec.join(",")),
|
||||
"--ipfs-api-hosts=[HOSTS]",
|
||||
"List of allowed Host header values. This option will validate the Host header sent by the browser, it is additional security against some attack vectors. Special options: \"all\", \"none\".",
|
||||
|
||||
ARG arg_ipfs_api_cors: (String) = "none", or |c: &Config| c.ipfs.as_ref()?.cors.as_ref().map(|vec| vec.join(",")),
|
||||
"--ipfs-api-cors=[URL]",
|
||||
"Specify CORS header for IPFS API responses. Special options: \"all\", \"none\".",
|
||||
|
||||
["Light Client Options"]
|
||||
ARG arg_on_demand_response_time_window: (Option<u64>) = None, or |c: &Config| c.light.as_ref()?.on_demand_response_time_window,
|
||||
"--on-demand-time-window=[S]",
|
||||
@@ -1163,7 +1142,6 @@ struct Config {
|
||||
dapps: Option<Dapps>,
|
||||
secretstore: Option<SecretStore>,
|
||||
private_tx: Option<PrivateTransactions>,
|
||||
ipfs: Option<Ipfs>,
|
||||
mining: Option<Mining>,
|
||||
footprint: Option<Footprint>,
|
||||
snapshots: Option<Snapshots>,
|
||||
@@ -1344,16 +1322,6 @@ struct SecretStore {
|
||||
cors: Option<Vec<String>>
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Ipfs {
|
||||
enable: Option<bool>,
|
||||
port: Option<u16>,
|
||||
interface: Option<String>,
|
||||
cors: Option<Vec<String>>,
|
||||
hosts: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Mining {
|
||||
@@ -1458,7 +1426,7 @@ struct Light {
|
||||
mod tests {
|
||||
use super::{
|
||||
Args, ArgsError,
|
||||
Config, Operating, Account, Ui, Network, Ws, Rpc, Ipc, Dapps, Ipfs, Mining, Footprint,
|
||||
Config, Operating, Account, Ui, Network, Ws, Rpc, Ipc, Dapps, Mining, Footprint,
|
||||
Snapshots, Misc, Whisper, SecretStore, Light,
|
||||
};
|
||||
use toml;
|
||||
@@ -1871,13 +1839,6 @@ mod tests {
|
||||
arg_secretstore_path: "$HOME/.parity/secretstore".into(),
|
||||
arg_secretstore_http_cors: "null".into(),
|
||||
|
||||
// IPFS
|
||||
flag_ipfs_api: false,
|
||||
arg_ipfs_api_port: 5001u16,
|
||||
arg_ipfs_api_interface: "local".into(),
|
||||
arg_ipfs_api_cors: "null".into(),
|
||||
arg_ipfs_api_hosts: "none".into(),
|
||||
|
||||
// -- Sealing/Mining Options
|
||||
arg_author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
arg_engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
@@ -2151,13 +2112,6 @@ mod tests {
|
||||
cors: None,
|
||||
}),
|
||||
private_tx: None,
|
||||
ipfs: Some(Ipfs {
|
||||
enable: Some(false),
|
||||
port: Some(5001),
|
||||
interface: None,
|
||||
cors: None,
|
||||
hosts: None,
|
||||
}),
|
||||
mining: Some(Mining {
|
||||
author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
|
||||
@@ -10,7 +10,3 @@ min_gas_price = 0
|
||||
interface = "all"
|
||||
apis = ["all"]
|
||||
hosts = ["all"]
|
||||
|
||||
[ipfs]
|
||||
enable = false # this is the default
|
||||
hosts = ["all"]
|
||||
|
||||
@@ -5,7 +5,3 @@ no_consensus = true
|
||||
interface = "all"
|
||||
apis = ["all"]
|
||||
hosts = ["all"]
|
||||
|
||||
[ipfs]
|
||||
enable = false # this is the default
|
||||
hosts = ["all"]
|
||||
|
||||
@@ -108,13 +108,6 @@ port = 8083
|
||||
path = "$HOME/.parity/secretstore"
|
||||
cors = ["null"]
|
||||
|
||||
[ipfs]
|
||||
enable = false
|
||||
port = 5001
|
||||
interface = "local"
|
||||
cors = ["null"]
|
||||
hosts = ["none"]
|
||||
|
||||
[mining]
|
||||
author = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
engine_signer = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
|
||||
@@ -45,10 +45,6 @@ pass = "password"
|
||||
http_port = 8082
|
||||
port = 8083
|
||||
|
||||
[ipfs]
|
||||
enable = false
|
||||
port = 5001
|
||||
|
||||
[mining]
|
||||
author = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
engine_signer = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
|
||||
@@ -42,7 +42,6 @@ use dir::helpers::{replace_home, replace_home_and_local};
|
||||
use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, SpecType};
|
||||
use ethcore_logger::Config as LogConfig;
|
||||
use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path};
|
||||
use ipfs::Configuration as IpfsConfiguration;
|
||||
use ethcore_private_tx::{ProviderConfig, EncryptorConfig};
|
||||
use secretstore::{NodeSecretKey, Configuration as SecretStoreConfiguration, ContractAddress as SecretStoreContractAddress};
|
||||
use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack};
|
||||
@@ -139,7 +138,6 @@ impl Configuration {
|
||||
let warp_sync = !self.args.flag_no_warp;
|
||||
let geth_compatibility = self.args.flag_geth;
|
||||
let experimental_rpcs = self.args.flag_jsonrpc_experimental;
|
||||
let ipfs_conf = self.ipfs_config();
|
||||
let secretstore_conf = self.secretstore_config()?;
|
||||
let format = self.format()?;
|
||||
|
||||
@@ -396,7 +394,6 @@ impl Configuration {
|
||||
geth_compatibility,
|
||||
experimental_rpcs,
|
||||
net_settings: self.network_settings()?,
|
||||
ipfs_conf,
|
||||
secretstore_conf,
|
||||
private_provider_conf,
|
||||
private_encryptor_conf: private_enc_conf,
|
||||
@@ -632,16 +629,6 @@ impl Configuration {
|
||||
})
|
||||
}
|
||||
|
||||
fn ipfs_config(&self) -> IpfsConfiguration {
|
||||
IpfsConfiguration {
|
||||
enabled: self.args.flag_ipfs_api,
|
||||
port: self.args.arg_ports_shift + self.args.arg_ipfs_api_port,
|
||||
interface: self.ipfs_interface(),
|
||||
cors: self.ipfs_cors(),
|
||||
hosts: self.ipfs_hosts(),
|
||||
}
|
||||
}
|
||||
|
||||
fn gas_pricer_config(&self) -> Result<GasPricerConfig, String> {
|
||||
fn wei_per_gas(usd_per_tx: f32, usd_per_eth: f32) -> U256 {
|
||||
let wei_per_usd: f32 = 1.0e18 / usd_per_eth;
|
||||
@@ -817,10 +804,6 @@ impl Configuration {
|
||||
Self::cors(&cors)
|
||||
}
|
||||
|
||||
fn ipfs_cors(&self) -> Option<Vec<String>> {
|
||||
Self::cors(self.args.arg_ipfs_api_cors.as_ref())
|
||||
}
|
||||
|
||||
fn hosts(&self, hosts: &str, interface: &str) -> Option<Vec<String>> {
|
||||
if self.args.flag_unsafe_expose {
|
||||
return None;
|
||||
@@ -859,10 +842,6 @@ impl Configuration {
|
||||
Self::parse_hosts(&self.args.arg_ws_origins)
|
||||
}
|
||||
|
||||
fn ipfs_hosts(&self) -> Option<Vec<String>> {
|
||||
self.hosts(&self.args.arg_ipfs_api_hosts, &self.ipfs_interface())
|
||||
}
|
||||
|
||||
fn ipc_config(&self) -> Result<IpcConfiguration, String> {
|
||||
let conf = IpcConfiguration {
|
||||
chmod: self.args.arg_ipc_chmod.clone(),
|
||||
@@ -1060,10 +1039,6 @@ impl Configuration {
|
||||
self.interface(&self.args.arg_ws_interface)
|
||||
}
|
||||
|
||||
fn ipfs_interface(&self) -> String {
|
||||
self.interface(&self.args.arg_ipfs_api_interface)
|
||||
}
|
||||
|
||||
fn secretstore_interface(&self) -> String {
|
||||
self.interface(&self.args.arg_secretstore_interface)
|
||||
}
|
||||
@@ -1456,7 +1431,6 @@ mod tests {
|
||||
geth_compatibility: false,
|
||||
experimental_rpcs: false,
|
||||
net_settings: Default::default(),
|
||||
ipfs_conf: Default::default(),
|
||||
secretstore_conf: Default::default(),
|
||||
private_provider_conf: Default::default(),
|
||||
private_encryptor_conf: Default::default(),
|
||||
@@ -1616,38 +1590,6 @@ mod tests {
|
||||
assert_eq!(http_conf.max_payload, 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_ipfs_hosts() {
|
||||
// given
|
||||
|
||||
// when
|
||||
let conf0 = parse(&["parity"]);
|
||||
let conf1 = parse(&["parity", "--ipfs-api-hosts", "none"]);
|
||||
let conf2 = parse(&["parity", "--ipfs-api-hosts", "all"]);
|
||||
let conf3 = parse(&["parity", "--ipfs-api-hosts", "parity.io,something.io"]);
|
||||
|
||||
// then
|
||||
assert_eq!(conf0.ipfs_hosts(), Some(Vec::new()));
|
||||
assert_eq!(conf1.ipfs_hosts(), Some(Vec::new()));
|
||||
assert_eq!(conf2.ipfs_hosts(), None);
|
||||
assert_eq!(conf3.ipfs_hosts(), Some(vec!["parity.io".into(), "something.io".into()]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_ipfs_cors() {
|
||||
// given
|
||||
|
||||
// when
|
||||
let conf0 = parse(&["parity"]);
|
||||
let conf1 = parse(&["parity", "--ipfs-api-cors", "*"]);
|
||||
let conf2 = parse(&["parity", "--ipfs-api-cors", "http://parity.io,http://something.io"]);
|
||||
|
||||
// then
|
||||
assert_eq!(conf0.ipfs_cors(), Some(vec![]));
|
||||
assert_eq!(conf1.ipfs_cors(), None);
|
||||
assert_eq!(conf2.ipfs_cors(), Some(vec!["http://parity.io".into(),"http://something.io".into()]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_ui_configuration() {
|
||||
// given
|
||||
@@ -1760,7 +1702,6 @@ mod tests {
|
||||
}
|
||||
// "web3,eth,net,personal,parity,parity_set,traces,rpc,parity_accounts");
|
||||
assert_eq!(c.http_conf.hosts, None);
|
||||
assert_eq!(c.ipfs_conf.hosts, None);
|
||||
},
|
||||
_ => panic!("Should be Cmd::Run"),
|
||||
}
|
||||
@@ -1783,7 +1724,6 @@ mod tests {
|
||||
}
|
||||
// "web3,eth,net,personal,parity,parity_set,traces,rpc,parity_accounts");
|
||||
assert_eq!(c.http_conf.hosts, None);
|
||||
assert_eq!(c.ipfs_conf.hosts, None);
|
||||
},
|
||||
_ => panic!("Should be Cmd::Run"),
|
||||
}
|
||||
@@ -1830,7 +1770,6 @@ mod tests {
|
||||
assert_eq!(conf0.ws_config().unwrap().port, 8547);
|
||||
assert_eq!(conf0.secretstore_config().unwrap().port, 8084);
|
||||
assert_eq!(conf0.secretstore_config().unwrap().http_port, 8083);
|
||||
assert_eq!(conf0.ipfs_config().port, 5002);
|
||||
assert_eq!(conf0.stratum_options().unwrap().unwrap().port, 8009);
|
||||
|
||||
assert_eq!(conf1.net_addresses().unwrap().0.port(), 30304);
|
||||
@@ -1840,7 +1779,6 @@ mod tests {
|
||||
assert_eq!(conf1.ws_config().unwrap().port, 8547);
|
||||
assert_eq!(conf1.secretstore_config().unwrap().port, 8084);
|
||||
assert_eq!(conf1.secretstore_config().unwrap().http_port, 8083);
|
||||
assert_eq!(conf1.ipfs_config().port, 5002);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1886,8 +1824,6 @@ mod tests {
|
||||
assert_eq!(conf0.ws_config().unwrap().origins, None);
|
||||
assert_eq!(&conf0.secretstore_config().unwrap().interface, "0.0.0.0");
|
||||
assert_eq!(&conf0.secretstore_config().unwrap().http_interface, "0.0.0.0");
|
||||
assert_eq!(&conf0.ipfs_config().interface, "0.0.0.0");
|
||||
assert_eq!(conf0.ipfs_config().hosts, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Ethereum.
|
||||
|
||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::sync::Arc;
|
||||
use parity_ipfs_api::{self, AccessControlAllowOrigin, Host, Listening};
|
||||
use parity_ipfs_api::error::ServerError;
|
||||
use client_traits::BlockChainClient;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Configuration {
|
||||
pub enabled: bool,
|
||||
pub port: u16,
|
||||
pub interface: String,
|
||||
pub cors: Option<Vec<String>>,
|
||||
pub hosts: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
impl Default for Configuration {
|
||||
fn default() -> Self {
|
||||
Configuration {
|
||||
enabled: false,
|
||||
port: 5001,
|
||||
interface: "127.0.0.1".into(),
|
||||
cors: Some(vec![]),
|
||||
hosts: Some(vec![]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start_server(conf: Configuration, client: Arc<dyn BlockChainClient>) -> Result<Option<Listening>, ServerError> {
|
||||
if !conf.enabled {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let cors = conf.cors.map(|cors| cors.into_iter().map(AccessControlAllowOrigin::from).collect());
|
||||
let hosts = conf.hosts.map(|hosts| hosts.into_iter().map(Host::from).collect());
|
||||
|
||||
parity_ipfs_api::start_server(
|
||||
conf.port,
|
||||
conf.interface,
|
||||
cors.into(),
|
||||
hosts.into(),
|
||||
client
|
||||
).map(Some)
|
||||
}
|
||||
@@ -65,7 +65,6 @@ extern crate node_filter;
|
||||
extern crate parity_bytes as bytes;
|
||||
extern crate parity_crypto;
|
||||
extern crate parity_hash_fetch as hash_fetch;
|
||||
extern crate parity_ipfs_api;
|
||||
extern crate parity_local_store as local_store;
|
||||
extern crate parity_path as path;
|
||||
extern crate parity_rpc;
|
||||
@@ -106,7 +105,6 @@ mod cache;
|
||||
mod cli;
|
||||
mod configuration;
|
||||
mod export_hardcoded_sync;
|
||||
mod ipfs;
|
||||
mod deprecated;
|
||||
mod helpers;
|
||||
mod informant;
|
||||
|
||||
@@ -58,7 +58,6 @@ use helpers::{to_client_config, execute_upgrades, passwords_from_files};
|
||||
use dir::{Directories, DatabaseDirectories};
|
||||
use cache::CacheConfig;
|
||||
use user_defaults::UserDefaults;
|
||||
use ipfs;
|
||||
use jsonrpc_core;
|
||||
use modules;
|
||||
use rpc;
|
||||
@@ -116,7 +115,6 @@ pub struct RunCmd {
|
||||
pub geth_compatibility: bool,
|
||||
pub experimental_rpcs: bool,
|
||||
pub net_settings: NetworkSettings,
|
||||
pub ipfs_conf: ipfs::Configuration,
|
||||
pub secretstore_conf: secretstore::Configuration,
|
||||
pub private_provider_conf: ProviderConfig,
|
||||
pub private_encryptor_conf: EncryptorConfig,
|
||||
@@ -761,9 +759,6 @@ fn execute_impl<Cr, Rr>(
|
||||
};
|
||||
let secretstore_key_server = secretstore::start(cmd.secretstore_conf.clone(), secretstore_deps, runtime.executor())?;
|
||||
|
||||
// the ipfs server
|
||||
let ipfs_server = ipfs::start_server(cmd.ipfs_conf.clone(), client.clone())?;
|
||||
|
||||
// the informant
|
||||
let informant = Arc::new(Informant::new(
|
||||
FullNodeInformantData {
|
||||
@@ -821,7 +816,7 @@ fn execute_impl<Cr, Rr>(
|
||||
informant,
|
||||
client,
|
||||
client_service: Arc::new(service),
|
||||
keep_alive: Box::new((watcher, updater, ws_server, http_server, ipc_server, secretstore_key_server, ipfs_server, runtime)),
|
||||
keep_alive: Box::new((watcher, updater, ws_server, http_server, ipc_server, secretstore_key_server, runtime)),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user