Close Phase 4 overlay and Unix forwarding gaps
This commit is contained in:
parent
0fdf5d0be7
commit
b0768999db
9 changed files with 210 additions and 13 deletions
|
|
@ -47,6 +47,18 @@ pub enum PipeError {
|
|||
InvalidUnixSocketPath(String),
|
||||
}
|
||||
|
||||
pub const UNIX_FORWARD_UNSUPPORTED_MESSAGE: &str = "Unix socket forwarding is only supported on Unix platforms; use TCP forwarding on this platform";
|
||||
|
||||
#[must_use]
|
||||
pub const fn unix_forward_supported() -> bool {
|
||||
cfg!(unix)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn unix_forward_unsupported_message() -> &'static str {
|
||||
UNIX_FORWARD_UNSUPPORTED_MESSAGE
|
||||
}
|
||||
|
||||
pub fn validate_pipe_name(name: &str) -> Result<(), PipeError> {
|
||||
if name.is_empty()
|
||||
|| !name
|
||||
|
|
@ -124,6 +136,12 @@ mod tests {
|
|||
assert!(validate_tcp_forward_target_addr("192.0.2.10:22").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unix_forward_support_is_explicit_for_platforms() {
|
||||
assert_eq!(unix_forward_supported(), cfg!(unix));
|
||||
assert!(unix_forward_unsupported_message().contains("Unix socket forwarding"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unix_forward_paths_must_be_absolute_without_parent_components() {
|
||||
assert!(validate_unix_forward_path(Path::new("/tmp/geth.sock")).is_ok());
|
||||
|
|
|
|||
Loading…
Reference in a new issue