util

package
v0.0.0-...-3e8c5dd Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppKey = "4409e2ce8ffd12b8"
	AppSec = "59b43e04ad6965f34319062b478f83dd"
)

Variables

This section is empty.

Functions

func ClientSign

func ClientSign(data string) string

func Debug

func Debug(format string, v ...interface{})

func Error

func Error(format string, v ...interface{})

func GetTimestamp

func GetTimestamp() string

GetTimestamp can obtain current ts

func Info

func Info(format string, v ...interface{})

func InitConfig

func InitConfig()

InitConfig bind endpoints with config file

func IntContain

func IntContain(array []int, val int) (index int)

StringContains judge whether val exist in array

func LoadConfig

func LoadConfig(filePath string)

LoadConfig bind endpoints with config file

func LoginBili

func LoginBili()

func Map2Params

func Map2Params(params map[string]string) url.Values

Map2String can transfer a string-string map into url value struct

func Map2string

func Map2string(params map[string]string) string

Map2String can transfer a string-string map into a raw string

func PrintColor

func PrintColor(format string, v ...interface{})

func RandomString

func RandomString(length int) (sink string)

func Signature

func Signature(params *map[string]string)

Types

type Config

type Config struct {
	UserList  []User     `yaml:"USERS"`
	Danmuku   []string   `yaml:"DANMU"`
	Endpoints []Endpoint `yaml:"PUSH"`
	CD        CoolDown   `yaml:"CD"`
	Cron      string     `yaml:"CRON"`
}
var GlobalConfig Config

type CoolDown

type CoolDown struct {
	Async  int `yaml:"async"`
	Retry  int `yaml:"retry"`
	MaxTry int `yaml:"max_try"`
	Like   int `yaml:"like"`
	Share  int `yaml:"share"`
	Danmu  int `yaml:"danmu"`
}

type Endpoint

type Endpoint struct {
	Name  string `yaml:"name"`
	Type  string `yaml:"type"`
	URL   string `yaml:"url"`
	Token string `yaml:"token"`
}

type User

type User struct {
	AllowedUid string `yaml:"allowed_uid"`
	BannedUid  string `yaml:"banned_uid"`
	AccessKey  string `yaml:"access_key"`
	PushName   string `yaml:"push_name"`
}

Jump to

Keyboard shortcuts

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