Documentation ¶
Index ¶
- Constants
- func Blue(str string) string
- func Bytefmt(bytes uint64) string
- func CheckCommandExists(command string) bool
- func CheckIP(ip string) bool
- func Contains(a []string, x string) bool
- func ContainsObject(a []struct{ ... }, x struct{ ... }) bool
- func Cyan(str string) string
- func EnsureFileExists(path string)
- func ExecCommand(command string) error
- func ExecCommandWithResult(command string) string
- func Find(a []string, x string) int
- func Fuchsia(str string) string
- func GenPass(password string) (string, string)
- func GetLocalIP() string
- func Green(str string) string
- func Input(tip string, defaultValue string) string
- func InstallPack(name string)
- func IsExists(path string) bool
- func IsInteger(input string) bool
- func LoopInput(tip string, choices interface{}, singleRowPrint bool) int
- func OpenPort(port int)
- func PortIsUse(port int) bool
- func RandString(length int) string
- func RandomPort() int
- func Red(str string) string
- func RunWebShell(webShellPath string)
- func White(str string) string
- func Yellow(str string) string
- type Any
- type WsConnection
- type WsMessage
Constants ¶
View Source
const ( // BYTE 字节 BYTE = 1 << (10 * iota) // KILOBYTE 千字节 KILOBYTE // MEGABYTE 兆字节 MEGABYTE // GIGABYTE 吉字节 GIGABYTE // TERABYTE 太字节 TERABYTE // PETABYTE 拍字节 PETABYTE // EXABYTE 艾字节 EXABYTE )
View Source
const ( // RED 红色 RED = "\033[31m" // GREEN 绿色 GREEN = "\033[32m" // YELLOW 黄色 YELLOW = "\033[33m" // BLUE 蓝色 BLUE = "\033[34m" // FUCHSIA 紫红色 FUCHSIA = "\033[35m" // CYAN 青色 CYAN = "\033[36m" // WHITE 白色 WHITE = "\033[37m" // RESET 重置颜色 RESET = "\033[0m" )
Variables ¶
This section is empty.
Functions ¶
func Bytefmt ¶
Bytefmt returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:
E: Exabyte P: Petabyte T: Terabyte G: Gigabyte M: Megabyte K: Kilobyte B: Byte
The unit that results in the smallest number greater than or equal to 1 is always chosen.
func ContainsObject ¶
ContainsObject 查找一个元素
func ExecCommandWithResult ¶
ExecCommandWithResult 运行命令并获取结果
func Find ¶
Find returns the smallest index i at which x == a[i], or len(a) if there is no such index.
func GenPass ¶
GenPass 自动生成加密密码和显示密码 sha256.Sum224 => heximal => encryptPass base64.StdEncoding.EncodeToString => base64Pass
Types ¶
type WsConnection ¶
type WsConnection struct { CloseChan chan byte // 关闭通知 // contains filtered or unexported fields }
WsConnection 封装websocket连接
func InitWebsocket ¶
func InitWebsocket(resp http.ResponseWriter, req *http.Request) (wsConn *WsConnection, err error)
InitWebsocket 初始化ws
func (*WsConnection) WsRead ¶
func (wsConn *WsConnection) WsRead() (msg *WsMessage, err error)
WsRead 读取消息
Click to show internal directories.
Click to hide internal directories.