调整参数格式
This commit is contained in:
@@ -15,10 +15,10 @@ pub fn convert(vec: Vec<String>) -> anyhow::Result<Vec<(bool, SocketAddr, String
|
|||||||
for x in vec {
|
for x in vec {
|
||||||
let string = x.trim().to_lowercase();
|
let string = x.trim().to_lowercase();
|
||||||
if let Some(udp_mapping) = string.strip_prefix("udp:") {
|
if let Some(udp_mapping) = string.strip_prefix("udp:") {
|
||||||
let mut split = udp_mapping.split("->");
|
let mut split = udp_mapping.split("-");
|
||||||
let bind_addr = split.next().with_context(|| {
|
let bind_addr = split.next().with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"udp_mapping error {:?},eg: udp:127.0.0.1:80->10.26.0.10:8080",
|
"udp_mapping error {:?},eg: udp:127.0.0.1:80-10.26.0.10:8080",
|
||||||
x
|
x
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
@@ -26,7 +26,7 @@ pub fn convert(vec: Vec<String>) -> anyhow::Result<Vec<(bool, SocketAddr, String
|
|||||||
.with_context(|| format!("udp_mapping error {}", bind_addr))?;
|
.with_context(|| format!("udp_mapping error {}", bind_addr))?;
|
||||||
let dest = split.next().with_context(|| {
|
let dest = split.next().with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"udp_mapping error {:?},eg: udp:127.0.0.1:80->10.26.0.10:8080",
|
"udp_mapping error {:?},eg: udp:127.0.0.1:80-10.26.0.10:8080",
|
||||||
x
|
x
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
@@ -34,10 +34,10 @@ pub fn convert(vec: Vec<String>) -> anyhow::Result<Vec<(bool, SocketAddr, String
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(tcp_mapping) = string.strip_prefix("tcp:") {
|
if let Some(tcp_mapping) = string.strip_prefix("tcp:") {
|
||||||
let mut split = tcp_mapping.split("->");
|
let mut split = tcp_mapping.split("-");
|
||||||
let bind_addr = split.next().with_context(|| {
|
let bind_addr = split.next().with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"tcp_mapping error {:?},eg: tcp:127.0.0.1:80->10.26.0.10:8080",
|
"tcp_mapping error {:?},eg: tcp:127.0.0.1:80-10.26.0.10:8080",
|
||||||
x
|
x
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
@@ -45,7 +45,7 @@ pub fn convert(vec: Vec<String>) -> anyhow::Result<Vec<(bool, SocketAddr, String
|
|||||||
.with_context(|| format!("udp_mapping error {}", bind_addr))?;
|
.with_context(|| format!("udp_mapping error {}", bind_addr))?;
|
||||||
let dest = split.next().with_context(|| {
|
let dest = split.next().with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"tcp_mapping error {:?},eg: tcp:127.0.0.1:80->10.26.0.10:8080",
|
"tcp_mapping error {:?},eg: tcp:127.0.0.1:80-10.26.0.10:8080",
|
||||||
x
|
x
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
@@ -53,7 +53,7 @@ pub fn convert(vec: Vec<String>) -> anyhow::Result<Vec<(bool, SocketAddr, String
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Err(anyhow::anyhow!(
|
Err(anyhow::anyhow!(
|
||||||
"port_mapping error {:?},eg: tcp:127.0.0.1:80->10.26.0.10:8080",
|
"port_mapping error {:?},eg: tcp:127.0.0.1:80-10.26.0.10:8080",
|
||||||
x
|
x
|
||||||
))?;
|
))?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user