notify

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 6 Imported by: 0

README

拦截规则

配置设置级别

因为nginx只能配置放行(allow)或不放行(deny),阿里云也仅能配置拦截IP,所以需要配置一个我们需要的错误级别,只有高于这个级别的,我们才针对性的采取deny的设置。

这个设置通过--level我们可以设置,默认的配置为10003,也就是Illegal_UnknownUrl,具体的级别列表请参考这里

同样的还有--count参数,我们可以设置,只有当某个IP错误次数大于等于这个次数时才拦截

TODO

  • nginx和aliyun都没有实现既有文件的读取
  • aliyun因为没有更新comment的功能,状态的存储需要考虑实现方案

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedRetry = errors.New("need retry")

Functions

func GetHandler added in v0.9.0

func GetHandler(name string, currentHandler Notifier, cfg *Config) (handler.EntryHandler, error)

Types

type Config

type Config struct {
	MinLevel int
	MinCount int
}

type FullNotifier

type FullNotifier interface {
	//通过具体的推送渠道把处理过的map推送下去(所有notify中的所有map都是已经去过重的)
	Notify(entries map[string]*entry.LogEntry, force ...bool) error
}

type Handler

type Handler interface {
	AddFlags(*pflag.FlagSet)
	Init(*Config) error
}

type IterNotifier

type IterNotifier interface {
	NotifyAdd(*entry.LogEntry) error
	//通知拦截器删除某个entry,entry可以传入多个
	NotifyDel(...*entry.LogEntry) error
}

type Notifier

type Notifier interface{}

type NotifyHandler added in v0.9.0

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

func (*NotifyHandler) RecordEntry added in v0.9.0

func (h *NotifyHandler) RecordEntry(en *entry.LogEntry) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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