debscraper

package
v0.0.0-...-bfb5a2a Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mirrors = []string{
	"http://ftp.at.debian.org/debian",
	"http://ftp.de.debian.org/debian",
	"http://ftp.si.debian.org/debian",
	"http://ftp.hr.debian.org/debian",
	"http://ftp.ch.debian.org/debian",
	"http://ftp.cz.debian.org/debian",
	"http://ftp.hu.debian.org/debian",
	"http://ftp.it.debian.org/debian",
	"http://ftp.nl.debian.org/debian",
	"http://ftp.pl.debian.org/debian",
	"http://ftp.ro.debian.org/debian",
	"http://ftp.sk.debian.org/debian",
	"http://ftp.es.debian.org/debian",
	"http://ftp.pt.debian.org/debian",
	"http://ftp.fr.debian.org/debian",
	"http://ftp.uk.debian.org/debian",
	"http://ftp.us.debian.org/debian",
}

Functions

func RandomMirror

func RandomMirror(url ...string) func() string

func RoundRobinMirror

func RoundRobinMirror(url ...string) func() string

Types

type CliProgressBar

type CliProgressBar struct {
	// contains filtered or unexported fields
}

func (*CliProgressBar) Done

func (c *CliProgressBar) Done(i int)

func (*CliProgressBar) Start

func (c *CliProgressBar) Start(total int64)

type CsvDecoder

type CsvDecoder struct {
	*csvutil.Decoder
}

func NewCsvDecoder

func NewCsvDecoder(r io.Reader) (*CsvDecoder, error)

func (*CsvDecoder) Decode

func (c *CsvDecoder) Decode(v *HashItem) error

type CsvEncoder

type CsvEncoder struct {
	*csvutil.Encoder
}

func NewCsvEncoder

func NewCsvEncoder(w io.Writer) *CsvEncoder

func (*CsvEncoder) Encode

func (c *CsvEncoder) Encode(v HashItem) error

type DebScraper

type DebScraper struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *DebScraper

func (*DebScraper) FetchPackage

func (s *DebScraper) FetchPackage(ctx context.Context, attempts int, pkg datastore.Package) (items []datastore.KnownFile, err error)

func (*DebScraper) ListPackages

func (s *DebScraper) ListPackages(ctx context.Context) ([]datastore.Package, error)

func (*DebScraper) Scrape

func (s *DebScraper) Scrape(ctx context.Context, concurrency int, hashItemCh chan datastore.KnownFile, progress ProgressDelegate) (err error)

type HashItem

type HashItem struct {
	Package      string      `csv:"package"`
	Version      string      `csv:"version"`
	Architecture string      `csv:"architecture"`
	Filename     string      `csv:"filename"`
	Size         int64       `csv:"size"`
	Mode         os.FileMode `csv:"mode"`
	Owner        string      `csv:"owner"`
	Group        string      `csv:"group"`
	MD5          string      `csv:"md5"`
	SHA1         string      `csv:"sha1"`
	SHA256       string      `csv:"sha256"`
}

type NoopProgressBar

type NoopProgressBar struct{}

func (*NoopProgressBar) Done

func (d *NoopProgressBar) Done(i int)

func (*NoopProgressBar) Start

func (d *NoopProgressBar) Start(total int64)

type Option

type Option func(*DebScraper)

func WithArch

func WithArch(arch string) Option

func WithComponent

func WithComponent(component string) Option

func WithDistro

func WithDistro(distro string) Option

func WithLogger

func WithLogger(logger *logrus.Logger) Option

func WithMirrorUrl

func WithMirrorUrl(mirrorUrl string) Option

func WithOsType

func WithOsType(osType datastore.OsType) Option

func WithRandomMirrors

func WithRandomMirrors(url ...string) Option

func WithRoundRobinMirrors

func WithRoundRobinMirrors(url ...string) Option

type ProgressDelegate

type ProgressDelegate interface {
	Start(int64)
	Done(int)
}

Jump to

Keyboard shortcuts

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