feat: add host actions, lifecycle hooks and operational tools
Test / test (push) Successful in 4m4s
Release / release (push) Successful in 7m39s

This commit is contained in:
Sebastian Unterschütz committed 2026-11-18 10:41:36 +01:00
1 parent 8d4915543e
commit e5bde9c61f
32 files changed
+2083 -64

No files matched your search

+8 -1
View File
@@ -26,7 +26,8 @@ type SSHOptions struct {
Forwards map[string]Forward `mapstructure:"forwards"`
// PreConnect is a shell command run locally before connecting; a non-zero
// exit aborts the connection. "none" disables a hook set by a broader layer.
PreConnect string `mapstructure:"pre_connect"`
PreConnect string `mapstructure:"pre_connect"`
PostDisconnect string `mapstructure:"post_disconnect"`
}
// PreConnectNone disables an inherited pre_connect hook.
@@ -170,6 +171,9 @@ func (o SSHOptions) Validate(scope string) error {
return fmt.Errorf("%s.options: invalid option %q", scope, key)
}
}
if strings.ContainsRune(o.PostDisconnect, 0) {
return fmt.Errorf("%s.post_disconnect must not contain NUL bytes", scope)
}
if strings.ContainsRune(o.PreConnect, 0) {
return fmt.Errorf("%s.pre_connect must not contain NUL bytes", scope)
}
@@ -239,6 +243,9 @@ func (o SSHOptions) merge(override SSHOptions) SSHOptions {
if override.AddressFamily != "" {
out.AddressFamily = override.AddressFamily
}
if strings.TrimSpace(override.PostDisconnect) != "" {
out.PostDisconnect = override.PostDisconnect
}
if strings.TrimSpace(override.PreConnect) != "" {
out.PreConnect = override.PreConnect
}