Ai
1 Star 0 Fork 0

moorewqk/sshftp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
client_test.go 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
moorewqk 提交于 2022-03-09 19:13 +08:00 . add code
package sshftp
import (
"fmt"
"testing"
)
func Test_client(t *testing.T) {
config :=Config{
Username: "root",
Password: "Servy0u@123",
PrivateKey: "",
Server: "10.199.146.76:22",
Timeout: 3,
}
client,err := New(config)
if err!=nil{
t.Log(err.Error())
}
stdout, stderr, err := client.Cmd("ps aux | grep nginx")
fmt.Println(stdout,stderr,err)
tp := `
upstream btest {
server 10.199.157.94:30880;
}
server {
listen 80;
server_name b.k8stest.aa ; #当前主机名
location / {
proxy_pass http://btest;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 30s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
`
fmt.Println(tp)
//reader := strings.NewReader(tp)
//dest,err := client.sftpCreate("/tmp/abc.com.conf")
//
//client.sftpUpload(reader,dest,1000000)
client.sftpRemove("/tmp/abc.com.conf")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/moorewqk/sshftp.git
git@gitee.com:moorewqk/sshftp.git
moorewqk
sshftp
sshftp
master

搜索帮助