models

package
v0.4.2-0...-ac2c6ee Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeOK             = 0
	CodeBadPermission  = 1
	CodeBadData        = 2
	CodeNoAuth         = 3
	CodeNoPermission   = 4
	CodeServerInternal = 5
	CodeNoData         = 6
	CodeExpire         = 7

	RoleSuper  = 0
	RoleAdmin  = 1
	RoleNormal = 2

	GODNS_RFI_KEY   = "GODNSLOG"
	GODNS_RFI_VALUE = "694ef536e5d0245f203a1bcf8cbf3294" // md5sum($GODNS_RFI_KEY)
)

============================================================================== api models ==============================================================================

Variables

This section is empty.

Functions

This section is empty.

Types

type AppSecurity

type AppSecurity struct {
	Token    string `json:"token"`
	DnsAddr  string `json:"dns_addr"`
	HttpAddr string `json:"http_addr"`
}

type AppSecuritySet

type AppSecuritySet struct {
	Password string `json:"password"`
}

type AppSetting

type AppSetting struct {
	Callback  string   `json:"callback"`
	CleanHour int64    `json:"cleanHour"`
	Rebind    []string `json:"rebind"`
}

type CR

type CR struct {
	Message   string      `json:"message"`
	Code      int         `json:"code"`
	Error     error       `json:"error,omitempty"`
	Timestamp int64       `json:"timestemp"`
	Result    interface{} `json:"result,omitempty"`
}

commone response

type DeleteRecordRequest

type DeleteRecordRequest struct {
	Ids []int64 `json:"ids"`
}

type DnsRecord

type DnsRecord struct {
	Id       int64     `json:"id,omitempty"`
	Uid      int64     `json:"-"`
	Callback string    `json:"-"`
	Var      string    `json:"-"`
	Domain   string    `json:"domain"`
	Ip       string    `json:"addr"`
	Ctime    time.Time `json:"ctime"`
}

type DnsRecordResp

type DnsRecordResp struct {
	Pagination
	Data []DnsRecord `json:"data"`
}

type HttpRecord

type HttpRecord struct {
	Id       int64     `json:"id,omitempty"`
	Uid      int64     `json:"-"`
	Callback string    `json:"-"`
	Path     string    `json:"path"`
	Ip       string    `json:"addr"`
	Method   string    `json:"method"`
	Data     string    `json:"data"`
	Ctype    string    `json:"ctype"`
	Ua       string    `json:"ua"`
	Raw      string    `xorm:"text"`
	Ctime    time.Time `json:"ctime"`
}

type HttpRecordResp

type HttpRecordResp struct {
	Pagination
	Data []HttpRecord `json:"data"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Islogin bool   `json:"isLogin"`
	Token   string `json:"token"`
	//TODO:
	Username string `json:"username"`
	RoleId   string `json:"roleId"`
	Lang     string `json:"lang"`
}

type Pagination

type Pagination struct {
	PageNo     int `json:"pageNo"`
	PageSize   int `json:"pageSize"`
	TotalCount int `json:"totalCount"`
	TotalPage  int `json:"totalPage"`
}

type Permission

type Permission struct {
	RoleId          int                   `json:"roleId"`
	PermissionId    string                `json:"permissionId"`
	PermissionName  string                `json:"permissionName"`
	ActionEntitySet []PermissionActionSet `json:"ActionEntitySet"`
}

type PermissionActionSet

type PermissionActionSet struct {
	Action       string `json:"action"`
	Description  string `json:"description"`
	DefaultCheck bool   `json:"defaultCheck"`
}

type Resolv

type Resolv struct {
	Host  string `json:"host"` //host record, eg. www
	Type  string `json:"Type"` //record type
	Value string `json:"Value"`
	Ttl   uint32 `json:"ttl"`
}

type Role

type Role struct {
	Id          string       `json:"id"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Permissions []Permission `json:"permissions"`
}

type TblDns

type TblDns struct {
	Id     int64     `xorm:"pk autoincr"`
	Uid    int64     `xorm:"notnull"` //TblUser.Id fk
	Domain string    `xorm:"varchar(255) notnull"`
	Var    string    `xorm:"varchar(255) index"`
	Ip     string    `xorm:"varchar(16) notnull"`
	Ctime  time.Time `xorm:"datetime"`
	Atime  time.Time `xorm:"datetime created"`
}

type TblHttp

type TblHttp struct {
	Id     int64     `xorm:"pk autoincr"`
	Uid    int64     `xorm:"notnull"` //TblUser.Id fk
	Ip     string    `xorm:"varchar(16) notnull"`
	Var    string    `xorm:"varchar(255) index"`
	Path   string    `xorm:"text notnull"`
	Method string    `xorm:"varchar(16)"`
	Data   string    `xorm:"mediumtext"`
	Ctype  string    `xorm:"varchar(64)"`
	Ua     string    `xorm:"text"`
	Raw    string    `xorm:"text"`
	Ctime  time.Time `xorm:"datetime"`
	Atime  time.Time `xorm:"datetime created"`
}

type TblUser

type TblUser struct {
	Id    int64  `xorm:"pk autoincr"`
	Name  string `xorm:"varchar(64) notnull unique"`
	Email string `xorm:"varchar(64) notnull unique"`
	Role  int    `xorm:"tinyint notnull default 0"`
	Token string `xorm:"varchar(128) notnull unique"`
	Pass  string `xorm:"varchar(128) notnull"`

	//settings
	Lang            string   `xorm:"varchar(16) default('en-US') notnull"`
	Callback        string   `xorm:"text"`
	CallbackMessage string   `xorm:"text"`
	Rebind          []string `xorm:"json"`
	CleanInterval   int64    `xorm:"default 3600"`

	Atime time.Time `xorm:"datetime created"`
	Utime time.Time `xorm:"datetime updated"`
}

tbl_user

type UserInfo

type UserInfo struct {
	Id       int64     `json:"id"`
	Name     string    `json:"username"`
	Email    string    `json:"email"`
	Avatar   string    `json:"avatar"`
	Language string    `json:"lang"`
	Role     Role      `json:"role"`
	Utime    time.Time `json:"utime"`
}

type UserListResp

type UserListResp struct {
	Pagination
	Data []UserInfo `json:"data"`
}

type UserRequest

type UserRequest struct {
	Id       int64  `json:"id"`
	Name     string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
	Role     int    `json:"role"`
	Language string `json:"lang"`
}

Jump to

Keyboard shortcuts

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