Version: v0.1.0 Latest Latest

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 13 Imported by: 0




View Source
const (
	Allow = "allow"
	Deny  = "deny"
View Source
const (
	SettingBucket = "SettingBucket"
	Installed     = "Installed"
View Source
const PageSize = 10


This section is empty.


func All

func All(to interface{}, limit, page int) error

func CheckErrNotFound

func CheckErrNotFound(err error) bool

func CheckUser

func CheckUser(name, pwd, group string) error


func CountAll

func CountAll(data interface{}) int

func Del

func Del(data interface{}) error

func Find

func Find(fieldName string, value interface{}, to interface{}, options ...func(q *index.Options)) error

func Get

func Get(bucket, key string, data interface{}) error

func GetGroupNames

func GetGroupNames() []string

func One

func One(fieldName string, value interface{}, to interface{}) error

func Prefix

func Prefix(fieldName string, prefix string, to interface{}, limit, page int) error

func Save

func Save(data interface{}) error

func Set

func Set(bucket, key string, data interface{}) error

func SetGroup

func SetGroup(g *Group) error

func SetUser

func SetUser(v *User) error

func SettingGet

func SettingGet(data interface{}) error

func SettingSet

func SettingSet(data interface{}) error

func Start

func Start()

func Stop

func Stop() error

func StructName

func StructName(data interface{}) string

func Update

func Update(data interface{}) error

func UpdateField

func UpdateField(data interface{}, fieldName string, value interface{}) error


type Group

type Group struct {
	Id           int            `json:"id" storm:"id,increment"`
	Name         string         `json:"name" storm:"unique"`
	Note         string         `json:"note"`
	AllowLan     bool           `json:"allow_lan"`
	ClientDns    []ValData      `json:"client_dns"`
	RouteInclude []ValData      `json:"route_include"`
	RouteExclude []ValData      `json:"route_exclude"`
	LinkAcl      []GroupLinkAcl `json:"link_acl"`
	Bandwidth    int            `json:"bandwidth"` // 带宽限制
	Status       int8           `json:"status"`    // 1正常
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`

type GroupLinkAcl

type GroupLinkAcl struct {
	// 自上而下匹配 默认 allow * *
	Action string     `json:"action"` // allow、deny
	Val    string     `json:"val"`
	Port   uint16     `json:"port"`
	IpNet  *net.IPNet `json:"ip_net"`
	Note   string     `json:"note"`

type IpMap

type IpMap struct {
	Id        int       `json:"id" storm:"id,increment"`
	IpAddr    net.IP    `json:"ip_addr" storm:"unique"`
	MacAddr   string    `json:"mac_addr" storm:"unique"`
	Username  string    `json:"username"`
	Keep      bool      `json:"keep"` // 保留 ip-mac 绑定
	KeepTime  time.Time `json:"keep_time"`
	Note      string    `json:"note"` // 备注
	LastLogin time.Time `json:"last_login"`
	UpdatedAt time.Time `json:"updated_at"`

type SettingOther

type SettingOther struct {
	Banner      string `json:"banner"`
	AccountMail string `json:"account_mail"`

type SettingSmtp

type SettingSmtp struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	From     string `json:"from"`
	UseSSl   bool   `json:"use_ssl"`

type User

type User struct {
	Id       int    `json:"id" storm:"id,increment"`
	Username string `json:"username" storm:"unique"`
	Nickname string `json:"nickname"`
	Email    string `json:"email"`
	// Password  string    `json:"password"`
	PinCode   string    `json:"pin_code"`
	OtpSecret string    `json:"otp_secret"`
	Groups    []string  `json:"groups"`
	Status    int8      `json:"status"` // 1正常
	SendEmail bool      `json:"send_email"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

type ValData

type ValData struct {
	Val    string `json:"val"`
	IpMask string `json:"ip_mask"`
	Note   string `json:"note"`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL