Prefix 127.0.0.1 to address if starts with :

This commit is contained in:
notplants 2022-05-26 22:54:19 +02:00
parent b4987d514a
commit fb115b280f
3 changed files with 7 additions and 3 deletions

2
Cargo.lock generated
View File

@ -543,7 +543,7 @@ dependencies = [
[[package]]
name = "golgi"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"async-std",
"async-stream 0.3.2",

View File

@ -1,6 +1,6 @@
[package]
name = "golgi"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
authors = ["Max Fowler <max@mfowler.info>", "Andrew Reid <glyph@mycelial.technology>"]
readme = "README.md"

View File

@ -58,12 +58,16 @@ impl Sbot {
ip_port: Option<String>,
net_id: Option<String>,
) -> Result<Sbot, GolgiError> {
let address = if ip_port.is_none() {
let mut address = if ip_port.is_none() {
"127.0.0.1:8008".to_string()
} else {
ip_port.unwrap()
};
if address.starts_with(":") {
address = format!("127.0.0.1{}", address);
}
let network_id = if net_id.is_none() {
discovery::ssb_net_id()
} else {