Skip to content

Commit

Permalink
Rename solana-netutil to solana-net-utils for consistency (solana-lab…
Browse files Browse the repository at this point in the history
…s#6895)

* sed -i -e 's/netutil/net_utils/g' $(git grep --files-with-matches netutil :**.rs)

* sed -i -e 's/netutil/net-utils/g' $(git grep --files-with-matches netutil)

* git mv netutil/ net-utils

* Tweak a bit

* Fix rustfmt & clippy
  • Loading branch information
ryoqun authored and mvines committed Nov 12, 2019
1 parent bb00904 commit 3faeb7f
Show file tree
Hide file tree
Showing 33 changed files with 78 additions and 74 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ members = [
"sdk",
"sdk-c",
"upload-perf",
"netutil",
"net-utils",
"fixed-buf",
"vote-signer",
"cli",
Expand Down
2 changes: 1 addition & 1 deletion archiver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ solana-clap-utils = { path = "../clap-utils", version = "0.21.0" }
solana-core = { path = "../core", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }
solana-metrics = { path = "../metrics", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }

9 changes: 5 additions & 4 deletions archiver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() {
.value_name("HOST:PORT")
.takes_value(true)
.required(true)
.validator(solana_netutil::is_host_port)
.validator(solana_net_utils::is_host_port)
.help("Rendezvous with the cluster at this entry point"),
)
.arg(
Expand Down Expand Up @@ -80,14 +80,15 @@ fn main() {
let entrypoint_addr = matches
.value_of("entrypoint")
.map(|entrypoint| {
solana_netutil::parse_host_port(entrypoint).expect("failed to parse entrypoint address")
solana_net_utils::parse_host_port(entrypoint)
.expect("failed to parse entrypoint address")
})
.unwrap();

let gossip_addr = {
let ip = solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap();
let ip = solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap();
let mut addr = SocketAddr::new(ip, 0);
addr.set_ip(solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap());
addr.set_ip(solana_net_utils::get_public_ip_addr(&entrypoint_addr).unwrap());
addr
};
let node =
Expand Down
2 changes: 1 addition & 1 deletion bench-exchange/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ solana-exchange-api = { path = "../programs/exchange_api", version = "0.21.0" }
solana-exchange-program = { path = "../programs/exchange_program", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }
solana-metrics = { path = "../metrics", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-runtime = { path = "../runtime", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }
untrusted = "0.7.0"
Expand Down
14 changes: 8 additions & 6 deletions bench-exchange/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
let mut args = Config::default();

args.entrypoint_addr = solana_netutil::parse_host_port(matches.value_of("entrypoint").unwrap())
.unwrap_or_else(|e| {
eprintln!("failed to parse entrypoint address: {}", e);
exit(1)
});
args.entrypoint_addr = solana_net_utils::parse_host_port(
matches.value_of("entrypoint").unwrap(),
)
.unwrap_or_else(|e| {
eprintln!("failed to parse entrypoint address: {}", e);
exit(1)
});

args.drone_addr = solana_netutil::parse_host_port(matches.value_of("drone").unwrap())
args.drone_addr = solana_net_utils::parse_host_port(matches.value_of("drone").unwrap())
.unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e);
exit(1)
Expand Down
2 changes: 1 addition & 1 deletion bench-streamer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ homepage = "https://solana.com/"
clap = "2.33.0"
solana-core = { path = "../core", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
2 changes: 1 addition & 1 deletion bench-streamer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn main() -> Result<()> {
let mut read_threads = Vec::new();
let recycler = PacketsRecycler::default();
for _ in 0..num_sockets {
let read = solana_netutil::bind_to(port, false).unwrap();
let read = solana_net_utils::bind_to(port, false).unwrap();
read.set_read_timeout(Some(Duration::new(1, 0))).unwrap();

addr = read.local_addr().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion bench-tps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ solana-librapay-api = { path = "../programs/librapay_api", version = "0.21.0", o
solana-logger = { path = "../logger", version = "0.21.0" }
solana-metrics = { path = "../metrics", version = "0.21.0" }
solana-measure = { path = "../measure", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-runtime = { path = "../runtime", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }
solana-move-loader-program = { path = "../programs/move_loader_program", version = "0.21.0", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions bench-tps/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
let mut args = Config::default();

if let Some(addr) = matches.value_of("entrypoint") {
args.entrypoint_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
args.entrypoint_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse entrypoint address: {}", e);
exit(1)
});
}

if let Some(addr) = matches.value_of("drone") {
args.drone_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
args.drone_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e);
exit(1)
});
Expand Down
2 changes: 1 addition & 1 deletion ci/nits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare print_free_tree=(
'core/src'
'drone/src'
'metrics/src'
'netutil/src'
'net-utils/src'
'runtime/src'
'sdk/bpf/rust/rust-utils'
'sdk/src'
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ solana-client = { path = "../client", version = "0.21.0" }
solana-config-api = { path = "../programs/config_api", version = "0.21.0" }
solana-drone = { path = "../drone", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-runtime = { path = "../runtime", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }
solana-stake-api = { path = "../programs/stake_api", version = "0.21.0" }
Expand Down
4 changes: 2 additions & 2 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
})?;

let drone_host = if let Some(drone_host) = matches.value_of("drone_host") {
Some(solana_netutil::parse_host(drone_host).or_else(|err| {
Some(solana_net_utils::parse_host(drone_host).or_else(|err| {
Err(CliError::BadParameter(format!(
"Invalid drone host: {:?}",
err
Expand Down Expand Up @@ -1058,7 +1058,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
.host()
.unwrap()
.to_string();
solana_netutil::parse_host(&drone_host).unwrap_or_else(|err| {
solana_net_utils::parse_host(&drone_host).unwrap_or_else(|err| {
panic!("Unable to resolve {}: {}", drone_host, err);
})
}),
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ reqwest = { version = "0.9.22", default-features = false, features = ["rustls-tl
serde = "1.0.102"
serde_derive = "1.0.102"
serde_json = "1.0.41"
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions client/src/thin_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ impl AsyncClient for ThinClient {
}

pub fn create_client((rpc, tpu): (SocketAddr, SocketAddr), range: (u16, u16)) -> ThinClient {
let (_, transactions_socket) = solana_netutil::bind_in_range(range).unwrap();
let (_, transactions_socket) = solana_net_utils::bind_in_range(range).unwrap();
ThinClient::new(rpc, tpu, transactions_socket)
}

Expand All @@ -603,7 +603,7 @@ pub fn create_client_with_timeout(
range: (u16, u16),
timeout: Duration,
) -> ThinClient {
let (_, transactions_socket) = solana_netutil::bind_in_range(range).unwrap();
let (_, transactions_socket) = solana_net_utils::bind_in_range(range).unwrap();
ThinClient::new_socket_with_timeout(rpc, tpu, transactions_socket, timeout)
}

Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ solana-logger = { path = "../logger", version = "0.21.0" }
solana-merkle-tree = { path = "../merkle-tree", version = "0.21.0" }
solana-metrics = { path = "../metrics", version = "0.21.0" }
solana-measure = { path = "../measure", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-perf = { path = "../perf", version = "0.21.0" }
solana-runtime = { path = "../runtime", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }
Expand Down
2 changes: 1 addition & 1 deletion core/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use solana_client::{rpc_client::RpcClient, rpc_request::RpcRequest, thin_client:
use solana_ledger::{
blocktree::Blocktree, leader_schedule_cache::LeaderScheduleCache, shred::Shred,
};
use solana_netutil::bind_in_range;
use solana_net_utils::bind_in_range;
use solana_perf::recycler::Recycler;
use solana_sdk::{
account_utils::State,
Expand Down
2 changes: 1 addition & 1 deletion core/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use itertools::Itertools;
use rand::{thread_rng, Rng};
use solana_ledger::{bank_forks::BankForks, blocktree::Blocktree, staking_utils};
use solana_metrics::{datapoint_debug, inc_new_counter_debug, inc_new_counter_error};
use solana_netutil::{
use solana_net_utils::{
bind_common, bind_common_in_range, bind_in_range, find_available_port_in_range,
multi_bind_in_range, PortRange,
};
Expand Down
4 changes: 2 additions & 2 deletions core/src/gossip_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn discover(
info!("Gossip entry point: {:?}", entry_point);
info!("Spy node id: {:?}", id);

let _ip_echo_server = ip_echo.map(solana_netutil::ip_echo_server);
let _ip_echo_server = ip_echo.map(solana_net_utils::ip_echo_server);

let (met_criteria, secs, tvu_peers, archivers) = spy(
spy_ref.clone(),
Expand Down Expand Up @@ -143,7 +143,7 @@ pub fn get_multi_client(nodes: &[ContactInfo]) -> (ThinClient, usize) {
.collect();
let rpc_addrs: Vec<_> = addrs.iter().map(|addr| addr.0).collect();
let tpu_addrs: Vec<_> = addrs.iter().map(|addr| addr.1).collect();
let (_, transactions_socket) = solana_netutil::bind_in_range(VALIDATOR_PORT_RANGE).unwrap();
let (_, transactions_socket) = solana_net_utils::bind_in_range(VALIDATOR_PORT_RANGE).unwrap();
let num_nodes = tpu_addrs.len();
(
ThinClient::new_from_addrs(rpc_addrs, tpu_addrs, transactions_socket),
Expand Down
4 changes: 2 additions & 2 deletions core/src/local_vote_signer_service.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! The `local_vote_signer_service` can be started locally to sign validator votes
use crate::service::Service;
use solana_netutil::PortRange;
use solana_net_utils::PortRange;
use solana_vote_signer::rpc::VoteSignerRpcService;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::atomic::{AtomicBool, Ordering};
Expand All @@ -25,7 +25,7 @@ impl Service for LocalVoteSignerService {
impl LocalVoteSignerService {
#[allow(clippy::new_ret_no_self)]
pub fn new(port_range: PortRange) -> (Self, SocketAddr) {
let addr = match solana_netutil::find_available_port_in_range(port_range) {
let addr = match solana_net_utils::find_available_port_in_range(port_range) {
Ok(port) => SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), port),
Err(_e) => panic!("Failed to find an available port for local vote signer service"),
};
Expand Down
2 changes: 1 addition & 1 deletion core/src/retransmit_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ mod tests {
use crate::packet::{self, Meta, Packet, Packets};
use solana_ledger::blocktree::create_new_tmp_ledger;
use solana_ledger::blocktree_processor::{process_blocktree, ProcessOptions};
use solana_netutil::find_available_port_in_range;
use solana_net_utils::find_available_port_in_range;
use solana_sdk::pubkey::Pubkey;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion core/src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ mod tests {
)));
let rpc_addr = SocketAddr::new(
IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
solana_netutil::find_available_port_in_range((10000, 65535)).unwrap(),
solana_net_utils::find_available_port_in_range((10000, 65535)).unwrap(),
);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank.slot(), bank)));
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
Expand Down
4 changes: 2 additions & 2 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub struct Validator {
poh_service: PohService,
tpu: Tpu,
tvu: Tvu,
ip_echo_server: solana_netutil::IpEchoServer,
ip_echo_server: solana_net_utils::IpEchoServer,
}

impl Validator {
Expand Down Expand Up @@ -272,7 +272,7 @@ impl Validator {
"New blob signal for the TVU should be the same as the clear bank signal."
);

let ip_echo_server = solana_netutil::ip_echo_server(node.sockets.ip_echo.unwrap());
let ip_echo_server = solana_net_utils::ip_echo_server(node.sockets.ip_echo.unwrap());

let gossip_service = GossipService::new(
&cluster_info,
Expand Down
2 changes: 1 addition & 1 deletion gossip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ solana-clap-utils = { path = "../clap-utils", version = "0.21.0" }
solana-core = { path = "../core", version = "0.21.0" }
solana-client = { path = "../client", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }
solana-netutil = { path = "../netutil", version = "0.21.0" }
solana-net-utils = { path = "../net-utils", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" }


Expand Down
Loading

0 comments on commit 3faeb7f

Please sign in to comment.