Initial import
This commit is contained in:
47
ssh/sshutil/request.go
Normal file
47
ssh/sshutil/request.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package sshutil
|
||||
|
||||
import "golang.org/x/crypto/ssh"
|
||||
|
||||
type EnvRequest struct {
|
||||
Key, Value string
|
||||
}
|
||||
|
||||
func ParseEnvRequest(data []byte) (*EnvRequest, error) {
|
||||
r := new(EnvRequest)
|
||||
if err := ssh.Unmarshal(data, r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
type PTYRequest struct {
|
||||
Term string
|
||||
Columns uint32
|
||||
Rows uint32
|
||||
Width uint32
|
||||
Height uint32
|
||||
ModeList []byte
|
||||
}
|
||||
|
||||
func ParsePTYRequest(data []byte) (*PTYRequest, error) {
|
||||
r := new(PTYRequest)
|
||||
if err := ssh.Unmarshal(data, r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
type WindowChangeRequest struct {
|
||||
Columns uint32
|
||||
Rows uint32
|
||||
Width uint32
|
||||
Height uint32
|
||||
}
|
||||
|
||||
func ParseWindowChangeRequest(data []byte) (*WindowChangeRequest, error) {
|
||||
r := new(WindowChangeRequest)
|
||||
if err := ssh.Unmarshal(data, r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
}
|
Reference in New Issue
Block a user