Skip to content

Commit

Permalink
Enable running remote cargo registry server
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarg66 committed Oct 10, 2023
1 parent 4c664a8 commit 6b03f9e
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 10 deletions.
227 changes: 223 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ prost = "0.11.9"
prost-build = "0.11.9"
prost-types = "0.11.9"
protobuf-src = "1.1.0"
public-ip = "0.2.2"
qstring = "0.7.2"
qualifier_attr = { version = "0.2.2", default-features = false }
quinn = "0.10.2"
Expand Down
1 change: 1 addition & 0 deletions cargo-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ git2 = { workspace = true }
hyper = { workspace = true, features = ["full"] }
hyper-staticfile = { workspace = true }
log = { workspace = true }
public-ip = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
solana-clap-utils = { workspace = true }
Expand Down
11 changes: 11 additions & 0 deletions cargo-registry/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl<'a> ClientConfig<'a> {
pub struct Client {
pub rpc_client: Arc<RpcClient>,
pub port: u16,
pub use_public_ip: bool,
websocket_url: String,
commitment: commitment_config::CommitmentConfig,
cli_signers: Vec<Keypair>,
Expand Down Expand Up @@ -112,6 +113,13 @@ impl Client {
.takes_value(true)
.help("Cargo registry's local TCP port. The server will bind to this port and wait for requests."),
)
.arg(
Arg::with_name("use_public_ip")
.long("public-ip")
.global(true)
.takes_value(false)
.help("Should the registry server use public IP"),
)
.arg(
Arg::with_name("commitment")
.long("commitment")
Expand Down Expand Up @@ -192,6 +200,8 @@ impl Client {

let port = value_t_or_exit!(matches, "port", u16);

let use_public_ip = matches.is_present("use_public_ip");

Ok(Client {
rpc_client: Arc::new(RpcClient::new_with_timeouts_and_commitment(
json_rpc_url.to_string(),
Expand All @@ -200,6 +210,7 @@ impl Client {
confirm_transaction_initial_timeout,
)),
port,
use_public_ip,
websocket_url,
commitment,
cli_signers: vec![payer_keypair, authority_keypair],
Expand Down
Loading

0 comments on commit 6b03f9e

Please sign in to comment.