mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-10-23 16:53:14 +08:00
更新文档,代码;
非 *nix 平台不再使用 bubble包, 减小大小
This commit is contained in:
28
utils/strings_unix.go
Normal file
28
utils/strings_unix.go
Normal file
@@ -0,0 +1,28 @@
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/tjarratt/babble"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func GetRandomWord() (result string) {
|
||||
//babbler包 在 系统中 没有 /usr/share/dict/words 且不是windows 时,会panic
|
||||
defer func() {
|
||||
|
||||
if r := recover(); r != nil {
|
||||
if ce := CanLogErr("getRandomWord babble panic"); ce != nil {
|
||||
ce.Write(zap.Any("err:", r))
|
||||
}
|
||||
|
||||
result = GenerateRandomString()
|
||||
}
|
||||
}()
|
||||
babbler := babble.NewBabbler()
|
||||
babbler.Count = 1
|
||||
result = babbler.Babble()
|
||||
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user