Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(a int) int
- func BoolToInt(a bool) int
- func BoolToString(a bool) string
- func Bytes2Sha1(b []byte, salt []byte) []byte
- func BytesCopy(b []byte) []byte
- func Deduplicate(list []string) []string
- func Expired(expireAt time.Time) bool
- func FillEmpty(toFill interface{}, defaultVal interface{}) error
- func HomeExpand(path string) (string, error)
- func HostToSNI(host string, rootDomain string) (sni string, err error)
- func IsCanceled(err error) bool
- func Max(a, b int) int
- func Min(a, b int) int
- func Response(ctx *gin.Context, code Code, data interface{}) (status int, body gin.H)
- func ResponseBadRequestError(ctx *gin.Context)
- func ResponseError(ctx *gin.Context, err error)
- func ResponseSuccess(ctx *gin.Context, data interface{})
- func SetValue(values *url.Values, key string, value string)
- func SimplyGetParam(source string, key string) (value string)
- func SliceHas(slice []string, set []string) []string
- func SliceSub(slice []string, toSub []string) []string
- func SliceToSet(slice []string) map[string]struct{}
- func StringToUUID5(str string) string
- func StringsHas(strs []string, str string) bool
- func TrimLineContains(parent, sub string) string
- func UrlEncoded(str string) string
- type Code
- type Resp
Constants ¶
View Source
const ( SUCCESS = "SUCCESS" FAIL = "FAIL" )
View Source
const Alphabet = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789"
View Source
const Alphabet95 = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789`~!@#$%^&*()_-+=[]\\;',./{}|:\"<>? "
Variables ¶
View Source
var ( NotSameTypeErr = fmt.Errorf("cannot fill empty: the two value have different type") NeedPassInPointer = fmt.Errorf("the structure passed in should be a pointer") )
View Source
var BadRequestErr = fmt.Errorf("bad request")
View Source
var Base62Encoder, _ = basex.NewEncoding(Alphabet)
View Source
var Base95Encoder, _ = basex.NewEncoding(Alphabet95)
Functions ¶
func BoolToString ¶
func Bytes2Sha1 ¶
func Deduplicate ¶
func FillEmpty ¶
func FillEmpty(toFill interface{}, defaultVal interface{}) error
FillEmpty fill the empty field of the struct with default value given
func HomeExpand ¶
func IsCanceled ¶
func ResponseBadRequestError ¶
func ResponseError ¶
func ResponseSuccess ¶
func SimplyGetParam ¶
func SliceToSet ¶
func StringToUUID5 ¶
StringToUUID5 is from https://github.com/XTLS/Xray-core/issues/158
func StringsHas ¶
func TrimLineContains ¶
func UrlEncoded ¶
UrlEncoded encodes a string like Javascript's encodeURIComponent()
Types ¶
Click to show internal directories.
Click to hide internal directories.