models

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: BSD-2-Clause Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertNames

type CertNames struct {
	ID            uint `json:"id" gorm:"primarykey"`
	CertificateID uint `json:"cert_id" gorm:"index:idx_cert"`

	Hash string `json:"hash" gorm:"index:,unique;"`
	Type string `json:"type"`
	Name string `json:"name"`
}

func (*CertNames) BeforeCreate added in v0.1.5

func (c *CertNames) BeforeCreate(tx *gorm.DB) (err error)

func (CertNames) TableName

func (CertNames) TableName() string

type Certificate

type Certificate struct {
	ID uint `json:"id" gorm:"primarykey, TYPE:integer"`

	Hash        string    `json:"hash" gorm:"index:,unique;"`
	Fingerprint string    `json:"fingerprint" gorm:"index:,unique;"`
	Subject     string    `json:"subject"`
	Issuer      string    `json:"issuer"`
	NotBefore   time.Time `json:"not_before"`
	NotAfter    time.Time `json:"not_after"`
	ProbedAt    time.Time `json:"probe_at"`

	IsRootCA   bool `json:"root_ca"`
	IsCA       bool `json:"ca"`
	SelfSigned bool `json:"self_signed"`

	RawData string `json:"raw_data"`

	Names []*CertNames `json:"names" gorm:"constraint:OnDelete:CASCADE"`

	Hosts []*Host `gorm:"many2many:hosts_certs;"`
}

Result is a github.com/helviojunior/certcrawlercertcrawler result

func (*Certificate) BeforeCreate

func (c *Certificate) BeforeCreate(tx *gorm.DB) (err error)

func (Certificate) MarshalJSON

func (result Certificate) MarshalJSON() ([]byte, error)

Custom Marshaller for Result

func (*Certificate) String

func (cert *Certificate) String() string

func (Certificate) TableName

func (Certificate) TableName() string

type FQDN

type FQDN struct {
	ID uint `json:"id" gorm:"primarykey"`
	//HostID   uint `json:"host_id"`
	Hash string `json:"hash" gorm:"index:,unique;"`

	FQDN string `json:"fqdn"`
}

func (*FQDN) BeforeCreate added in v0.1.5

func (fqdn *FQDN) BeforeCreate(tx *gorm.DB) (err error)

func (FQDN) TableName

func (FQDN) TableName() string

type Host

type Host struct {
	ID   uint   `json:"id" gorm:"primarykey"`
	Hash string `json:"hash" gorm:"index:,unique;"`

	Ip    string `json:"ip"`
	Port  uint   `json:"port"`
	Cloud string `json:"cloud"`
	Ptr   string `json:"ptr"`

	Certificates []*Certificate `gorm:"many2many:hosts_certs;"`
	FQDNs        []*FQDN        `gorm:"many2many:hosts_fqdns;"`
}

func (*Host) AddCertificate

func (host *Host) AddCertificate(cert *Certificate)

func (*Host) AddFQDN

func (host *Host) AddFQDN(fqdn string)

func (*Host) BeforeCreate

func (h *Host) BeforeCreate(tx *gorm.DB) (err error)

func (*Host) HasCert

func (host *Host) HasCert(cert *Certificate) bool

func (*Host) HasFQDN

func (host *Host) HasFQDN(fqdn string) bool

func (*Host) ResetID added in v0.1.18

func (h *Host) ResetID()

func (Host) TableName

func (Host) TableName() string

type TestCtrl added in v0.1.2

type TestCtrl struct {
	ID uint `json:"id" gorm:"primarykey"`

	Hash string `json:"hash" gorm:"index:,unique;"`
	Ip   string `json:"ip"`
	Port uint   `json:"port"`
	FQDN string `json:"fqdn"`

	ProbedAt time.Time `json:"probe_at"`
}

func (*TestCtrl) BeforeCreate added in v0.1.5

func (ctrl *TestCtrl) BeforeCreate(tx *gorm.DB) (err error)

func (TestCtrl) TableName added in v0.1.2

func (TestCtrl) TableName() string

Jump to

Keyboard shortcuts

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