daemon

package
v0.0.0-...-48c782e Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package daemon for downloading and parsing RKN data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Downloader *downloader.Downloader
	Resolver   *resolver.Resolver
	Parser     *parser.DB
	Config     Config
	// contains filtered or unexported fields
}

App main application

func New

func New(c Config) (a *App, err error)

New create new application

func (*App) AuthMiddleware

func (a *App) AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware is a middleware to check if the request has a valid token

func (*App) DumpDownloader

func (a *App) DumpDownloader(i time.Duration)

DumpDownloader download dump

func (*App) ReadDumpFile

func (a *App) ReadDumpFile(fn string) error

ReadDumpFile read dump file and parse it

func (*App) ReadSocialFile

func (a *App) ReadSocialFile(fn string) error

ReadSocialFile read social file and parse it

func (*App) Resolve

func (a *App) Resolve()

Resolve all domains from parser

func (*App) Run

func (a *App) Run()

Run application

func (*App) SocialDownloader

func (a *App) SocialDownloader(i time.Duration)

SocialDownloader download social resources

type Config

type Config struct {
	URL            string   `default:"http://vigruzki2.rkn.gov.ru/services/OperatorRequest2/?wsdl" toml:"rknurl" env:"URL"`
	User           string   `toml:"rknuser" env:"USER"`
	Pass           string   `toml:"rknpass" env:"PASS"`
	DNSServers     []string `default:"[8.8.8.8],[1.1.1.1]" toml:"dnses" env:"DNSSERVERS"`
	WorkerCount    int      `default:"64" toml:"dnsworkers" env:"WORKERCOUNT"`
	ResolverFile   string   `default:"output/resolved.txt" toml:"resolvfile" env:"RESOLVERFILE"`
	SocialInterval int      `default:"60" toml:"socinterval" env:"SOCIALINTERVAL"`
	DumpInterval   int      `default:"5" toml:"dumpinterval" env:"DUMPINTERVAL"`
	PostScript     string   `toml:"postscript" env:"POSTSCRIPT"`
	SocialScript   string   `toml:"socialscript" env:"SOCIALSCRIPT"`
	UseDump        bool     `default:"true" toml:"usedump" env:"USEDUMP"`
	UseSoc         bool     `default:"true" toml:"usesoc" env:"USESOC"`
	UseResolver    bool     `default:"false" toml:"useresolver" env:"USERESOLVER"`
	Cron           bool     `dafault:"false" toml:"cron" ENV:"CRON"`
	ListerHTTP     string   `default:"" toml:"listen" ENV:"LISTEN"`
	HTTPToken      string   `default:"" toml:"httptoken" ENV:"HTTPTOKEN"`
}

Config for application

func (*Config) Load

func (c *Config) Load() error

Load configuration

Jump to

Keyboard shortcuts

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