Documentation
¶
Overview ¶
Copyright © 2022 ZeYanLin <zeyanlin@outlook.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func Execute()
- func OutputDefaultJSON(i any)
- func OutputDefaultNone(i any)
- func OutputDefaultString(i any)
- func OutputDefaultYAML(i any)
- func OutputInterfaceString(r OutputFormat)
- func ParseInterfaces(iface net.InterfaceStatList, counters []net.IOCountersStat) (map[string]int, map[int]string)
- func PrintJSON(i any)
- func PrintString(i any)
- func PrintTable(header []string, data [][]string, align int, padding string, format bool)
- func PrintYAML(i any)
- func ReadConfig(block string, flag any) error
- type Cert
- type DF
- type DigFlag
- type DigResponseFormat
- type DigResponseList
- type DiscordFlag
- type Encode
- func (*Encode) Base32HexDecode(s string) ([]byte, error)
- func (*Encode) Base32HexEncode(i any) (string, error)
- func (*Encode) Base32StdDecode(s string) ([]byte, error)
- func (*Encode) Base32StdEncode(i any) (string, error)
- func (*Encode) Base64StdDecode(s string) ([]byte, error)
- func (*Encode) Base64StdEncode(i any) (string, error)
- func (*Encode) Base64URLDecode(s string) ([]byte, error)
- func (*Encode) Base64URLEncode(i any) (string, error)
- func (*Encode) HexDecode(s string) ([]byte, error)
- func (*Encode) HexEncode(i any) (string, error)
- func (*Encode) JSONDecode(r io.Reader, i any) (any, error)
- func (*Encode) JSONEncode(i any) (string, error)
- func (*Encode) JSONMarshaler(src, dst any) error
- func (*Encode) PemDecode(b []byte) ([]byte, error)
- func (*Encode) PemEncode(i any, t ...string) (string, error)
- func (*Encode) XMLDecode(r io.Reader, i any) (any, error)
- func (*Encode) XMLEncode(i any) (string, error)
- func (*Encode) YamlDecode(r io.Reader, i any) (any, error)
- func (*Encode) YamlEncode(i any) (string, error)
- type Encrypt
- func (*Encrypt) CheckSecret(secret string) []byte
- func (e *Encrypt) DecryptFile(secret, filename, mode string) error
- func (e *Encrypt) DecryptString(secret, text, mode string) (string, error)
- func (e *Encrypt) EncryptFile(secret, filename, mode string) error
- func (e *Encrypt) EncryptString(secret, text, mode string) (string, error)
- func (e *Encrypt) GetKey(secret, filename string, perm os.FileMode) []byte
- type FileStat
- type Free
- type GeoIP
- type GeoIPs
- type Hash
- type ICP
- type LineFlag
- type Netmask
- type OTP
- func (o *OTP) GenSecret() (string, error)
- func (o *OTP) HOTP(secret string, timeInterval int64) (string, error)
- func (o *OTP) SetAlgorithm() func() hash.Hash
- func (o *OTP) SetDigits() [2]int
- func (o *OTP) SetTimeInterval() int64
- func (o *OTP) TOTP(secret string) (string, error)
- func (o *OTP) Verify(input, secret string) (bool, error)
- type OutputFormat
- type PingFlag
- type Random
- type RandomCharacter
- type Redis
- type Repository
- type SSHKeygen
- type SlackFlag
- type SystemFlag
- func (s *SystemFlag) CPUInfo() (any, error)
- func (s *SystemFlag) DiskUsage() (any, error)
- func (s *SystemFlag) HostInfo() (any, error)
- func (s *SystemFlag) LoadAvg() (any, error)
- func (s *SystemFlag) MemUsage() (any, error)
- func (s *SystemFlag) NetInfo() (any, error)
- func (s *SystemFlag) RunE(cmd *cobra.Command, _ []string) error
- type TCPing
- type TelegramFlag
- func (t TelegramFlag) Animation() error
- func (t *TelegramFlag) Audio() error
- func (t TelegramFlag) ChatDescription() error
- func (t TelegramFlag) ChatPhoto() error
- func (t TelegramFlag) ChatTitle() error
- func (t TelegramFlag) Dice() error
- func (t *TelegramFlag) File() error
- func (t *TelegramFlag) GetUpdate()
- func (t *TelegramFlag) Init() error
- func (t *TelegramFlag) Photo() error
- func (t *TelegramFlag) RunE(cmd *cobra.Command, _ []string) error
- func (t *TelegramFlag) Text() error
- func (t *TelegramFlag) Video() error
- func (t *TelegramFlag) Voice() error
- type Timespec
- type Traceroute
- type TreeFlag
- type TreeFormat
- type UpdateFlag
- type Updater
- type Version
- type VersionOutput
- type WhoisFlag
Constants ¶
View Source
const ( CommandArping = "arping" CommandAudio = "audio" CommandBase32 = "base32" CommandBase64 = "base64" CommandBase32Hex = CommandBase32 + CommandHex CommandBase32Std = CommandBase32 + "std" CommandBase64Std = CommandBase64 + "std" CommandBase64URL = CommandBase64 + "url" CommandBootstrap = "bootstrap-token" CommandCalculate = "calculate" CommandCert = "cert" CommandConvert = "convert" CommandCPU = "cpu" CommandCsv = "csv" CommandCsv2JSON = CommandCsv + "2" + CommandJSON CommandCsv2Toml = CommandCsv + "2" + CommandToml CommandCsv2XML = CommandCsv + "2" + CommandXML CommandCsv2Yaml = CommandCsv + "2" + CommandYaml CommandDate = "date" CommandDf = "df" CommandDig = "dig" CommandDiscord = "Discord" CommandDisk = "disk" CommandDoc = "doc" CommandDos2Unix = "dos2unix" CommandEncode = "encode" CommandEncrypt = "encrypt" CommandFile = "file" CommandFree = "free" CommandGenerate = "generate" CommandGeoip = "geoip" CommandHash = "hash" CommandHex = "hex" CommandHost = "host" CommandIcp = "icp" CommandID = "id" CommandIP = "ip" CommandJSON = "json" CommandJSON2Csv = CommandJSON + "2" + CommandCsv CommandJSON2Toml = CommandJSON + "2" + CommandToml CommandJSON2XML = CommandJSON + "2" + CommandXML CommandJSON2Yaml = CommandJSON + "2" + CommandYaml CommandLINE = "LINE" CommandLoad = "load" CommandLowercase = "lowercase" CommandMan = "man" CommandMarkdown = "markdown" CommandMemory = "memory" CommandNetmask = "netmask" CommandNetwork = "network" CommandNumber = "number" CommandOtp = "otp" CommandPhoto = "photo" CommandPing = "ping" CommandQrcode = "qrcode" CommandRandom = "random" CommandRead = "read" CommandRedis = "redis" CommandReST = "rest" CommandSlack = "Slack" CommandSSH = "ssh-keygen" CommandStat = "stat" CommandString = "string" CommandSymbol = "symbol" CommandSystem = "system" CommandTcping = "tcping" CommandTelegram = "Telegram" CommandText = "text" CommandToml = "toml" CommandToml2Csv = CommandToml + "2" + CommandCsv CommandToml2JSON = CommandToml + "2" + CommandJSON CommandToml2XML = CommandToml + "2" + CommandXML CommandToml2Yaml = CommandToml + "2" + CommandYaml CommandTraceroute = "traceroute" CommandTree = "tree" CommandUpdate = "update" CommandUppercase = "uppercase" CommandURL = "url" CommandVersion = "version" CommandVideo = "video" CommandVoice = "voice" CommandWhois = "whois" CommandWiFi = "wifi" CommandWsping = "wsping" CommandXML = "xml" CommandXML2Csv = CommandXML + "2" + CommandCsv CommandXML2JSON = CommandXML + "2" + CommandJSON CommandXML2Toml = CommandXML + "2" + CommandToml CommandXML2Yaml = CommandXML + "2" + CommandYaml CommandYaml = "yaml" CommandYaml2Csv = CommandYaml + "2" + CommandCsv CommandYaml2JSON = CommandYaml + "2" + CommandJSON CommandYaml2Toml = CommandYaml + "2" + CommandToml CommandYaml2XML = CommandYaml + "2" + CommandXML )
View Source
const ( EncryptModeCFB = "CFB" EncryptModeCTR = "CTR" EncryptModeGCM = "GCM" EncryptModeOFB = "OFB" )
View Source
const ( TypeBinary = "binary" TypeOctal = "octal" TypeDecimal = "decimal" TypeHex = "hex" TypeCisco = "cisco" )
Variables ¶
This section is empty.
Functions ¶
func OutputDefaultJSON ¶ added in v0.0.12
func OutputDefaultJSON(i any)
func OutputDefaultNone ¶ added in v0.1.0
func OutputDefaultNone(i any)
func OutputDefaultString ¶ added in v0.0.12
func OutputDefaultString(i any)
func OutputDefaultYAML ¶ added in v0.0.12
func OutputDefaultYAML(i any)
func OutputInterfaceString ¶ added in v0.1.3
func OutputInterfaceString(r OutputFormat)
func ParseInterfaces ¶ added in v0.3.0
func ParseInterfaces(iface net.InterfaceStatList, counters []net.IOCountersStat) (map[string]int, map[int]string)
func PrintString ¶ added in v0.1.0
func PrintString(i any)
func PrintTable ¶ added in v0.8.0
func ReadConfig ¶ added in v0.7.2
Types ¶
type Cert ¶ added in v0.11.5
type Cert struct {
ExpiryTime string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty"`
Days int `json:"days,omitempty" yaml:"days,omitempty"`
Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty"`
ServerIP string `json:"serverIp,omitempty" yaml:"serverIp,omitempty"`
DNS []string `json:"dns,omitempty" yaml:"dns,omitempty"`
}
type DF ¶ added in v0.11.5
type DF struct {
Filesystem string `json:"Filesystem"`
Size string `json:"Size"`
Used string `json:"Used"`
Avail string `json:"Avail"`
UsedPercent string `json:"Use%"`
MountedOn string `json:"Mounted on"`
Fstype string `json:"FsType"`
// Opts []string `json:"Opts"`
// InodesSize uint64 `json:"iSize"`
InodesUsed string `json:"iUsed"`
InodesFree string `json:"iFree"`
InodesUsedPercent string `json:"iUse%"`
}
func (DF) OutputData ¶ added in v0.11.5
func (*DF) ParseDevices ¶ added in v0.11.5
func (d *DF) ParseDevices(usage *disk.UsageStat, partition []disk.PartitionStat)
type DigFlag ¶ added in v0.3.3
type DigFlag struct {
// contains filtered or unexported fields
}
func (*DigFlag) GetLocalServer ¶ added in v0.3.3
type DigResponseFormat ¶ added in v0.5.0
type DigResponseList ¶ added in v0.5.0
type DigResponseList []DigResponseFormat
func (DigResponseList) String ¶ added in v0.5.0
func (d DigResponseList) String()
type DiscordFlag ¶ added in v0.1.3
type DiscordFlag struct {
Token string `json:"token"`
Channel string `json:"channel_id"`
// contains filtered or unexported fields
}
func (*DiscordFlag) File ¶ added in v0.1.3
func (d *DiscordFlag) File() error
func (*DiscordFlag) Init ¶ added in v0.1.3
func (d *DiscordFlag) Init() error
func (*DiscordFlag) RunE ¶ added in v0.2.1
func (d *DiscordFlag) RunE(cmd *cobra.Command, args []string) error
func (*DiscordFlag) Text ¶ added in v0.1.3
func (d *DiscordFlag) Text() error
func (*DiscordFlag) TextTTS ¶ added in v0.1.3
func (d *DiscordFlag) TextTTS() error
type Encode ¶ added in v0.11.5
type Encode struct{}
var Encoder Encode
func (*Encode) Base32HexDecode ¶ added in v0.11.5
func (*Encode) Base32HexEncode ¶ added in v0.11.5
func (*Encode) Base32StdDecode ¶ added in v0.11.5
func (*Encode) Base32StdEncode ¶ added in v0.11.5
func (*Encode) Base64StdDecode ¶ added in v0.11.5
func (*Encode) Base64StdEncode ¶ added in v0.11.5
func (*Encode) Base64URLDecode ¶ added in v0.11.5
func (*Encode) Base64URLEncode ¶ added in v0.11.5
func (*Encode) JSONDecode ¶ added in v0.11.5
func (*Encode) JSONMarshaler ¶ added in v0.11.5
func (*Encode) YamlDecode ¶ added in v0.11.5
type Encrypt ¶ added in v0.11.5
type Encrypt struct{}
var Encryptor Encrypt
func (*Encrypt) CheckSecret ¶ added in v0.11.5
func (*Encrypt) DecryptFile ¶ added in v0.11.5
func (*Encrypt) DecryptString ¶ added in v0.11.5
func (*Encrypt) EncryptFile ¶ added in v0.11.5
func (*Encrypt) EncryptString ¶ added in v0.11.5
type FileStat ¶ added in v0.4.0
type FileStat struct {
Dev int32 `json:"Dev"`
Mode uint16 `json:"Mode"`
Nlink uint16 `json:"Nlink"`
Ino uint64 `json:"Ino"`
UID uint32 `json:"Uid"`
GID uint32 `json:"Gid"`
Rdev int32 `json:"Rdev"`
PadCgo0 [4]byte `json:"Pad_cgo_0"`
Atimespec Timespec `json:"Atimespec"`
Mtimespec Timespec `json:"Mtimespec"`
Ctimespec Timespec `json:"Ctimespec"`
Birthtimespec Timespec `json:"Birthtimespec"`
Size int64 `json:"Size"`
Blocks int64 `json:"Blocks"`
Blksize int32 `json:"Blksize"`
Flags uint32 `json:"Flags"`
Gen uint32 `json:"Gen"`
Lspare int32 `json:"Lspare"`
Qspare [2]int64 `json:"Qspare"`
}
type GeoIP ¶ added in v0.11.5
type GeoIP struct {
Continent string `json:"continent"`
Country string `json:"country"`
CountryCode string `json:"countryCode"`
RegionName string `json:"regionName"`
City string `json:"city"`
District string `json:"district"`
Timezone string `json:"timezone"`
Currency string `json:"currency"`
ISP string `json:"isp"`
Org string `json:"org"`
As string `json:"as"`
Asname string `json:"asname"`
Mobile bool `json:"mobile"`
Proxy bool `json:"proxy"`
Hosting bool `json:"hosting"`
Query string `json:"query"`
}
type ICP ¶ added in v0.11.5
type LineFlag ¶ added in v0.1.3
type OTP ¶ added in v0.11.5
func (*OTP) SetAlgorithm ¶ added in v0.11.5
func (*OTP) SetTimeInterval ¶ added in v0.11.5
type OutputFormat ¶ added in v0.1.6
type OutputFormat interface {
String()
}
type PingFlag ¶ added in v0.8.0
type PingFlag struct {
// contains filtered or unexported fields
}
type Random ¶ added in v0.11.5
type Random []byte
var Randoms Random
func (Random) GenerateAll ¶ added in v0.11.5
func (Random) GenerateString ¶ added in v0.11.5
func (Random) GenerateString(length int, charSet RandomCharacter) Random
type RandomCharacter ¶ added in v0.1.2
type RandomCharacter string
const ( LowercaseLetters RandomCharacter = "abcdefghijklmnopqrstuvwxyz" UppercaseLetters RandomCharacter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Symbols RandomCharacter = "~!@#$%^&*()_+`-={}|[]\\:\"<>?,./" Numbers RandomCharacter = "0123456789" AllSet RandomCharacter = LowercaseLetters + UppercaseLetters + Symbols + Numbers )
type Repository ¶ added in v0.2.0
type Repository struct {
GithubUsername string
Repository string
DownloadLink string
DownloadPath string
ExtractPath string
ReleaseTag string
ExtractFunc func() error
}
func NewRepository ¶ added in v0.2.0
func NewRepository(username, repo string) *Repository
func (*Repository) UnGzip ¶ added in v0.2.0
func (r *Repository) UnGzip() error
Extract gzip and untar.
type SSHKeygen ¶ added in v0.11.5
type SSHKeygen struct{}
type SlackFlag ¶ added in v0.1.3
type SlackFlag struct {
Token string `json:"token"`
Channel string `json:"channel_id"`
// contains filtered or unexported fields
}
type SystemFlag ¶ added in v0.1.3
type SystemFlag struct{}
func (*SystemFlag) CPUInfo ¶ added in v0.1.3
func (s *SystemFlag) CPUInfo() (any, error)
func (*SystemFlag) DiskUsage ¶ added in v0.1.3
func (s *SystemFlag) DiskUsage() (any, error)
func (*SystemFlag) HostInfo ¶ added in v0.1.3
func (s *SystemFlag) HostInfo() (any, error)
func (*SystemFlag) LoadAvg ¶ added in v0.1.3
func (s *SystemFlag) LoadAvg() (any, error)
func (*SystemFlag) MemUsage ¶ added in v0.1.3
func (s *SystemFlag) MemUsage() (any, error)
func (*SystemFlag) NetInfo ¶ added in v0.1.3
func (s *SystemFlag) NetInfo() (any, error)
type TelegramFlag ¶ added in v0.1.3
type TelegramFlag struct {
/* Bind flags */
Token string `json:"token"`
ChatID string `json:"chat_id"`
Chat int64
// contains filtered or unexported fields
}
func (TelegramFlag) Animation ¶ added in v0.1.3
func (t TelegramFlag) Animation() error
func (*TelegramFlag) Audio ¶ added in v0.1.3
func (t *TelegramFlag) Audio() error
func (TelegramFlag) ChatDescription ¶ added in v0.1.3
func (t TelegramFlag) ChatDescription() error
func (TelegramFlag) ChatPhoto ¶ added in v0.1.3
func (t TelegramFlag) ChatPhoto() error
func (TelegramFlag) ChatTitle ¶ added in v0.1.3
func (t TelegramFlag) ChatTitle() error
func (TelegramFlag) Dice ¶ added in v0.1.3
func (t TelegramFlag) Dice() error
func (*TelegramFlag) File ¶ added in v0.1.3
func (t *TelegramFlag) File() error
func (*TelegramFlag) GetUpdate ¶ added in v0.1.3
func (t *TelegramFlag) GetUpdate()
func (*TelegramFlag) Init ¶ added in v0.1.3
func (t *TelegramFlag) Init() error
func (*TelegramFlag) Photo ¶ added in v0.1.3
func (t *TelegramFlag) Photo() error
func (*TelegramFlag) RunE ¶ added in v0.2.1
func (t *TelegramFlag) RunE(cmd *cobra.Command, _ []string) error
func (*TelegramFlag) Text ¶ added in v0.1.3
func (t *TelegramFlag) Text() error
func (*TelegramFlag) Video ¶ added in v0.1.3
func (t *TelegramFlag) Video() error
func (*TelegramFlag) Voice ¶ added in v0.1.3
func (t *TelegramFlag) Voice() error
type Traceroute ¶ added in v0.11.5
func (*Traceroute) Connect ¶ added in v0.11.5
func (t *Traceroute) Connect(conn *icmp.PacketConn, addr *net.IPAddr, data icmp.Message) error
type TreeFlag ¶ added in v0.8.8
type TreeFlag struct {
// contains filtered or unexported fields
}
func (*TreeFlag) Print ¶ added in v0.9.4
func (t *TreeFlag) Print(prefix string, output TreeFormat)
type TreeFormat ¶ added in v0.9.4
type TreeFormat struct {
Type string `json:"type"`
Path string `json:"path"`
Name string `json:"name"`
Perm string `json:"perm"`
Mode string `json:"mode"`
Size string `json:"size"`
ModTime string `json:"modTime"`
UID string `json:"uid"`
GID string `json:"gid"`
Inode string `json:"inode"`
Devide string `json:"device"`
Contents *[]TreeFormat `json:"contents"`
// contains filtered or unexported fields
}
type UpdateFlag ¶ added in v0.5.0
type UpdateFlag struct{}
type Updater ¶ added in v0.2.0
type Updater struct {
Upgrade bool
ExecutablePath string
Repository *Repository
}
func NewUpdater ¶ added in v0.2.0
func (Updater) CurrentVersion ¶ added in v0.2.0
Get current version and return struct.
type Version ¶ added in v0.2.0
type VersionOutput ¶ added in v0.1.3
type VersionOutput struct {
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Commit string `json:"commit,omitempty" yaml:"commit,omitempty"`
Date string `json:"date,omitempty" yaml:"date,omitempty"`
Runtime string `json:"runtime,omitempty" yaml:"runtime,omitempty"`
}
func (VersionOutput) String ¶ added in v0.1.3
func (r VersionOutput) String()
type WhoisFlag ¶ added in v0.1.3
type WhoisFlag struct {
Registrar string `json:"registrar" yaml:"registrar"`
CreatedDate string `json:"createdDate" yaml:"createdDate"`
ExpiresDate string `json:"expiresDate" yaml:"expiresDate"`
UpdatedDate string `json:"updatedDate" yaml:"updatedDate"`
RemainDays int `json:"remainDays" yaml:"remainDays"`
NameServers []string `json:"nameServers" yaml:"nameServers"`
// contains filtered or unexported fields
}
func (*WhoisFlag) CalculateDays ¶ added in v0.1.3
Convert time to days.
Source Files
¶
- arping.go
- cert.go
- constant.go
- convert.go
- date.go
- df.go
- dig.go
- discord.go
- doc.go
- dos2unix.go
- encode.go
- encrypt.go
- free.go
- geoip.go
- hash.go
- icp.go
- ip.go
- line.go
- netmask.go
- otp.go
- ping.go
- qrcode.go
- random.go
- redis.go
- root.go
- slack.go
- ssh.go
- stat.go
- system.go
- tcping.go
- telegram.go
- traceroute.go
- tree.go
- update.go
- url.go
- version.go
- whois.go
- wsping.go
Click to show internal directories.
Click to hide internal directories.