runner

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package runner contains the internal logic

Index

Constants

View Source
const ConfigDefaultFilename = "notify.conf"

ConfigDefaultFilename containing configuration

View Source
const Version = `0.0.2`

Version is the current version

Variables

This section is empty.

Functions

func CheckConfigExists

func CheckConfigExists(configPath string) bool

CheckConfigExists in the specified path

func GetConfigDirectory

func GetConfigDirectory() (string, error)

GetConfigDirectory from the system

Types

type ConfigFile

type ConfigFile struct {
	BIID string `yaml:"burp_biid,omitempty"`
	// Slack
	SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"`
	SlackUsername   string `yaml:"slack_username,omitempty"`
	SlackChannel    string `yaml:"slack_channel,omitempty"`
	Slack           bool   `yaml:"slack,omitempty"`

	// Discord
	DiscordWebHookURL       string `yaml:"discord_webhook_url,omitempty"`
	DiscordWebHookUsername  string `yaml:"discord_username,omitempty"`
	DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"`
	Discord                 bool   `yaml:"discord,omitempty"`

	// Telegram
	TelegramAPIKey string `yaml:"telegram_apikey,omitempty"`
	TelegramChatID string `yaml:"telegram_chat_id,omitempty"`
	Telegram       bool   `yaml:"telegram,omitempty"`

	Interval    int    `yaml:"interval,omitempty"`
	HTTPMessage string `yaml:"http_message,omitempty"`
	DNSMessage  string `yaml:"dns_message,omitempty"`
	CLIMessage  string `yaml:"cli_message,omitempty"`
}

ConfigFile structure

func UnmarshalRead

func UnmarshalRead(file string) (ConfigFile, error)

UnmarshalRead the config file from location

func (*ConfigFile) MarshalWrite

func (c *ConfigFile) MarshalWrite(file string) error

MarshalWrite to location

type Options

type Options struct {
	BIID                    string
	SlackWebHookURL         string
	SlackUsername           string
	SlackChannel            string
	Slack                   bool
	DiscordWebHookURL       string
	DiscordWebHookUsername  string
	DiscordWebHookAvatarURL string
	Discord                 bool
	TelegramAPIKey          string
	TelegramChatID          string
	Telegram                bool
	Verbose                 bool
	NoColor                 bool
	Silent                  bool
	Version                 bool
	Interval                int
	HTTPMessage             string
	DNSMessage              string
	CLIMessage              string
}

Options of the internal runner

func ParseConfigFileOrOptions

func ParseConfigFileOrOptions() *Options

ParseConfigFileOrOptions combining all settings

func (*Options) MergeFromConfig

func (options *Options) MergeFromConfig(configFileName string, ignoreError bool)

MergeFromConfig with existing options

type Runner

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

Runner contains the internal logic of the program

func NewRunner

func NewRunner(options *Options) (*Runner, error)

NewRunner instance

func (*Runner) Close

func (r *Runner) Close()

Close the runner instance

func (*Runner) Run

func (r *Runner) Run() error

Run polling and notification

Jump to

Keyboard shortcuts

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