Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ifconfig.me with solana_net_utils::get_public_ip_addr for Public IP #106

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ protobuf-src = "1.1.0"
quinn = "0.9"
rand = "0.8.5"
rayon = "1.7.0"
reqwest = "0.11.16"
rustls = { version = "0.20", features = ["dangerous_configuration"] }
serde = { version = "1.0.160", features = ["derive"] }
serde_json = "1.0.96"
Expand Down
1 change: 0 additions & 1 deletion transaction-relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jwt = { workspace = true }
log = { workspace = true }
openssl = { workspace = true }
prost-types = { workspace = true }
reqwest = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-client = { workspace = true }
solana-core = { workspace = true }
Expand Down
17 changes: 11 additions & 6 deletions transaction-relayer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ struct Args {
)]
websocket_servers: Vec<String>,

#[arg(long, env, default_value = "entrypoint.mainnet-beta.solana.com:8001")]
entrypoint_address: String,

/// This is the IP address that will be shared with the validator. The validator will
/// tell the rest of the network to send packets here.
#[arg(long, env)]
Expand Down Expand Up @@ -253,13 +256,15 @@ fn main() {
let public_ip = if args.public_ip.is_some() {
args.public_ip.unwrap()
} else {
info!("reading public ip from ifconfig.me...");
let response = reqwest::blocking::get("https://ifconfig.me")
.expect("response from ifconfig.me")
.text()
.expect("public ip response");
response.parse().unwrap()
let entrypoint = solana_net_utils::parse_host_port(args.entrypoint_address.as_str())
.expect("parse entrypoint");
info!(
"Contacting {} to determine the validator's public IP address",
entrypoint
);
solana_net_utils::get_public_ip_addr(&entrypoint).expect("get public ip address")
};

info!("public ip: {:?}", public_ip);
assert!(
public_ip.is_ipv4(),
Expand Down
Loading