package
0.1.0
Repository: https://github.com/mgla96/ssh-watcher.git
Documentation: pkg.go.dev

# README

notifier

import "github.com/mgla96/ssh-watcher/internal/notifier"

Index

type EmailNotifier

type EmailNotifier struct{}

func (EmailNotifier) Notify

func (e EmailNotifier) Notify(logLine LogLine) error

type EventType

type EventType string

const (
    LoggedIn                          EventType = "logged in"
    FailedLoginAttempt                EventType = "failed login attempt"
    FailedLoginAttemptInvalidUsername EventType = "failed login attempt with invalid username"
)

type HTTPClient

type HTTPClient interface {
    Do(req *http.Request) (*http.Response, error)
}

type LogLine

type LogLine struct {
    Username    string    `json:"username"`
    IpAddress   string    `json:"ip_address"`
    LoginTime   string    `json:"login_time"`
    EventType   EventType `json:"event_type"`
    HostMachine string    `json:"host_machine"`
}

type SlackNotifier

type SlackNotifier struct {
    WebhookURL    string
    SlackChannel  string
    SlackUsername string
    SlackIcon     string
    HttpClient    HTTPClient
}

func NewSlackNotifier

func NewSlackNotifier(webhookURL, slackChannel, slackUsername, slackIcon string) SlackNotifier

func (SlackNotifier) Notify

func (s SlackNotifier) Notify(logLine LogLine) error

type SlackPayload

type SlackPayload struct {
    Channel   string `json:"channel"`
    Username  string `json:"username"`
    IconEmoji string `json:"icon_emoji"`
    Text      string `json:"text"`
}

Generated by gomarkdoc