Skip to content

Commit

Permalink
fix: 为添加注释导致lint未通过
Browse files Browse the repository at this point in the history
  • Loading branch information
voidint committed Jul 30, 2024
1 parent 0bca4d5 commit d3d3538
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const (
PwdAuth SSHAuthMethod = 2
)

// OverSSH SSH 代理配置
type OverSSH struct {
Host string `yml:"host" json:"host"`
Port int `yml:"port" json:"port"`
Expand All @@ -129,6 +130,7 @@ type OverSSH struct {
KeyFile string `yml:"key_file" json:"key_file"`
}

// DialWithPassword 返回密码方式认证的 SSH 客户端
func (s *OverSSH) DialWithPassword() (*ssh.Client, error) {
return ssh.Dial(
"tcp",
Expand All @@ -143,6 +145,7 @@ func (s *OverSSH) DialWithPassword() (*ssh.Client, error) {
)
}

// DialWithKeyFile 返回公钥方式认证的 SSH 客户端
func (s *OverSSH) DialWithKeyFile() (*ssh.Client, error) {
k, err := os.ReadFile(s.KeyFile)
if err != nil {
Expand All @@ -166,6 +169,7 @@ func (s *OverSSH) DialWithKeyFile() (*ssh.Client, error) {
)
}

// MakeDialer 创建 SSH 代理拨号器
func (s *OverSSH) MakeDialer() func(ctx context.Context, network, addr string) (net.Conn, error) {
return func(ctx context.Context, network, addr string) (net.Conn, error) {
var err error
Expand Down

0 comments on commit d3d3538

Please sign in to comment.