chore: updated the cli so that it can accept ports correctly
This commit is contained in:
parent
692a54b059
commit
59197c52b3
|
@ -23,5 +23,5 @@ This project is currently based on an unstable feature of block subscription of
|
|||
|
||||
|
||||
```
|
||||
cargo run --bin lite-rpc -- --port 9000 --subscription-port 9001 --url http://localhost:8899
|
||||
cargo run --bin lite-rpc -- --port 9000 --subscription-port 9001 --rpc-url http://localhost:8899
|
||||
```
|
10
src/cli.rs
10
src/cli.rs
|
@ -1,4 +1,4 @@
|
|||
use {clap::Parser, solana_cli_config::ConfigInput, std::net::SocketAddr};
|
||||
use {clap::Parser, solana_cli_config::ConfigInput};
|
||||
|
||||
/// Holds the configuration for a single run of the benchmark
|
||||
#[derive(Parser, Debug)]
|
||||
|
@ -11,10 +11,10 @@ use {clap::Parser, solana_cli_config::ConfigInput, std::net::SocketAddr};
|
|||
"
|
||||
)]
|
||||
pub struct Args {
|
||||
#[arg(short, long, default_value_t = SocketAddr::from(([127, 0, 0, 1], 9000)))]
|
||||
pub port: SocketAddr,
|
||||
#[arg(short, long, default_value_t = SocketAddr::from(([127, 0, 0, 1], 8900)))]
|
||||
pub subscription_port: SocketAddr,
|
||||
#[arg(short, long, default_value_t = String::new())]
|
||||
pub port: String,
|
||||
#[arg(short, long, default_value_t = String::new())]
|
||||
pub subscription_port: String,
|
||||
#[arg(short, long, default_value_t = String::new())]
|
||||
pub rpc_url: String,
|
||||
#[arg(short, long, default_value_t = String::new())]
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -1,4 +1,4 @@
|
|||
use std::sync::Arc;
|
||||
use std::{sync::Arc, net::SocketAddr};
|
||||
|
||||
use clap::Parser;
|
||||
use context::LiteRpcSubsrciptionControl;
|
||||
|
@ -42,9 +42,13 @@ pub fn main() {
|
|||
notification_reciever,
|
||||
));
|
||||
|
||||
let subscription_port = subscription_port
|
||||
.parse::<SocketAddr>()
|
||||
.expect("Invalid subscription port");
|
||||
|
||||
// start websocket server
|
||||
let (_trigger, websocket_service) =
|
||||
LitePubSubService::new(pubsub_control.clone(), *subscription_port);
|
||||
LitePubSubService::new(pubsub_control.clone(), subscription_port);
|
||||
|
||||
// start recieving notifications and broadcast them
|
||||
{
|
||||
|
@ -73,7 +77,7 @@ pub fn main() {
|
|||
.expect("Runtime"),
|
||||
);
|
||||
let max_request_body_size: usize = 50 * (1 << 10);
|
||||
let socket_addr = *rpc_addr;
|
||||
let socket_addr = rpc_addr.parse::<SocketAddr>().unwrap();
|
||||
|
||||
{
|
||||
let request_processor = request_processor.clone();
|
||||
|
|
Loading…
Reference in New Issue