Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Filter RPC APIs on public nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejhirsz committed Mar 28, 2017
1 parent 1c7b740 commit fc31fdf
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions parity/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,26 @@ impl Configuration {
}

fn rpc_apis(&self) -> String {
let mut apis = self.args.flag_rpcapi.clone().unwrap_or(self.args.flag_jsonrpc_apis.clone());
let mut apis: Vec<&str> = self.args.flag_rpcapi
.as_ref()
.unwrap_or(&self.args.flag_jsonrpc_apis)
.split(",")
.collect();

if self.args.flag_geth {
if !apis.is_empty() {
apis.push_str(",");
}
apis.push_str("personal");
apis.push("personal");
}
apis

if self.args.flag_public_node {
apis.retain(|api| {
match *api {
"eth" | "net" | "parity" | "rpc" | "web3" => true,
_ => false
}
});
}

apis.join(",")
}

fn cors(cors: Option<&String>) -> Option<Vec<String>> {
Expand Down

0 comments on commit fc31fdf

Please sign in to comment.