utils

package
v0.0.0-...-1f5a39b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRepoBranchOrCommit

func CloneRepoBranchOrCommit(repoURL, publicKey, branchOrCommit, destDir string) error

CloneRepoBranchOrCommit 克隆指定分支或提交

func ConnectSFTP

func ConnectSFTP(serverAddress, username, privateKey string) (*sftp.Client, error)

ConnectSFTP 连接到SFTP服务器

func ConnectToSSHServer

func ConnectToSSHServer(serverAddress, publicKey, username string) (*ssh.Client, error)

ConnectToSSHServer 使用SSH私钥连接到SSH服务器

func ExecuteSSHCommand

func ExecuteSSHCommand(client *ssh.Client, commands ...string) (string, error)

ExecuteSSHCommand 在SSH会话中执行命令并返回输出结果

func GenerateRSAKeys

func GenerateRSAKeys() (privateKeyPEM string, publicKeySSH string, err error)

GenerateRSAKeys 生成2048位的RSA密钥对,并以OpenSSH格式返回公钥和PEM格式返回私钥

func GetRepositoryBranchesAndTags

func GetRepositoryBranchesAndTags(repoURL string, publicKey string) ([]string, []string, error)

GetRepositoryBranchesAndTags 获取 Git 仓库的分支和 Tags

func SyncDir

func SyncDir(client *sftp.Client, localDir, remoteDir string) error

SyncDir 使用SFTP同步本地目录到远程目录

func SyncFile

func SyncFile(client *sftp.Client, localFilePath, remoteFilePath string) error

SyncFile 使用SFTP同步本地文件到远程目录

func ZipFolder

func ZipFolder(source, target string) error

ZipFolder compresses the specified folder into a zip file, maintaining the folder's structure

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL