storage

package
v0.0.0-...-fdc8031 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleDomainUpdate

func HandleDomainUpdate(d *Domain, rec parser.HttpxRecord)

func HandleUrlUpdate

func HandleUrlUpdate(u *URL, rec parser.HttpxRecord)

func ImportDomainList

func ImportDomainList(domains []string)

func ImportHttpxRecords

func ImportHttpxRecords(records []parser.HttpxRecord)

func IsUniqueContraintError

func IsUniqueContraintError(err error) bool

func NeedsChange

func NeedsChange(oldV any, newV any) bool

func StoreDomainChange

func StoreDomainChange(d Domain, ch ChangeParameters)

func StoreUrlChange

func StoreUrlChange(u URL, ch ChangeParameters)

Types

type ChangeParameters

type ChangeParameters struct {
	OldValue *string
	NewValue *string
	Type     ChangeType
	Date     time.Time
}

func ChangeParametersFromString

func ChangeParametersFromString(oldV *string, newV *string, t ChangeType) ChangeParameters

func ChangeParametersFromUint

func ChangeParametersFromUint(oldV uint, newV uint, t ChangeType) ChangeParameters

type ChangeType

type ChangeType string
const (
	Host          ChangeType = "Host"
	Port          ChangeType = "Port"
	WebServer     ChangeType = "WebServer"
	StatusCode    ChangeType = "Status Code"
	ContentLength ChangeType = "Content Length"
	ContentType   ChangeType = "Content Type"
	Title         ChangeType = "Title"
	BodyMD5       ChangeType = "Body MD5"
	HeaderMD5     ChangeType = "Header MD5"
)

type Domain

type Domain struct {
	gorm.Model
	Domain     string `gorm:"unique;not null"`
	Host       *string
	Port       *string
	Webserver  *string
	LastChange time.Time
}

func GetAllDomains

func GetAllDomains() ([]Domain, error)

func GetDomain

func GetDomain(domain string) (*Domain, error)

func GetDomainById

func GetDomainById(id uint) (*Domain, error)

type DomainChange

type DomainChange struct {
	DomainID uint
	Domain   Domain
	Change   ChangeParameters `gorm:"embedded"`
}

func GetDomainChanges

func GetDomainChanges(d *Domain) ([]DomainChange, error)

type URL

type URL struct {
	gorm.Model
	DomainID      uint
	Domain        Domain
	Path          string `gorm:"not null"`
	StatusCode    uint
	ContentType   *string
	ContentLength uint
	Title         *string
	BodyMD5       *string
	HeaderMD5     *string
	LastScan      time.Time
	ResponseTime  string
}

func GetAllUrls

func GetAllUrls() ([]URL, error)

func GetDomainUrls

func GetDomainUrls(d Domain) ([]URL, error)

type UrlChange

type UrlChange struct {
	UrlID  uint
	Url    URL
	Change ChangeParameters `gorm:"embedded"`
}

func GetUrlChanges

func GetUrlChanges(d Domain, url string) ([]UrlChange, error)

Jump to

Keyboard shortcuts

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