Skip to content

fix: Use redis over SSH channel(#2057) #2060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2022
Merged

fix: Use redis over SSH channel(#2057) #2060

merged 1 commit into from
Mar 26, 2022

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