Documentation
¶
Index ¶
- Constants
- func Chtimes(name string, atime time.Time, mtime time.Time) error
- func CombineURL(parts ...string) string
- func Copy(src, dstDir string, chownRoot bool) error
- func Download(rawurl string, directory string, filename string) (savedname string, err error)
- func DownloadDisabledTLS(rawurl string, directory string, filename string) (savedname string, err error)
- func DownloadWithHeader(rawurl string, directory string, filename string, header map[string]string) (savedname string, err error)
- func EnsureDir(path string, perm fs.FileMode) error
- func HttpGet(url string) (body []byte, statusCode int, err error)
- func IsNotExist(err error) bool
- func IsURL(str string) bool
- func LUtimesNano(path string, ts []syscall.Timespec) error
- func Max[T Comparable](a, b T) T
- func Min[T Comparable](a, b T) T
- func PathExists(path string) bool
- func SaveJsonFile(x interface{}, path string) (err error)
- func SecureJoin(root, unsafePath string) (string, error)
- func SliceContains[T comparable](s []T, elem T) bool
- func SliceDelete[T comparable](s []T, elem T) []T
- func SliceDigest[T any](s []T) string
- func SliceIndex[T Comparable](s []T, elem T) int
- func URLtoFilename(url string) (filename string)
- func UnescapeURL(encodedURL string) (string, error)
- func WithGPUs(s *specs.Spec) error
- type Capability
- type Comparable
Constants ¶
const NvidiaCLI = "nvidia-container-cli"
NvidiaCLI is the path to the Nvidia helper binary
Variables ¶
This section is empty.
Functions ¶
func Chtimes ¶
Chtimes changes the access time and modified time of a file at the given path. If the modified time is prior to the Unix Epoch (unixMinTime), or after the end of Unix Time (unixEpochTime), os.Chtimes has undefined behavior. In this case, Chtimes defaults to Unix Epoch, just in case.
func CombineURL ¶
func DownloadDisabledTLS ¶
func DownloadWithHeader ¶
func EnsureDir ¶
ensureDir checks if a path exists and is a directory. If the path does not exist, it tries to create the directory. If the path is a file, it returns an error.
func IsNotExist ¶
IsNotExist tells you if err is an error that implies that either the path accessed does not exist (or path components don't exist). This is effectively a more broad version of os.IsNotExist.
func LUtimesNano ¶
LUtimesNano is used to change access and modification time of the specified path. It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm.
func Max ¶
func Max[T Comparable](a, b T) T
func Min ¶
func Min[T Comparable](a, b T) T
func PathExists ¶
func SaveJsonFile ¶
func SecureJoin ¶
SecureJoinVFS joins the two given path components (similar to Join) except that the returned path is guaranteed to be scoped inside the provided root path (when evaluated). Any symbolic links in the path are evaluated with the given root treated as the root of the filesystem, similar to a chroot. The filesystem state is evaluated through the given VFS interface (if nil, the standard os.* family of functions are used).
Note that the guarantees provided by this function only apply if the path components in the returned string are not modified (in other words are not replaced with symlinks on the filesystem) after this function has returned. Such a symlink race is necessarily out-of-scope of SecureJoin.
NOTE: Due to the above limitation, Linux users are strongly encouraged to use OpenInRoot instead, which does safely protect against these kinds of attacks. There is no way to solve this problem with SecureJoinVFS because the API is fundamentally wrong (you cannot return a "safe" path string and guarantee it won't be modified afterwards).
Volume names in unsafePath are always discarded, regardless if they are provided via direct input or when evaluating symlinks. Therefore:
"C:\Temp" + "D:\path\to\file.txt" results in "C:\Temp\path\to\file.txt"
func SliceContains ¶
func SliceContains[T comparable](s []T, elem T) bool
func SliceDelete ¶
func SliceDelete[T comparable](s []T, elem T) []T
func SliceDigest ¶
func SliceIndex ¶
func SliceIndex[T Comparable](s []T, elem T) int
func URLtoFilename ¶
func UnescapeURL ¶
Types ¶
type Capability ¶
type Capability string
Capability specifies capabilities for the gpu inside the container Detailed explanation of options can be found: https://github.com/nvidia/nvidia-container-runtime#supported-driver-capabilities
const ( // Compute capability Compute Capability = "compute" // Compat32 capability Compat32 Capability = "compat32" // Graphics capability Graphics Capability = "graphics" // Utility capability Utility Capability = "utility" // Video capability Video Capability = "video" // Display capability Display Capability = "display" )
func AllCaps ¶
func AllCaps() []Capability
AllCaps returns the complete list of supported Nvidia capabilities.