Documentation ¶
Index ¶
- func AddSlash(path string) string
- func CachePath(path ...string) string
- func CanonicalNetworkAddress(address string, defaultPort int) string
- func CanonicalNetworkAddressFromAddressAndPort(address string, port int, defaultPort int) string
- func DirCopy(source string, dest string) error
- func FileCopy(source string, dest string) error
- func FileMove(oldPath string, newPath string) error
- func IsAddressCovered(address1, address2 string) bool
- func IsDir(name string) bool
- func IsUnixSocket(path string) bool
- func IsWildCardAddress(address string) bool
- func JoinTokenDecode(input string) (*api.ClusterMemberJoinToken, error)
- func LoadCert(dir string) (*localtls.CertInfo, error)
- func LoadClusterCert(dir string) (*localtls.CertInfo, error)
- func LoadServerCert(dir string) (*localtls.CertInfo, error)
- func LogPath(path ...string) string
- func MkdirAllOwner(path string, perm os.FileMode, uid int, gid int) error
- func NetworkInterfaceAddress() string
- func PathIsEmpty(path string) (bool, error)
- func RandomHexString(length int) (string, error)
- func RenderTemplate(template string, ctx pongo2.Context) (string, error)
- func RunPath(path ...string) string
- func VarPath(path ...string) string
- func WriteCert(dir, prefix string, cert, key, ca []byte) error
- type PoolType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSlash ¶
AddSlash adds a slash to the end of paths if they don't already have one. This can be useful for rsyncing things, since rsync has behavior present on the presence or absence of a trailing slash.
func CachePath ¶
CachePath returns the directory that Incus should its cache under. If INCUS_DIR is set, this path is $INCUS_DIR/cache, otherwise it is /var/cache/incus.
func CanonicalNetworkAddress ¶
CanonicalNetworkAddress parses the given network address and returns a string of the form "host:port", possibly filling it with the default port if it's missing. It will also wrap a bare IPv6 address with square brackets if needed.
func CanonicalNetworkAddressFromAddressAndPort ¶
CanonicalNetworkAddressFromAddressAndPort returns a network address from separate address and port values. The address accepts values such as "[::]", "::" and "localhost".
func FileMove ¶
FileMove tries to move a file by using os.Rename, if that fails it tries to copy the file and remove the source.
func IsAddressCovered ¶
IsAddressCovered detects if network address1 is actually covered by address2, in the sense that they are either the same address or address2 is specified using a wildcard with the same port of address1.
func IsUnixSocket ¶
IsUnixSocket returns true if the given path is either a Unix socket or a symbolic link pointing at a Unix socket.
func IsWildCardAddress ¶
IsWildCardAddress returns whether the given address is a wildcard.
func JoinTokenDecode ¶
func JoinTokenDecode(input string) (*api.ClusterMemberJoinToken, error)
JoinTokenDecode decodes a base64 and JSON encoded join token.
func LoadCert ¶
LoadCert reads the server certificate from the given var dir.
If a cluster certificate is found it will be loaded instead. If neither a server or cluster certfificate exists, a new server certificate will be generated.
func LoadClusterCert ¶
LoadClusterCert reads the cluster certificate from the given var dir.
If a cluster certificate doesn't exist, a new one is generated.
func LoadServerCert ¶
LoadServerCert reads the server certificate from the given var dir.
func LogPath ¶
LogPath returns the directory that Incus should put logs under. If INCUS_DIR is set, this path is $INCUS_DIR/logs, otherwise it is /var/log/incus.
func NetworkInterfaceAddress ¶
func NetworkInterfaceAddress() string
NetworkInterfaceAddress returns the first global unicast address of any of the system network interfaces. Return the empty string if none is found.
func PathIsEmpty ¶
PathIsEmpty checks if the given path is empty.
func RandomHexString ¶
RandomHexString returns a random string of hexadecimal characters.
func RenderTemplate ¶
RenderTemplate renders a pongo2 template.
func RunPath ¶
RunPath returns the directory that Incus should put runtime data under. If INCUS_DIR is set, this path is $INCUS_DIR/run, otherwise it is /run/incus.
Types ¶
type PoolType ¶
type PoolType string
PoolType represents a type of storage pool (local, remote or any).
const PoolTypeAny PoolType = ""
PoolTypeAny represents any storage pool (local or remote).
const PoolTypeLocal PoolType = "local"
PoolTypeLocal represents local storage pools.
const PoolTypeRemote PoolType = "remote"
PoolTypeRemote represents remote storage pools.