Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanMaintainSymlinkTimestamps ¶
func CanMaintainSymlinkTimestamps() bool
CanMaintainSymlinkTimestamps determines whether is is possible to change timestamps on symlinks for the the current platform. For regular files and directories, attempts are made to restore permissions and timestamps after extraction. But for symbolic links, go's cross-platform packages (Chmod and Chtimes) are not capable of changing symlink info because those methods follow the symlinks. However, a platform-dependent option is provided for linux and darwin (see Lchtimes)
Types ¶
type UnpackInfo ¶
type UnpackInfo struct { Path string OriginalAccessTime time.Time OriginalModTime time.Time OriginalMode fs.FileMode Typeflag byte }
UnpackInfo stores information about the file (or directory, or symlink) being unpacked. UnpackInfo ensures certain malicious tar files are not unpacked. The information can be used later to restore the original permissions and timestamps based on the type of entry the info represents.
func NewUnpackInfo ¶
func NewUnpackInfo(dst string, header *tar.Header) (UnpackInfo, error)
NewUnpackInfo returns an UnpackInfo based on a destination root and a tar header. It will return an error if the header represents an illegal symlink extraction or if the entry type is not supported by go-slug.
func (UnpackInfo) IsDirectory ¶
func (i UnpackInfo) IsDirectory() bool
IsDirectory describes whether the file being unpacked is a directory
func (UnpackInfo) IsRegular ¶
func (i UnpackInfo) IsRegular() bool
IsRegular describes whether the file being unpacked is a regular file
func (UnpackInfo) IsSymlink ¶
func (i UnpackInfo) IsSymlink() bool
IsSymlink describes whether the file being unpacked is a symlink
func (UnpackInfo) IsTypeX ¶
func (i UnpackInfo) IsTypeX() bool
IsTypeX describes whether the file being unpacked is a special TypeXHeader that can be ignored by go-slug
func (UnpackInfo) Lchtimes ¶
func (i UnpackInfo) Lchtimes() error
Lchtimes modifies the access and modified timestamps on a target path This capability is only available on Linux and Darwin as of now.
func (UnpackInfo) RestoreInfo ¶
func (i UnpackInfo) RestoreInfo() error
RestoreInfo changes the file mode and timestamps for the given UnpackInfo data