Skip to content

Commit e919af3

Browse files
authored
validate acl init (#10)
1 parent d93a046 commit e919af3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/http2socks.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ where
2323
config
2424
.acl_file
2525
.as_ref()
26-
.and_then(|acl_file| crate::acl::AccessControl::load_from_file(acl_file).ok())
26+
.and_then(|acl_file| match crate::acl::AccessControl::load_from_file(acl_file) {
27+
Ok(ac) => Some(ac),
28+
Err(e) => {
29+
log::warn!("Could not init ACL: {e}");
30+
None
31+
}
32+
})
2733
});
2834

2935
let listen_addr = config.listen_proxy_role.addr;

src/socks2socks.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ where
2323
config
2424
.acl_file
2525
.as_ref()
26-
.and_then(|acl_file| crate::acl::AccessControl::load_from_file(acl_file).ok())
26+
.and_then(|acl_file| match crate::acl::AccessControl::load_from_file(acl_file) {
27+
Ok(ac) => Some(ac),
28+
Err(e) => {
29+
log::warn!("Could not init ACL: {e}");
30+
None
31+
}
32+
})
2733
});
2834

2935
let listen_addr = config.listen_proxy_role.addr;

0 commit comments

Comments
 (0)