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
- Variables
- func HashAlgorithm(alg string) hash.Hash
- func NewRepository(username, repo string) *repository
- 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 Dig
- type DigList
- type Discord
- 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 GeoIPList
- type Hash
- type ICMPStat
- type ICP
- type LINE
- type MTR
- 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 Ping
- type Random
- type RandomCharacter
- type Redis
- type SSHKeygen
- type Slack
- type System
- type TCPing
- type Telegram
- func (t Telegram) Animation(chat int64, arg, caption string) error
- func (t *Telegram) Audio(chat int64, arg, caption string) error
- func (t Telegram) ChatDescription(chat int64, arg string) error
- func (t Telegram) ChatPhoto(chat int64, arg string) error
- func (t Telegram) ChatTitle(chat int64, arg string) error
- func (t Telegram) Dice(chat int64) error
- func (t *Telegram) File(chat int64, arg, caption string) error
- func (t *Telegram) GetUpdate()
- func (t *Telegram) Init(token string) error
- func (t *Telegram) Photo(chat int64, arg, caption string) error
- func (t *Telegram) Text(chat int64, arg string) error
- func (t *Telegram) Video(chat int64, arg, caption string) error
- func (t *Telegram) Voice(chat int64, arg, caption string) error
- type Timespec
- type Traceroute
- type Tree
- type TreeOptions
- type Updater
- type Version
- type Whois
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" CommandMtr = "mtr" CommandNetmask = "netmask" CommandNetwork = "network" CommandNumber = "number" CommandOtp = "otp" CommandPhoto = "photo" CommandPing = "ping" CommandQrcode = "qrcode" CommandRandom = "random" CommandRead = "read" CommandReadlink = "readlink" 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 ( FileModeROwner fs.FileMode = 0600 FileModeRAll fs.FileMode = 0644 )
View Source
const ( HashMd5 = "md5" HashSha1 = "sha1" HashSha224 = "sha224" HashSha256 = "sha256" HashSha384 = "sha384" HashSha512 = "sha512" HashSha512_224 = "sha512_224" HashSha512_256 = "sha512_256" )
View Source
const ( TypeBinary = "binary" TypeOctal = "octal" TypeDecimal = "decimal" TypeHex = "hex" TypeCisco = "cisco" )
View Source
const (
IndentTwoSpaces = " "
)
Variables ¶
View Source
var RootCmd = root()
Functions ¶
func HashAlgorithm ¶ added in v0.1.4
func NewRepository ¶ added in v0.2.0
func NewRepository(username, repo string) *repository
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 DigList ¶ added in v0.11.6
type DigList []Dig
func (*DigList) GetLocalServer ¶ added in v0.11.6
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 LINE ¶ added in v0.11.6
type LINE struct {
API *linebot.Client
Response *linebot.BasicResponse
}
type MTR ¶ added in v0.12.0
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 Ping ¶ added in v0.11.6
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 SSHKeygen ¶ added in v0.11.5
type SSHKeygen struct{}
type Telegram ¶ added in v0.11.6
func (Telegram) ChatDescription ¶ added in v0.11.6
type Traceroute ¶ added in v0.11.5
type Traceroute struct {
Size, TTL, Retry int
Interval, Timeout time.Duration
Connetion *icmp.PacketConn
Data icmp.Message
Host string
Target *net.IPAddr
Count int
Record bool
Stat []ICMPStat
// contains filtered or unexported fields
}
func (*Traceroute) Connect ¶ added in v0.11.5
func (t *Traceroute) Connect(ctx context.Context, reply []byte) error
func (*Traceroute) Listen ¶ added in v0.11.7
func (*Traceroute) Listen() (*icmp.PacketConn, error)
type Tree ¶ added in v0.11.6
type Tree struct {
Type string `json:"type"`
Path string `json:"path"`
Name string `json:"name"`
Perm string `json:"perm"`
Mode string `json:"mode"`
Links uint16 `json:"links"`
UID string `json:"uid"`
GID string `json:"gid"`
Size string `json:"size"`
ModTime string `json:"modTime"`
Inode string `json:"inode"`
Devide string `json:"device"`
Contents *[]Tree `json:"contents"`
// contains filtered or unexported fields
}
func (*Tree) Walk ¶ added in v0.11.6
func (t *Tree) Walk(args []string, opt *TreeOptions)
type TreeOptions ¶ added in v0.11.6
type Updater ¶ added in v0.2.0
func NewUpdater ¶ added in v0.2.0
type Version ¶ added in v0.2.0
type Whois ¶ added in v0.11.6
type Whois 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"`
}
func (*Whois) CalculateDays ¶ added in v0.11.6
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
- mtr.go
- netmask.go
- otp.go
- ping.go
- qrcode.go
- random.go
- readlink.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.