feat: add direct server-to-server file transfer (--transfer)#30
Merged
Conversation
Add a new transfer mode that streams files directly from one server to another over SFTP, relaying data through the local machine without writing to local disk. - sshx --transfer=<src-host>:<src-path> --to=<dst-host>:<dst-path> - Supports single files and recursive directory transfers - Preserves file permission bits; drops source into existing dst dirs - Both hosts resolve from ~/.sshx/settings.json (per-host key/user/port) - Dry-run plan and audit events support the new mode - Documented in --help, README, and README_CN Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new transfer mode that streams files directly from one server to another over SFTP, relaying data through the local machine without writing to local disk.
Features
~/.sshx/settings.json) or IPs, each resolving its own SSH key / user / portImplementation
internal/sshclient/transfer.go(new):TransferTo()opens SFTP sessions on both connections and streams src → dstinternal/app/transfer.go(new):HandleTransfer()derives per-endpoint configs, resolves hosts from settings, connects both sidesinternal/app/config.go: parses--transfer=host:pathand--to=host:path(SFTP--tosemantics unchanged)internal/app/dryrun.go/audit.go: transfer mode support (transfer_source/transfer_destinationfields, config validation, audit action)--help, README, README_CNTesting
host:pathsplitting, missing src/dst validation, dry-run plan (valid + invalid)go build,go vet, fullgo test ./...,golangci-lint(0 issues),gofmtall pass