models

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 2 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
	RoleGuest  = 3

	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"`
	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 Resolve added in v0.6.1

type Resolve struct {
	Id         int64  `json:"id,omitempty"`
	Host       string `json:"host"` //host record, eg. www
	Type       string `json:"type"` //record type, eg. CNAME/A/MX/TXT/SRV/NS.
	Value      string `json:"value"`
	Ttl        uint32 `json:"ttl"`
	Utimestamp int64  `json:"timestamp"`
}

type Resolves added in v0.6.1

type Resolves []TblResolve

func (Resolves) GetIndex added in v0.6.1

func (rs Resolves) GetIndex(r *Resolve) int

CNAME,TXT,MX 同一个host只允许配置1个

func (Resolves) GetTypeConflict added in v0.6.1

func (rs Resolves) GetTypeConflict(r *Resolve) (*Resolve, Resolves)

CNAME,TXT,MX 同一个host只允许配置1个

func (Resolves) GetValueConflict added in v0.6.1

func (rs Resolves) GetValueConflict(r *Resolve) *Resolve

Value 不允许重复

func (Resolves) Len added in v0.6.1

func (rs Resolves) Len() int

func (Resolves) Less added in v0.6.1

func (rs Resolves) Less(i, j int) bool

func (Resolves) Swap added in v0.6.1

func (rs Resolves) Swap(i, j int)

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"`
	Ctime  time.Time `xorm:"datetime"`
	Atime  time.Time `xorm:"datetime created"`
}

type TblResolve added in v0.6.1

type TblResolve struct {
	Id    int64  `xorm:"pk autoincr"`
	Host  string `xorm:"index varchar(255) notnull"` //host record, eg. www
	Type  string `xorm:"varchar(16) notnull"`        //record type, eg. CNAME/A/MX/TXT/SRV/NS.
	Value string `xorm:"varchar(255) notnull"`
	Ttl   uint32
	Ctime time.Time `xorm:"created"`
	Utime time.Time `xorm:"updated"`
}

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"`
	ShortId string `xorm:"varchar(32) notnull unique"`
	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