core

package module
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: Apache-2.0 Imports: 23 Imported by: 9

Documentation

Index

Constants

View Source
const (
	UserRoleTypeCodeUndefine        int = 0
	UserRoleTypeCodeRoot            int = 1
	UserRoleTypeCodeMaintainer      int = 2
	UserRoleTypeCodeManager         int = 3
	UserRoleTypeCodeLeader          int = 4
	UserRoleTypeCodeTeacher         int = 5
	UserRoleTypeCodeUndergraduate   int = 6
	UserRoleTypeCodeGraduateStudent int = 7
	UserRoleTypeCodeDoctoralStudent int = 8
)
View Source
const (
	UserGenderTypeCodeOther int = 0
	UserGenderTypeCodeMan   int = 1
	UserGenderTypeCodeWoMan int = 2
)
View Source
const (
	QuestionLevelCodeBasic       int = 0
	QuestionLevelCodeNormal      int = 1
	QuestionLevelCodeDifficult   int = 2
	QuestionLevelCodeChallenging int = 3
)
View Source
const (
	QuestionTypeCodeSingle   = 0
	QuestionTypeCodeMultiple = 1
	QuestionTypeCodeJudge    = 2
)
View Source
const (
	FileTypeCodeJPG  = 0
	FileTypeCodePNG  = 1
	FileTypeCodePPT  = 2
	FileTypeCodeXLS  = 3
	FileTypeCodeDOC  = 4
	FileTypeCodePPTX = 5
	FileTypeCodeXLSX = 6
	FileTypeCodeDOCX = 7
	FileTypeCodePDF  = 8
	FileTypeCodeMP3  = 9
	FileTypeCodeMP4  = 10
	FileTypeCodeZIP  = 11
)
View Source
const (
	LogDebug int = iota
	LogInfo
	LogWarning
	LogError
)
View Source
const DefTokenCert string = "96be053dab04"
View Source
const DefaultPassword = "1234567890"
View Source
const TokenHeader string = "3c6b9fc1"
View Source
const TokenSplitCharacter string = "."
View Source
const TokenTimeout = int64(7 * 24 * time.Hour / time.Second)

Variables

View Source
var (
	FlagHelp          bool
	FlagVersion       bool
	FlagUseSqlite     bool
	FlagUsePG         bool
	FlagSqliteDB      string
	FlagPgAddr        string
	FlagPgPort        int
	FlagPgDB          string
	FlagPgUser        string
	FlagPgPassword    string
	FlagPgSSLMode     string
	FlagPgSSLCert     string
	FlagPgSSLKey      string
	FlagPgSSLRootCert string
	FlagLogLevel      int
)
View Source
var (
	BuildTag  string
	BuildGo   string
	BuildTime string
)
View Source
var (
	FlagHttpListen  string
	FlagGRPCListen  string
	FlagPPROFEnable bool
	FlagPPROFListen string
	FlagLogWithUDP  bool
	FlagLogAddr     string
	FlagTokenCert   string
)

Functions

func Base64ToString

func Base64ToString(v string) (c string, err error)

func GenUUID

func GenUUID() string

36

func NewTokenCert

func NewTokenCert(str string) *string

func ParseUUID

func ParseUUID(uuidStr string) (uuid.UUID, error)

func PromptInfo added in v0.6.0

func PromptInfo(message ...string)

func PromptWarning added in v0.6.0

func PromptWarning(message ...string)

func PublicFlag added in v0.2.0

func PublicFlag(tagVer string, goVer string, timeVer string)

func PublicServerFlag added in v0.4.0

func PublicServerFlag()

func PublicVersion added in v0.4.0

func PublicVersion()

func StartPPOFDebug

func StartPPOFDebug(server http.Server, showHelp bool)

func StringToBase64

func StringToBase64(v string) (c string)

func StringToMD5

func StringToMD5(v string) (c string)

32

func StringToSha1

func StringToSha1(v string) (c string)

40

func StringToSha256

func StringToSha256(v string) (c string)

64

func StringToSha512

func StringToSha512(v string) (c string)

128

func TimestampToUTC8String

func TimestampToUTC8String(timestamp int64) string

func TimestampToUTCString

func TimestampToUTCString(timestamp int64) string

func UTC8StringToTimestamp

func UTC8StringToTimestamp(str string) (int64, error)

func UTCStringToTimestamp

func UTCStringToTimestamp(str string) (int64, error)

func VerifyToken

func VerifyToken(v string, tokenCert *string) error

Types

type Logger

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

func NewLogger

func NewLogger(level int) *Logger

func NewUDPLogger

func NewUDPLogger(level int, addr *net.UDPAddr, maxBytes int) (*Logger, error)

func (*Logger) Debug

func (logger *Logger) Debug(msg string)

func (*Logger) Error

func (logger *Logger) Error(msg string)

func (*Logger) Info

func (logger *Logger) Info(msg string)

func (*Logger) Print added in v0.1.1

func (logger *Logger) Print(values ...interface{})

Print: Interface for GORM debug log

func (*Logger) Warning added in v0.4.8

func (logger *Logger) Warning(msg string)

type Token

type Token struct {
	Timestamp      int64  `json:"timestamp"`
	LifeCycle      int64  `json:"lifeCycle"`
	UUID           string `json:"uuid"`
	AccountID      int    `json:"accountID"`
	Name           string `json:"name"`
	Gender         int    `json:"gender"`
	CollegeUUID    string `json:"collegeUUID"`
	DisciplineUUID string `json:"disciplineUUID"`
	ClassUUID      string `json:"classUUID"`
	Type           int    `json:"type"`
}

func NewToken

func NewToken() *Token

func (*Token) PackToken

func (token *Token) PackToken(tokenCert *string) (string, error)

func (*Token) UnpackToken

func (token *Token) UnpackToken(v string, tokenCert *string) error

Directories

Path Synopsis
protobufs
v1/pb
Package pb is a reverse proxy.
Package pb is a reverse proxy.

Jump to

Keyboard shortcuts

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