common

package
v1.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: AGPL-3.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const Alphabet = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789"
View Source
const Alphabet64Grpc = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789_."

Variables

View Source
var Base62Encoder, _ = basex.NewEncoding(Alphabet)
View Source
var Base64GrpcEncoder, _ = basex.NewEncoding(Alphabet64Grpc)

Functions

func Abs64 added in v1.1.0

func Abs64(a int64) int64

func BytesIncBigEndian

func BytesIncBigEndian(b []byte)

func BytesIncLittleEndian

func BytesIncLittleEndian(b []byte)

func Change

func Change(from interface{}, to interface{}, keyFunc func(elem interface{}) string) (toRemove interface{}, toAdd interface{})

Change returns how to change "from" slice to "to" slice by removing and adding elements. Elements from "from" and "to" should be unique.

func Deduplicate added in v0.1.8

func Deduplicate(list []string) []string

func GenServiceName added in v1.2.3

func GenServiceName(b []byte) string

func GenerateCertChainHash added in v1.4.0

func GenerateCertChainHash(rawCerts [][]byte) (chainHash []byte)

func GenerateCertChainHashFromBytes added in v1.4.0

func GenerateCertChainHashFromBytes(b []byte) (string, error)

func HasTopDomain

func HasTopDomain(domain string) bool

func HomeExpand

func HomeExpand(path string) (string, error)

func HostToSNI added in v1.2.1

func HostToSNI(host string, rootDomain string) (sni string, err error)

func HostsToSNI added in v1.2.0

func HostsToSNI(hosts string, rootDomain string) (sni string, err error)

func IsPrivate added in v1.0.0

func IsPrivate(ip net.IP) bool

func IsPrivateHostname added in v1.0.0

func IsPrivateHostname(hostname string) (bool, error)

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func MustMapKeys

func MustMapKeys(m interface{}) (keys []string)

func RangeHash added in v1.2.3

func RangeHash(in []byte, minlength int, maxlength int) (out []byte)

func RemoveEmpty added in v1.2.7

func RemoveEmpty(list []string) []string

func SeedSecurely

func SeedSecurely() (err error)

func ShouldParseInt64 added in v0.1.15

func ShouldParseInt64(a string) int64

func ShouldParseUint8 added in v0.1.15

func ShouldParseUint8(a string) uint8

func SimplyGetParam added in v1.2.3

func SimplyGetParam(source string, key string) (value string)

func StarMatch

func StarMatch(expr string, str string) bool

func StringToUUID5 added in v1.1.11

func StringToUUID5(str string) string

StringToUUID5 is from https://github.com/XTLS/Xray-core/issues/158

func StringsHas added in v1.2.0

func StringsHas(strs []string, str string) bool

func ToIPNets

func ToIPNets(cidr []string) (nets []*net.IPNet, err error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL