File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ const (
120
120
PwdAuth SSHAuthMethod = 2
121
121
)
122
122
123
+ // OverSSH SSH 代理配置
123
124
type OverSSH struct {
124
125
Host string `yml:"host" json:"host"`
125
126
Port int `yml:"port" json:"port"`
@@ -129,6 +130,7 @@ type OverSSH struct {
129
130
KeyFile string `yml:"key_file" json:"key_file"`
130
131
}
131
132
133
+ // DialWithPassword 返回密码方式认证的 SSH 客户端
132
134
func (s * OverSSH ) DialWithPassword () (* ssh.Client , error ) {
133
135
return ssh .Dial (
134
136
"tcp" ,
@@ -143,6 +145,7 @@ func (s *OverSSH) DialWithPassword() (*ssh.Client, error) {
143
145
)
144
146
}
145
147
148
+ // DialWithKeyFile 返回公钥方式认证的 SSH 客户端
146
149
func (s * OverSSH ) DialWithKeyFile () (* ssh.Client , error ) {
147
150
k , err := os .ReadFile (s .KeyFile )
148
151
if err != nil {
@@ -166,6 +169,7 @@ func (s *OverSSH) DialWithKeyFile() (*ssh.Client, error) {
166
169
)
167
170
}
168
171
172
+ // MakeDialer 创建 SSH 代理拨号器
169
173
func (s * OverSSH ) MakeDialer () func (ctx context.Context , network , addr string ) (net.Conn , error ) {
170
174
return func (ctx context.Context , network , addr string ) (net.Conn , error ) {
171
175
var err error
You can’t perform that action at this time.
0 commit comments