mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-08 23:58:31 -04:00
Use bail when possible
This commit is contained in:
parent
ce40f85efa
commit
56c950d159
1 changed files with 2 additions and 2 deletions
|
@ -202,14 +202,14 @@ impl Config {
|
||||||
.collect();
|
.collect();
|
||||||
for port_forward in remote_port_forwards.iter_mut() {
|
for port_forward in remote_port_forwards.iter_mut() {
|
||||||
if port_forward.source.ip() != source_peer_ip {
|
if port_forward.source.ip() != source_peer_ip {
|
||||||
return Err(anyhow::anyhow!("Remote port forward config <src_host> must match --source-peer-ip ({}), or be omitted.", source_peer_ip));
|
bail!("Remote port forward config <src_host> must match --source-peer-ip ({}), or be omitted.", source_peer_ip);
|
||||||
}
|
}
|
||||||
port_forward.source = SocketAddr::from((source_peer_ip, port_forward.source.port()));
|
port_forward.source = SocketAddr::from((source_peer_ip, port_forward.source.port()));
|
||||||
port_forward.remote = true;
|
port_forward.remote = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if port_forwards.is_empty() && remote_port_forwards.is_empty() {
|
if port_forwards.is_empty() && remote_port_forwards.is_empty() {
|
||||||
return Err(anyhow::anyhow!("No port forward configurations given."));
|
bail!("No port forward configurations given.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read private key from file or CLI argument
|
// Read private key from file or CLI argument
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue