feat: [WIP] implement scp by bgo

This commit is contained in:
2026-06-12 14:12:11 +08:00
parent 3cd92945ac
commit 250ba269f5
5 changed files with 278 additions and 21 deletions
+17 -4
View File
@@ -340,12 +340,16 @@ func (a *App) runSaveRemotePipeline(pngBytes []byte) error {
"auth_method", cfg.SSH.AuthMethod, "png_size", len(pngBytes))
// Select the uploader by auth method: Kerberos delegates to the system
// ssh/scp binaries (reusing the kinit credential cache), while builtin
// uses the in-process Go SSH client.
// ssh/scp binaries (reusing the kinit credential cache), bgo delegates to
// the internal `bgo scp` client (under a PTY), while builtin uses the
// in-process Go SSH client.
var uploader application.SSHUploader
if cfg.SSH.IsKerberos() {
switch {
case cfg.SSH.IsKerberos():
uploader = sshpkg.NewKerberosUploader(cfg.SSH)
} else {
case cfg.SSH.IsBgo():
uploader = sshpkg.NewBgoUploader(cfg.SSH)
default:
uploader = sshpkg.NewUploader(cfg.SSH)
}
@@ -467,6 +471,15 @@ func (a *App) TestSSHConnection(cfg domain.SSHConfig) error {
}
return nil
}
// bgo manages its own auth; we can only confirm the binary is installed
// and resolvable (a real transfer would need a live remote + PTY).
if cfg.IsBgo() {
if err := sshpkg.TestBgoConnection(a.ctx, cfg); err != nil {
slog.Error("RPC TestSSHConnection (bgo) failed", "err", err)
return err
}
return nil
}
if err := sshpkg.TestConnection(a.ctx, cfg); err != nil {
slog.Error("RPC TestSSHConnection failed", "err", err)
return err