Documentation
¶
Index ¶
- Constants
- Variables
- func CheckPortIsExistWithName(name string) bool
- func CheckTagIsExistWithName(name string) bool
- func CheckTemplateIsExistWithName(name string) bool
- func CreateHost(hostIP, host string, tagID int) (enconterError error)
- func CreateHostWithHost(host *Host) (enconterError error)
- func CreatePort(port uint16, protocol string, template_id int) (enconterError error)
- func CreateRich(query *queryapi.RichEditQuery) (enconterError error)
- func CreateTag(tagQuery *apis.TagEditQuery) (enconterError error)
- func CreateTemplate(name, description, target string) (enconterError error)
- func CreateToken(SignedTo, description string) (enconterError error)
- func CreateUser(userQuery *apis.UserQuery) (enconterError error)
- func DeleteHostWithID(id uint64) error
- func DeletePortWithID(id uint64) error
- func DeleteRichWithID(id uint64) error
- func DeleteTagWithID(id uint64) error
- func DeleteTemplateWithID(id uint64) error
- func DeleteTokenWithID(id uint64) error
- func EncryptPassword(p string) string
- func GetHosts(offset, limit int, sort string) (map[string]interface{}, error)
- func GetPorts(offset, limit int, sort string) (map[string]interface{}, error)
- func GetRequestIP(r *http.Request) (uint32, error)
- func GetRich(offset, limit int, sort string) (map[string]interface{}, error)
- func GetSimpleTemplates(offset, limit int, sort string) (map[string]interface{}, error)
- func GetTags(offset, limit int, sort string) (map[string]interface{}, error)
- func GetTemplates(offset, limit int, sort string) (map[string]interface{}, error)
- func GetTokens(offset, limit int, sort string) (map[string]interface{}, error)
- func InitDB(driver string) error
- func LastLogin(uid int64, ip uint32) bool
- func Migration(driver string) error
- func MySQL() (*gorm.DB, error)
- func SQLite() (*gorm.DB, error)
- func UpdateHostWithID(query *apis.HostQuery) (enconterError error)
- func UpdatePortWithID(id uint64, port uint16, protocol string, template_id int) (enconterError error)
- func UpdateRichWithID(query *queryapi.RichEditQuery) (enconterError error)
- func UpdateTagWithID(query *apis.TagEditQuery) (enconterError error)
- func UpdateTemplateWithID(id uint64, name, description, target string) (enconterError error)
- func UpdateTokenWithID(id uint64, signedTo, description string, isUpdate bool) (enconterError error)
- type Host
- type HostList
- type Port
- type PortList
- type Rich
- type RichList
- type Tag
- type TagInfo
- type Template
- type TemplateList
- type Token
- type TokenList
- type User
Constants ¶
View Source
const Secret = "com.github.cylonchau"
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func CheckTagIsExistWithName ¶
func CreateHost ¶
func CreateHostWithHost ¶
func CreatePort ¶
func CreateRich ¶
func CreateRich(query *queryapi.RichEditQuery) (enconterError error)
func CreateTag ¶
func CreateTag(tagQuery *apis.TagEditQuery) (enconterError error)
func CreateTemplate ¶
func CreateToken ¶
func CreateUser ¶
func DeleteHostWithID ¶
func DeletePortWithID ¶
func DeleteRichWithID ¶
func DeleteTagWithID ¶
func DeleteTemplateWithID ¶
func DeleteTokenWithID ¶
func EncryptPassword ¶
func GetSimpleTemplates ¶
func GetTemplates ¶
func UpdateHostWithID ¶
func UpdatePortWithID ¶
func UpdateRichWithID ¶
func UpdateRichWithID(query *queryapi.RichEditQuery) (enconterError error)
func UpdateTagWithID ¶
func UpdateTagWithID(query *apis.TagEditQuery) (enconterError error)
func UpdateTemplateWithID ¶
Types ¶
type Host ¶
type Host struct { gorm.Model Hostname string `json:"hostname" gorm:"index;type:varchar(255)"` IP uint32 `json:"ip" gorm:"index;type:int"` TagId int `json:"tag_id" gorm:"index;type:int"` }
func QueryHostWithID ¶
func QueryHostWithName ¶
type HostList ¶
type PortList ¶
type Rich ¶
type Rich struct { gorm.Model Family string `form:"family" json:"family,omitempty" gorm:"type:char(4)"` Source *apis.Source `form:"source" json:"source,omitempty" gorm:"json"` Destination *apis.Destination `form:"destination" json:"destination,omitempty" gorm:"json"` Port []*apis.Port `form:"port" json:"port,omitempty" gorm:"json"` Protocol *apis.Protocol `form:"protocol" json:"protocol,omitempty" gorm:"json"` Action string `form:"action" json:"action,omitempty" gorm:"type:varchar(30)"` Limit uint16 `form:"limit" json:"limit,omitempty" gorm:"type:varchar(255)"` LimitUnit string `form:"limit_unit" json:"limit_unit,omitempty" gorm:"type:char(1)"` TemplateID int `form:"template_id" json:"template_id,omitempty" gorm:"type:int"` }
type RichList ¶
type RichList struct { ID int `json:"id"` Family string `form:"family" json:"family,omitempty"` Source *apis.Source `form:"source" json:"source,omitempty" gorm:"json"` Destination *apis.Destination `form:"destination" json:"destination,omitempty" gorm:"json"` Port []*apis.Port `form:"port" json:"port,omitempty" gorm:"json"` Protocol *apis.Protocol `form:"protocol" json:"protocol,omitempty" gorm:"json"` Action string `form:"action" json:"action,omitempty"` Limit uint16 `form:"limit" json:"limit,omitempty"` LimitUnit string `form:"limit_unit" json:"limit_unit,omitempty"` TemplateID int `form:"template_id" json:"template_id,omitempty"` Template string `json:"template"` }
type Tag ¶
type Tag struct { gorm.Model Name string `json:"name" gorm:"index;type:varchar(255)"` Description string `json:"description" gorm:"type:varchar(255)"` Hosts []Host `json:"hosts" gorm:"foreignKey:TagId;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` }
func CheckTagIsExistWithID ¶
type TagInfo ¶
type TemplateList ¶
type TemplateList struct { ID int `json:"id"` Name string `json:"name"` Target string `json:"target,omitempty"` Description string `json:"description,omitempty"` }
func (*TemplateList) TableName ¶
func (*TemplateList) TableName() string
type Token ¶
type Token struct { gorm.Model Token string `form:"token" json:"token" gorm:"type:text"` SignedTo string `form:"signed_to" json:"signed_to" gorm:"type:varchar(255)"` SignedBy string `form:"signed_by" json:"signed_by" gorm:"type:varchar(255)"` Description string `json:"description" gorm:"type:varchar(255)"` }
type TokenList ¶
type TokenList struct { ID int `json:"id"` Token string `form:"token" json:"token" gorm:"type:text"` SignedTo string `form:"signed_to" json:"signed_to" gorm:"type:varchar(255)"` SignedBy string `form:"signed_by" json:"signed_by" gorm:"type:varchar(255)"` Description string `json:"description" gorm:"type:varchar(255)"` }
Click to show internal directories.
Click to hide internal directories.