Documentation ¶
Index ¶
- func BytesToStringUnsafe(b []byte) string
- func CheckNumRange[K constraints.Integer | constraints.Float](v, min, max K) bool
- func ClosedChan(c chan struct{}) bool
- func GenerateCertificate(dnsName string) (cert tls.Certificate, err error)
- func GetAddrFromAddr(addr net.Addr) netip.Addr
- func GetIPFromAddr(addr net.Addr) (ip net.IP)
- func LoadCertPool(certs []string) (*x509.CertPool, error)
- func ParseNameOrNum[T constraints.Integer](s string, m map[string]T) (T, bool)
- func RemoveComment(s, symbol string) string
- func SetDefaultNum[K constraints.Integer | constraints.Float](p *K, d K)
- func SetDefaultString(p *string, d string)
- func SetDefaultUnsignNum[K constraints.Integer | constraints.Float](p *K, d K)
- func SplitLineReg(s string) []string
- func SplitSchemeAndHost(addr string) (protocol, host string)
- func SplitString2(s, symbol string) (s1 string, s2 string, ok bool)
- func WeakDecode(in any, output any) error
- type Errors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToStringUnsafe ¶
BytesToStringUnsafe converts bytes to string.
func CheckNumRange ¶
func CheckNumRange[K constraints.Integer | constraints.Float](v, min, max K) bool
func ClosedChan ¶
func ClosedChan(c chan struct{}) bool
ClosedChan returns true if c is closed. c must not use for sending data and must be used in close() only. If ClosedChan receives something from c, it panics.
func GenerateCertificate ¶
func GenerateCertificate(dnsName string) (cert tls.Certificate, err error)
GenerateCertificate generates an ecdsa certificate with given dnsName. This should only use in test.
func GetAddrFromAddr ¶
GetAddrFromAddr returns netip.Addr from net.Addr. See also: GetIPFromAddr.
func GetIPFromAddr ¶
GetIPFromAddr returns a net.IP from the given net.Addr. addr can be *net.TCPAddr, *net.UDPAddr, *net.IPNet, *net.IPAddr Will return nil otherwise.
func LoadCertPool ¶
LoadCertPool reads and loads certificates in certs.
func ParseNameOrNum ¶
func ParseNameOrNum[T constraints.Integer](s string, m map[string]T) (T, bool)
func RemoveComment ¶
RemoveComment removes comment after "symbol".
func SetDefaultNum ¶
func SetDefaultNum[K constraints.Integer | constraints.Float](p *K, d K)
func SetDefaultString ¶
func SetDefaultUnsignNum ¶
func SetDefaultUnsignNum[K constraints.Integer | constraints.Float](p *K, d K)
func SplitLineReg ¶
SplitLineReg extracts words from s by using regexp "\S+".
func SplitSchemeAndHost ¶
SplitSchemeAndHost splits addr to protocol and host.
func SplitString2 ¶
SplitString2 split s to two parts by given symbol
func WeakDecode ¶
WeakDecode decodes args from config to output.