server

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GBReg = regexp.MustCompile(`(?i)([\d.]+)GB$`)

Functions

func CalcSha265Hash

func CalcSha265Hash(input string, secret string) string

CalcSha265Hash calc hash with sha256

func GenerateVerificationCode added in v0.1.3

func GenerateVerificationCode(length int) string

GenerateVerificationCode generate random verification code

func GetRequestIP added in v0.4.0

func GetRequestIP(r *http.Request) string

GetRequestIP get request ip

func RecordLinkAccessLog added in v0.4.0

func RecordLinkAccessLog(ctx context.Context, originalLinkHash, ip string) ([]string, error)

RecordLinkAccessLog record link access log

func Start

func Start() error

Start server.

func VerifyRecaptchaToken

func VerifyRecaptchaToken(token string) bool

VerifyRecaptchaToken verify google recaptcha token

Types

type Condition

type Condition struct {
	Key   string       `parser:"@Ident"`
	Op    string       `parser:"@('!'? '=' | '<' '='? | '>' '='? | ':')"`
	Value *FilterValue `parser:"@@"`
}

type EmailClient

type EmailClient struct {
	// contains filtered or unexported fields
}

func GetEmailClient added in v0.1.3

func GetEmailClient() (*EmailClient, error)

func (*EmailClient) AddHtmlContent

func (e *EmailClient) AddHtmlContent(content string) *EmailClient

func (*EmailClient) AddTextContent

func (e *EmailClient) AddTextContent(content string) *EmailClient

func (*EmailClient) NewMessage added in v0.1.3

func (e *EmailClient) NewMessage(subject string) *EmailClient

func (*EmailClient) Send

func (e *EmailClient) Send(to []string) error

type FilterValue

type FilterValue struct {
	Bool          *bool     `parser:"@('true' | 'false')"`
	String        *string   `parser:"| @String"`
	Number        *float64  `parser:"| @(Int | Float)"`
	BetweenString []string  `parser:"| '[' @String (',' @String)* ']'"`
	BetweenNumber []float64 `parser:"| '[' @(Int | Float) (',' @(Int | Float))* ']'"`
}

type Map

type Map = map[string]any

Map alias.

type Query

type Query struct {
	Key      SupportQueryKey `json:"key"`
	Operator QueryOperator   `json:"operator"`
	Value    any             `json:"value"`
}

type QueryOperator

type QueryOperator string
const (
	OpBetween        QueryOperator = "between"
	OpMatch          QueryOperator = ":"
	OpEquals         QueryOperator = "="
	OpNotEquals      QueryOperator = "!="
	OpGreaterThan    QueryOperator = ">"
	OpGreaterOrEqual QueryOperator = ">="
	OpLessThan       QueryOperator = "<"
	OpLessOrEqual    QueryOperator = "<="
)

type SupportQueryKey

type SupportQueryKey string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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