Documentation ¶
Overview ¶
package sftp provides an SFTP client.
Index ¶
- type Client
- func (s *Client) Chmod(path string, mode os.FileMode) error
- func (s *Client) Chown(path string, uid, gid int) error
- func (s *Client) Close()
- func (s *Client) LStat(path string) (os.FileInfo, error)
- func (s *Client) Mkdir(name string, perm os.FileMode) error
- func (s *Client) Open(name string) (*File, error)
- func (s *Client) OpenFile(name string, flags int, attrs os.FileMode) (*File, error)
- func (s *Client) PosixRename(oldname, newname string) error
- func (c *Client) Put(r io.Reader, remote string) (n int64, _ error)
- func (s *Client) ReadDir(name string) ([]os.FileInfo, error)
- func (s *Client) Readlink(name string) (string, error)
- func (s *Client) Realpath(path string) (string, error)
- func (s *Client) Remove(name string) error
- func (s *Client) Rename(oldname, newname string) error
- func (s *Client) Rmdir(name string) error
- func (s *Client) Stat(path string) (os.FileInfo, error)
- func (s *Client) Symlink(oldname, newname string) error
- type File
- func (f *File) Chown(uid, gid int) error
- func (f *File) Close() error
- func (f *File) Name() string
- func (f *File) Read(b []byte) (int, error)
- func (f *File) ReadAt(b []byte, off int64) (n int, err error)
- func (f *File) Seek(offset int64, whence int) (ret int64, err error)
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) String() string
- func (f *File) Write(b []byte) (int, error)
- func (f *File) WriteAt(b []byte, off int64) (n int, err error)
- type FileAttributes
- type Status
- type UnexpectedMessageError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides an SFTP client instance.
func (*Client) Close ¶
func (s *Client) Close()
Close closes the SSH session and stops listening for new messages. No further operations may be performed on the instance after calling Close.
func (*Client) Mkdir ¶
Mkdir creates a directory at the specified absolute path with the specified permissions.
func (*Client) PosixRename ¶
func (*Client) Put ¶
Put is a convenience method that copies data to the remote path, creating the file with default permissions if it does not exist and overwriting it if it does.
func (*Client) ReadDir ¶
ReadDir returns a list of file information for files in a specific directory.
type FileAttributes ¶
type FileAttributes struct {
// contains filtered or unexported fields
}
FileAttributes contains information about a particular file. It fulfills the os.FileInfo interface. However, the SFTP specification allows the server to only conditionally include fields if the server supports them. See the function documentation for how this is handled.
func (FileAttributes) IsDir ¶
func (f FileAttributes) IsDir() bool
IsDir returns true if the entity is a directory. If mode was not returned by the server, this method's return value is undefined.
func (FileAttributes) ModTime ¶
func (f FileAttributes) ModTime() time.Time
ModTime returns the modification time of the file. If the time was not returned by the server, this method returns the zero-time.
func (FileAttributes) Mode ¶
func (f FileAttributes) Mode() os.FileMode
Mode returns a file's mode and permission bits. If mode was not returned by the server, this method returns 0.
func (FileAttributes) Name ¶
func (f FileAttributes) Name() string
Name returns the name of the file to which the data applies.
func (FileAttributes) Size ¶
func (f FileAttributes) Size() int64
Size returns the size in bytes of the file. If the size was not returned by the server, -1 is returned.
func (FileAttributes) Sys ¶
func (f FileAttributes) Sys() interface{}
Sys returns the underlying data source of this structure.
type Status ¶
type Status uint32
Status is a error number defined by section 7, "Responses from the Server to the Client".
type UnexpectedMessageError ¶
type UnexpectedMessageError struct {
// contains filtered or unexported fields
}
UnexpectedMessageError results when the SSH message that was received did not match what the protocol specifies as the proper returned message type.
func (UnexpectedMessageError) Error ¶
func (u UnexpectedMessageError) Error() string