diff --git a/go.mod b/go.mod index 10f0697..ab1224a 100644 --- a/go.mod +++ b/go.mod @@ -6,5 +6,5 @@ require ( github.com/jessevdk/go-flags v1.4.0 github.com/shazow/rateio v0.0.0-20150116013248-e8e00881e5c1 golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a - golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect + golang.org/x/sys v0.0.0-20190312061237-fead79001313 ) diff --git a/host.go b/host.go index 8918964..e14bb7c 100644 --- a/host.go +++ b/host.go @@ -146,14 +146,6 @@ func (h *Host) Connect(term *sshd.Terminal) { break } - // Gross hack to override line echo in golang.org/x/crypto/ssh/terminal - // It needs to live before we render any responses. - term.Write([]byte{ - 27, '[', 'A', // Up - 27, '[', '2', 'K', // Clear line - }) - // May the gods have mercy on our souls. - err = ratelimit.Count(1) if err != nil { user.Send(message.NewSystemMsg("Message rejected: Rate limiting is in effect.", user)) diff --git a/sshd/terminal.go b/sshd/terminal.go index 0a1c32f..2dd25ae 100644 --- a/sshd/terminal.go +++ b/sshd/terminal.go @@ -7,8 +7,8 @@ import ( "sync" "time" + "github.com/shazow/ssh-chat/sshd/terminal" "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/terminal" ) var keepaliveInterval = time.Second * 30 @@ -81,6 +81,7 @@ func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) { done: make(chan struct{}), } + term.Terminal.ClearLine = true go term.listen(requests)