From dfa411f65dca9d6ceb90338cfc440989bd289b2e Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 8 Sep 2020 19:52:47 +0800 Subject: [PATCH] opt ssh --- base/ssh/server_darwin.go | 15 +++++++++++++++ base/ssh/server_linux.go | 15 +++++++++++++++ base/ssh/server_windows.go | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 base/ssh/server_darwin.go create mode 100644 base/ssh/server_linux.go create mode 100644 base/ssh/server_windows.go diff --git a/base/ssh/server_darwin.go b/base/ssh/server_darwin.go new file mode 100644 index 00000000..266d3410 --- /dev/null +++ b/base/ssh/server_darwin.go @@ -0,0 +1,15 @@ +package ssh + +import ( + "encoding/binary" + "syscall" + "unsafe" +) + +func _ssh_size(fd uintptr, b []byte) { + w := binary.BigEndian.Uint32(b) + h := binary.BigEndian.Uint32(b[4:]) + + ws := &Winsize{Width: uint16(w), Height: uint16(h)} + syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws))) +} diff --git a/base/ssh/server_linux.go b/base/ssh/server_linux.go new file mode 100644 index 00000000..266d3410 --- /dev/null +++ b/base/ssh/server_linux.go @@ -0,0 +1,15 @@ +package ssh + +import ( + "encoding/binary" + "syscall" + "unsafe" +) + +func _ssh_size(fd uintptr, b []byte) { + w := binary.BigEndian.Uint32(b) + h := binary.BigEndian.Uint32(b[4:]) + + ws := &Winsize{Width: uint16(w), Height: uint16(h)} + syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws))) +} diff --git a/base/ssh/server_windows.go b/base/ssh/server_windows.go new file mode 100644 index 00000000..ca29f9b8 --- /dev/null +++ b/base/ssh/server_windows.go @@ -0,0 +1,4 @@ +package ssh + +func _ssh_size(fd uintptr, b []byte) { +}