Skip to content

Conversation

@slowrookie
Copy link
Contributor

useage:

     sshConfig := &ssh.ClientConfig{
		User:            "root",
		Auth:            []ssh.AuthMethod{ssh.Password("password")},
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
		Timeout:         15 * time.Second,
	}

	client, err := ssh.Dial("tcp", "remoteIP:22", sshConfig)
	if err != nil {
		log.Println(fmt.Errorf("%v", err))
	}

	cli := redis.NewClient(&redis.Options{
		Addr: net.JoinHostPort("127.0.0.1", "6379"),
		Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
			return client.Dial(network, addr)
		},
		ReadTimeout:  -1,
		WriteTimeout: -1,
	})
       
       

@monkey92t
Copy link
Collaborator

This seems to lose ctx.Deadline?

@monkey92t
Copy link
Collaborator

But few people use ssh to connect to redis. We can ignore ctx.Deadline

In addition, we need to pay attention to the v9 version connCheck(conn.SetDeadline(time.Time{})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants