Fixed bug, filter return false will be filtered, updated error messages

This commit is contained in:
Y. T. Chung
2017-10-12 02:23:29 +08:00
parent cf44a3db90
commit 1e6b2e60bc
2 changed files with 4 additions and 4 deletions

View File

@@ -220,7 +220,7 @@ impl<I: Iterator<Item = SocketAddr>> Future for TcpStreamConnect<I> {
TcpStreamConnect::Connect { last_err, .. } => {
match last_err {
None => {
let err = io::Error::new(ErrorKind::Other, "Connect without any addresses");
let err = io::Error::new(ErrorKind::Other, "connect TCP without any addresses");
Err(err)
}
Some(err) => Err(err),

View File

@@ -76,7 +76,7 @@ impl TcpRelayClientPending {
if forbidden_ip.contains(&addr.ip()) {
info!("{} has been forbidden", addr);
let err = io::Error::new(ErrorKind::Other, format!("{} forbidden address", addr));
let err = io::Error::new(ErrorKind::Other, format!("{} is forbidden", addr));
Err(err)
} else {
Ok(vec![addr])
@@ -95,9 +95,9 @@ impl TcpRelayClientPending {
let v = ip_addr.iter()
.filter(|ipaddr| if forbidden_ip.contains(ipaddr) {
info!("{} has been forbidden", ipaddr);
true
} else {
false
} else {
true
})
.map(|ip| match *ip {
IpAddr::V4(v4) => SocketAddr::V4(SocketAddrV4::new(v4, port)),