storage

package
v0.0.0-...-3f8c6a4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrderPerception

func OrderPerception(enabled bool) func(db *gorm.DB) *gorm.DB

OrderPerception orders by perception hash if enabled

Types

type Db

type Db struct {
	Path          string
	Disabled      bool
	SkipMigration bool
}

Db is the SQLite3 db handler ype

func NewDb

func NewDb() *Db

NewDb sets up a new DB

func (*Db) Get

func (db *Db) Get() (*gorm.DB, error)

Get gets a db handle

type Header struct {
	gorm.Model

	URLID uint
	Key   string
	Value string
}

Header contains an HTTP header

type TLS

type TLS struct {
	gorm.Model

	URLID           uint
	Version         uint16
	ServerName      string
	TLSCertificates []TLSCertificate
}

TLS contains TLS information for a URL

type TLSCertificate

type TLSCertificate struct {
	gorm.Model

	TLSID              uint
	Raw                []byte
	DNSNames           []TLSCertificateDNSName
	SubjectCommonName  string
	IssuerCommonName   string
	SignatureAlgorithm string
	PubkeyAlgorithm    string
}

TLSCertificate contain TLS Certificate information

func (*TLSCertificate) AddDNSName

func (tlsCert *TLSCertificate) AddDNSName(name string)

AddDNSName adds a new DNS Name to a Certificate

type TLSCertificateDNSName

type TLSCertificateDNSName struct {
	gorm.Model

	TLSCertificateID uint
	Name             string
}

TLSCertificateDNSName has DNS names for a TLS certificate

type URL

type URL struct {
	gorm.Model

	URL            string
	FinalURL       string
	ResponseCode   int
	ResponseReason string
	Proto          string
	ContentLength  int64
	Title          string
	Filename       string
	PerceptionHash string

	Headers []Header
	TLS     TLS
}

URL contains information about a URL

func (*URL) AddHeader

func (url *URL) AddHeader(key string, value string)

AddHeader adds a new header to a URL

func (*URL) MarshallCSV

func (url *URL) MarshallCSV() (res []string)

MarshallCSV returns values as a slice

func (*URL) MarshallJSON

func (url *URL) MarshallJSON() ([]byte, error)

MarshallJSON returns values as a slice

Jump to

Keyboard shortcuts

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