util

package
v0.0.0-...-c6cf541 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const DNS1123LabelMaxLength int = 63

Variables

This section is empty.

Functions

func CloseNoError

func CloseNoError(c io.Closer)

func CreateCACertificate

func CreateCACertificate(commonName string) (cert []byte, key []byte, err error)

func CreateClientCertificate

func CreateClientCertificate(commonName string, signer *x509.Certificate, signerKey *rsa.PrivateKey, hosts ...string) (cert []byte, key []byte, err error)

func CreateDirectoryPath

func CreateDirectoryPath(path string) error

func CreateFile

func CreateFile(fileName string, perm os.FileMode) (*os.File, error)

func CreateServerCertificate

func CreateServerCertificate(commonName string, signer *x509.Certificate, signerKey *rsa.PrivateKey, hosts ...string) (cert []byte, key []byte, err error)

func DirectoryExists

func DirectoryExists(path string) (bool, error)

func DownloadHTTP

func DownloadHTTP(url string) (io.ReadCloser, error)

func ExecCommandAndWait

func ExecCommandAndWait(name string, arg ...string) error

func ExtractTar

func ExtractTar(in io.Reader, outDir string) error

func FileExists

func FileExists(path string) (bool, error)

func GenerateTextTemplate

func GenerateTextTemplate(templateStr string, params interface{}) []byte

func GetUserDefaultSSHPublicKeyPath

func GetUserDefaultSSHPublicKeyPath() string

func GetUserHomeDir

func GetUserHomeDir() string

func IsDNS1123Label

func IsDNS1123Label(value string) error

stolen from here: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).

func ParseCertificate

func ParseCertificate(data []byte) (*x509.Certificate, error)

func ParsePrivateKey

func ParsePrivateKey(data []byte) (*rsa.PrivateKey, error)

func RemoveDirectory

func RemoveDirectory(path string) error

func WriteExecutableFile

func WriteExecutableFile(path string, data []byte) error

func WriteFile

func WriteFile(path string, data []byte) error

Types

type NetworkInfo

type NetworkInfo struct {
	Family         string // ipv4 or ipv6
	BridgeIP       net.IP
	DHCPRangeStart net.IP
	DHCPRangeEnd   net.IP
	Net            *net.IPNet
}

func ParseNetworkCIDR

func ParseNetworkCIDR(cidr string) (*NetworkInfo, error)

type TabWriter

type TabWriter struct {
	// contains filtered or unexported fields
}

func NewTabWriter

func NewTabWriter(output io.Writer) *TabWriter

func (*TabWriter) Flush

func (w *TabWriter) Flush()

func (*TabWriter) Nl

func (w *TabWriter) Nl()

func (*TabWriter) Print

func (w *TabWriter) Print(str string)

func (*TabWriter) Tab

func (w *TabWriter) Tab()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL