This commit is contained in:
2024-04-03 20:59:37 +03:00
parent 0376ce4e06
commit 6795fa089a
20 changed files with 38 additions and 95 deletions
+5 -5
View File
@@ -12,10 +12,10 @@ import (
"github.com/gliderlabs/ssh"
"github.com/google/shlex"
"github.com/kr/pty"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
"git.company.lan/gopkg/kong"
"github.com/alecthomas/colour"
"github.com/alecthomas/kong"
)
// Handle a single SSH interactive connection.
@@ -31,11 +31,11 @@ func handle(log *log.Logger, s ssh.Session) error {
return err
}
defer tty.Close()
state, err := terminal.GetState(int(cpty.Fd()))
state, err := term.GetState(int(cpty.Fd()))
if err != nil {
return err
}
defer terminal.Restore(int(cpty.Fd()), state)
defer term.Restore(int(cpty.Fd()), state)
colour.Fprintln(tty, "^BWelcome!^R")
go io.Copy(cpty, s)
@@ -53,7 +53,7 @@ func handle(log *log.Logger, s ssh.Session) error {
Stdin: tty,
FuncOnWidthChanged: func(f func()) {},
FuncMakeRaw: func() error {
_, err := terminal.MakeRaw(int(cpty.Fd())) // nolint: govet
_, err := term.MakeRaw(int(cpty.Fd())) // nolint: govet
return err
},
FuncExitRaw: func() error { return nil },