util

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootDeviceToPXEFromIpmitool

func BootDeviceToPXEFromIpmitool(repo model.Repo, logger logger.Logger, ip string, username string, password string) error

func CreateNewMacAddress

func CreateNewMacAddress() string

func CreatePxeFile

func CreatePxeFile(dir string, file string, content string) error

func CutArray

func CutArray(arr []string, length int) ([]string, []string, error)

func EncodePassword

func EncodePassword(password string) (string, error)

func ExecScript

func ExecScript(script string) ([]byte, error)

execScript 执行脚本

func FileExist

func FileExist(filename string) bool

func FotmatNumberToGB

func FotmatNumberToGB(number float64, unit string) int

func FotmatNumberToMB

func FotmatNumberToMB(number float64, unit string) int

func GetCidrHostNum

func GetCidrHostNum(maskLen int) uint

计算得到CIDR地址范围内可拥有的主机数量

func GetCidrInfo

func GetCidrInfo(network string, logger logger.Logger) (map[string]string, error)

func GetCidrIpMask

func GetCidrIpMask(maskLen int) string

获取Cidr的掩码

func GetCidrIpRange

func GetCidrIpRange(cidr string) (string, string)

func GetDevicePowerStatusFromIpmitool

func GetDevicePowerStatusFromIpmitool(repo model.Repo, logger logger.Logger, ip string, username string, password string) (string, error)

func GetDeviceSnFromIpmitool

func GetDeviceSnFromIpmitool(repo model.Repo, logger logger.Logger, ip string, username string, password string) (string, error)

func GetIPListByMinAndMaxIP

func GetIPListByMinAndMaxIP(min string, max string) ([]string, error)

func GetIpSeg3Range

func GetIpSeg3Range(ipSegs []string, maskLen int) (int, int)

得到第三段IP的区间(第一片段.第二片段.第三片段.第四片段)

func GetIpSeg4Range

func GetIpSeg4Range(ipSegs []string, maskLen int) (int, int)

得到第四段IP的区间(第一片段.第二片段.第三片段.第四片段)

func GetIpSegRange

func GetIpSegRange(userSegIp, offset uint8) (int, int)

根据用户输入的基础IP地址和CIDR掩码计算一个IP片段的区间

func GetPxeFileNameByMac

func GetPxeFileNameByMac(mac string) string

func IconvFile

func IconvFile(filename string, fromCode string, toCode string, ctx context.Context) error

func IsInArray

func IsInArray(str string, arr []string) bool

func PowerOffDeviceFromIpmitool

func PowerOffDeviceFromIpmitool(repo model.Repo, logger logger.Logger, ip string, username string, password string) error

func PowerOnDeviceFromIpmitool

func PowerOnDeviceFromIpmitool(repo model.Repo, logger logger.Logger, ip string, username string, password string) error

func RSADecrypt

func RSADecrypt(privateKeyFile string, str string) (string, error)

func RSAEncrypt

func RSAEncrypt(publicKeyFile string, str string) (string, error)

func ReadBytes

func ReadBytes(path string) ([]byte, error)

func ReadFile

func ReadFile(path string) (string, error)

func RestartDeviceFromIpmitool

func RestartDeviceFromIpmitool(repo model.Repo, logger logger.Logger, ip string, username string, password string) error

func SubString

func SubString(str string, begin int, length int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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