add ssh tunnel

This commit is contained in:
ginuerzh
2021-12-19 17:24:51 +08:00
parent 10bcc59370
commit 34d6e393a1
12 changed files with 561 additions and 50 deletions

View File

@ -15,10 +15,6 @@ import (
"golang.org/x/crypto/ssh"
)
var (
ErrSessionDead = errors.New("ssh: session is dead")
)
func init() {
registry.RegisterDialer("sshd", NewDialer)
}
@ -126,7 +122,7 @@ func (d *forwardDialer) Handshake(ctx context.Context, conn net.Conn, options ..
}
if session.IsClosed() {
delete(d.sessions, opts.Addr)
return nil, ErrSessionDead
return nil, ssh_util.ErrSessionDead
}
return ssh_util.NewClientConn(session.conn, session.client), nil