SSH connection status indicators
- Add Connected bool field to vfs.Entry and RemoteMount - Track connection status in sshState.connectedHosts - Show status icon (connected/disconnected) in pane header when browsing remote host - Async SSH connection test with cancel support for Add Host dialog - Colored labels and styled help text in SSH dialogs - Confirmation dialog when deleting manually-added SSH hosts
This commit is contained in:
parent
df4df6b8f6
commit
1ed2d3defb
224 changed files with 33447 additions and 236 deletions
57
vendor/github.com/pkg/sftp/request-attrs.go
generated
vendored
Normal file
57
vendor/github.com/pkg/sftp/request-attrs.go
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package sftp
|
||||
|
||||
// Methods on the Request object to make working with the Flags bitmasks and
|
||||
// Attr(ibutes) byte blob easier. Use Pflags() when working with an Open/Write
|
||||
// request and AttrFlags() and Attributes() when working with SetStat requests.
|
||||
|
||||
// FileOpenFlags defines Open and Write Flags. Correlate directly with with os.OpenFile flags
|
||||
// (https://golang.org/pkg/os/#pkg-constants).
|
||||
type FileOpenFlags struct {
|
||||
Read, Write, Append, Creat, Trunc, Excl bool
|
||||
}
|
||||
|
||||
func newFileOpenFlags(flags uint32) FileOpenFlags {
|
||||
return FileOpenFlags{
|
||||
Read: flags&sshFxfRead != 0,
|
||||
Write: flags&sshFxfWrite != 0,
|
||||
Append: flags&sshFxfAppend != 0,
|
||||
Creat: flags&sshFxfCreat != 0,
|
||||
Trunc: flags&sshFxfTrunc != 0,
|
||||
Excl: flags&sshFxfExcl != 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Pflags converts the bitmap/uint32 from SFTP Open packet pflag values,
|
||||
// into a FileOpenFlags struct with booleans set for flags set in bitmap.
|
||||
func (r *Request) Pflags() FileOpenFlags {
|
||||
return newFileOpenFlags(r.Flags)
|
||||
}
|
||||
|
||||
// FileAttrFlags that indicate whether SFTP file attributes were passed. When a flag is
|
||||
// true the corresponding attribute should be available from the FileStat
|
||||
// object returned by Attributes method. Used with SetStat.
|
||||
type FileAttrFlags struct {
|
||||
Size, UidGid, Permissions, Acmodtime bool
|
||||
}
|
||||
|
||||
func newFileAttrFlags(flags uint32) FileAttrFlags {
|
||||
return FileAttrFlags{
|
||||
Size: (flags & sshFileXferAttrSize) != 0,
|
||||
UidGid: (flags & sshFileXferAttrUIDGID) != 0,
|
||||
Permissions: (flags & sshFileXferAttrPermissions) != 0,
|
||||
Acmodtime: (flags & sshFileXferAttrACmodTime) != 0,
|
||||
}
|
||||
}
|
||||
|
||||
// AttrFlags returns a FileAttrFlags boolean struct based on the
|
||||
// bitmap/uint32 file attribute flags from the SFTP packaet.
|
||||
func (r *Request) AttrFlags() FileAttrFlags {
|
||||
return newFileAttrFlags(r.Flags)
|
||||
}
|
||||
|
||||
// Attributes parses file attributes byte blob and return them in a
|
||||
// FileStat object.
|
||||
func (r *Request) Attributes() *FileStat {
|
||||
fs, _, _ := unmarshalFileStat(r.Flags, r.Attrs)
|
||||
return fs
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue