appConfig

package
v0.0.0-...-2029094 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScryptInitN  = 262144
	ScryptInitR  = 8
	ScryptInitP  = 4
	ScryptLength = 32
)
View Source
const (
	K_title    = "title"
	K_subTitle = "subTitle"
	K_name     = "name"
	K_say      = "say"
	K_ipc      = "ipc"
	K_github   = "github"
	K_mail     = "email"
	K_avatar   = "avatar"
)

Variables

This section is empty.

Functions

func CheckToken

func CheckToken(token string, key []byte, fromIP *net.IP) bool

CheckToken 校验token是否有效, 包括IP

func GenToken

func GenToken(ip net.IP, key []byte) string

GenToken json web token

Types

type AppConfig

type AppConfig struct {
	NormalConfig NormalConfig `json:"normalConfig"`
	PWD          ScryptJSON   `json:"pwd"`
	LastLogin    int64        `json:"lastLogin"`
	Token        string       `json:"token"`
	FriendLinks  []LinksItem  `json:"friendLinks"`
	// contains filtered or unexported fields
}
func (a *AppConfig) AddLinks(in *LinksItem)

AddLinks

func (*AppConfig) Close

func (a *AppConfig) Close()

func (*AppConfig) GetLastLogin

func (a *AppConfig) GetLastLogin() time.Time
func (a *AppConfig) GetLinks() []LinksItem

GetLinks

func (*AppConfig) GetNormalConfig

func (a *AppConfig) GetNormalConfig() *NormalConfig

func (*AppConfig) GetPWD

func (a *AppConfig) GetPWD() (*ScryptJSON, bool)

func (*AppConfig) GetToken

func (a *AppConfig) GetToken() string
func (a *AppConfig) RemoveLinks(urlIn string) bool

RemoveLinks

func (*AppConfig) SetLastLogin

func (a *AppConfig) SetLastLogin(in time.Time)

func (*AppConfig) SetNormalConfig

func (a *AppConfig) SetNormalConfig(in ...string) error

func (*AppConfig) SetPWD

func (a *AppConfig) SetPWD(in *ScryptJSON)

SetPWD it will clear token

func (*AppConfig) SetToken

func (a *AppConfig) SetToken(token string)

func (*AppConfig) Start

func (a *AppConfig) Start(filePath string) error

type LinksItem

type LinksItem struct {
	Name   string `json:"name"`
	URL    string `json:"url"`
	Header bool   `json:"header"`
}

type NormalConfig

type NormalConfig struct {
	Title    string `json:"title"`
	SubTitle string `json:"subTitle"`
	Name     string `json:"name"`
	Say      string `json:"say"`
	IPC      string `json:"ipc"`
	Github   string `json:"github"`
	Avatar   string `json:"avatar"`
	Email    string `json:"email"`
}

type ScryptJSON

type ScryptJSON struct {
	Salt string `json:"salt"`
	Key  string `json:"key"`
}

Jump to

Keyboard shortcuts

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