model

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annymous

type Annymous struct {
	Enable bool       `json:"enable" mapstructure:"enable"`
	Paths  []PathRole `json:"paths" mapstructure:"paths"`
}

type CloseConf added in v1.3.0

type CloseConf struct {
	MaxTimes    int           `json:"max_times"`
	MaxDuration time.Duration `json:"max_duration"`
}

type CreateTokenParams

type CreateTokenParams struct {
	PathRoles        []PathRole `json:"path_roles" validate:"dive,required"`
	Duration         string     `json:"duration" validate:"required"`
	UploadSizeLimit  string     `json:"size_limit"`
	UploadCountLimit int        `json:"count_limit"`
}

create Token params

type Https

type Https struct {
	Domain string `json:"domain" mapstructure:"domain"`
	Cert   string `json:"cert" mapstructure:"cert"`
	Key    string `json:"key" mapstructure:"key"`
}

type PathRole

type PathRole struct {
	Path string `json:"path" mapstructure:"path"`
	Mode string `json:"mode" mapstructure:"mode"`
}

func (*PathRole) HasPermit

func (pr *PathRole) HasPermit(p string, mode string) bool

func (*PathRole) Valid

func (pr *PathRole) Valid() bool

Valid check PathRole, and clean path

type ResFileInfo added in v1.1.0

type ResFileInfo struct {
	Name         string `json:"name"`
	Size         int64  `json:"size"`
	IsDir        bool   `json:"is_dir"`
	ModTimeStamp int64  `json:"mod_time"`
	FileType     string `json:"file_type"`
}

type Server

type Server struct {
	Addr  string `json:"addr" mapstructure:"addr"`
	Https Https  `json:"https" mapstructure:"https"`

	Home string `json:"home" mapstructure:"home" validate:"required"`
}

type ServieConfig

type ServieConfig struct {
	Server

	CloseConf CloseConf `json:"close_conf" mapstructure:"close_conf"`

	Users []UserAuths `json:"users" mapstructure:"users"`
	Any   Annymous    `json:"any" mapstructure:"any"`
}

type TokenAuth

type TokenAuth struct {
	Token string `json:"token"`

	// SignedUser 签发者
	SignedUser User `json:"signed_user"`

	// PathRole is a map of path and role
	PathRoles map[string]PathRole `json:"path_roles"`

	// SignAt token 签发时间
	SignAt time.Time `json:"sign_at"`

	// Duration token 有效期
	Duration time.Duration `json:"duration"`

	// UploadSizeLimit 单次上传文件大小限制 eg: 100MB
	UploadSizeLimit string `json:"size_limit"`

	// CountLimit 上传次数限制
	UploadCountLimit int `json:"count_limit"`

	// UsedCount 已使用过的次数
	UploadUsedCount int `json:"used_count"`
}

type User

type User struct {
	UserName string `json:"username" mapstructure:"username" validate:"required"`
	Password string `json:"password" mapstructure:"password" validate:"required"`
}

type UserAuths

type UserAuths struct {
	User      `json:"user"`
	PathRoles map[string]PathRole `json:"path_roles"`
}

UserAuths user 对路径的权限

Jump to

Keyboard shortcuts

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