Documentation
¶
Index ¶
- Variables
- func CheckBySalt(checked, hash, salt string) bool
- func GetLocalIpv4ByUdp() (ip string, err error)
- func GetLocalIpv4List() ([]string, error)
- func GetMacMap() map[string]string
- func GetPublicIp_ipsb() (ip string, err error)
- func HashBySalt(ps, salt string) string
- func IfEx[T any](boolExpr bool, trueReturn, falseReturn T) T
- func ItemIsInSlice[T comparable](item T, slice []T) bool
- func JsonMarshal(v any) ([]byte, error)
- func JsonMarshalToString(v any) (string, error)
- func JsonUnmarshal(data []byte, v any) error
- func JsonUnmarshalFromString(str string, v any) error
- func MapClear[M ~map[K]V, K comparable, V any](m M)
- func MapClone[M ~map[K]V, K comparable, V any](m M) M
- func MapCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)
- func MapDeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)
- func MapEqual[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool
- func MapEqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool
- func MapKeys[M ~map[K]V, K comparable, V any](m M) []K
- func MapToObj(m map[string]any, obj any) error
- func MapValues[M ~map[K]V, K comparable, V any](m M) []V
- func ObjToMap(obj any, m *map[string]any) error
- func PanicIfErr(err error)
- func PanicToErr(fn func()) (err error)
- func RandBytesMask(n int) []byte
- func RandStringMask(n int) string
- func SliceIsInSlice[T comparable](item []T, slice []T) bool
- func TlsCertGenerateToFile(path string) error
- func TlsCertGenerateToMap() (cert map[string]string, err error)
- type Quit
- type Rate
Constants ¶
This section is empty.
Variables ¶
var ( CertName = "cert.pem" KeyName = "key.pem" )
Functions ¶
func GetLocalIpv4ByUdp ¶
GetLocalIpv4ByUdp 获取 localIp by net.Dial("udp", "8.8.8.8:53")
func GetPublicIp_ipsb ¶
GetPublicIp_ipsb curl ip.sb 的响应值 被GWF服务器不可用
func ItemIsInSlice ¶ added in v1.0.9
func ItemIsInSlice[T comparable](item T, slice []T) bool
func JsonMarshal ¶
func JsonMarshalToString ¶
func JsonUnmarshal ¶
func JsonUnmarshalFromString ¶
func MapClear ¶
func MapClear[M ~map[K]V, K comparable, V any](m M)
MapClear removes all entries from m, leaving it empty.
func MapClone ¶
func MapClone[M ~map[K]V, K comparable, V any](m M) M
MapClone returns a copy of m. This is a shallow clone: the new keys and values are set using ordinary assignment.
func MapCopy ¶
func MapCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)
MapCopy copies all key/value pairs in src adding them to dst. When a key in src is already present in dst, the value in dst will be overwritten by the value associated with the key in src.
func MapDeleteFunc ¶
func MapDeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)
MapDeleteFunc deletes any key/value pairs from m for which del returns true.
func MapEqual ¶
func MapEqual[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool
MapEqual reports whether two maps contain the same key/value pairs. MapValues are compared using ==.
func MapEqualFunc ¶
func MapEqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool
MapEqualFunc is like MapEqual, but compares values using eq. MapKeys are still compared with ==.
func MapKeys ¶
func MapKeys[M ~map[K]V, K comparable, V any](m M) []K
MapKeys returns the keys of the map m. The keys will be in an indeterminate order.
func MapValues ¶
func MapValues[M ~map[K]V, K comparable, V any](m M) []V
MapValues returns the values of the map m. The values will be in an indeterminate order.
func PanicIfErr ¶
func PanicIfErr(err error)
func PanicToErr ¶
func PanicToErr(fn func()) (err error)
func RandBytesMask ¶
func RandStringMask ¶
func SliceIsInSlice ¶ added in v1.0.9
func SliceIsInSlice[T comparable](item []T, slice []T) bool
func TlsCertGenerateToFile ¶
TlsCertGenerateToFile 生成自签tls证书 cert.pem key.pem 到指定文件夹中
func TlsCertGenerateToMap ¶
TlsCertGenerateToMap 生成自签tls证书 cert.pem key.pem 到map
Types ¶
type Quit ¶
type Quit struct {
// contains filtered or unexported fields
}
func (*Quit) WaitCloseWithFn ¶
func (q *Quit) WaitCloseWithFn(fn func())