config

package
v3.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotifyDisabled = 0
	NotifyIfError  = 1
	NotifyAll      = 2
)
View Source
const RegexpPrefix = `regexp:`

Variables

View Source
var CommandDefaultTimeout = 10 * time.Second
View Source
var ErrCommandRequired = errors.New(`命令行命令不能为空`)
View Source
var TTLs = echo.NewKVData().
	Add(``, `自动`).Add(`1`, `1秒`).Add(`5`, `5秒`).Add(`10`, `10秒`).
	Add(`60`, `1分钟`).Add(`120`, `2分钟`).Add(`300`, `5分钟`).
	Add(`600`, `10分钟`).Add(`1800`, `30分钟`).
	Add(`3600`, `1小时`)

Functions

This section is empty.

Types

type CommandLine added in v3.6.1

type CommandLine struct {
	Command string // 命令
	EnvVars string // 环境变量
	WorkDir string // 工作目录
	Timeout time.Duration
}

func (*CommandLine) Exec added in v3.6.1

func (c *CommandLine) Exec() ([]byte, error)

type Config

type Config struct {
	Closed         bool
	IPv4           *NetIPConfig
	IPv6           *NetIPConfig
	DNSServices    []*DNSService
	DNSResolver    string            // example: 8.8.8.8
	NotifyMode     int               // 0-关闭通知; 1-仅仅出错时发送通知;2-发送全部通知
	NotifyTemplate map[string]string // 通知模板{html:"",markdown:""}
	Webhooks       []*webhook.Webhook
	Interval       time.Duration
}

func New

func New() *Config

func (*Config) AfterValidate

func (c *Config) AfterValidate(ctx echo.Context) error

func (*Config) BeforeValidate

func (c *Config) BeforeValidate(ctx echo.Context) error

func (*Config) BinderKeyNormalizer

func (c *Config) BinderKeyNormalizer(key string) string

func (*Config) Commit

func (c *Config) Commit() error

func (*Config) ExecWebhooks added in v3.6.1

func (c *Config) ExecWebhooks(tagValues *dnsdomain.TagValues) error

func (*Config) FindService

func (c *Config) FindService(provider string) *DNSService

func (*Config) HasWebhook added in v3.6.1

func (c *Config) HasWebhook() bool

func (*Config) IsValid

func (c *Config) IsValid() bool

type DNSDomain

type DNSDomain struct {
	IPFormat string // IP格式模板(支持变量标签#{ip})
	Domain   string // 域名
	Line     string // 线路类型
	Extra    echo.H // 扩展数据
}

type DNSService

type DNSService struct {
	Enabled     bool
	Provider    string
	Settings    echo.H
	IPv4Domains []*DNSDomain
	IPv6Domains []*DNSDomain
}

func (*DNSService) Clone

func (d *DNSService) Clone() *DNSService

type Filter

type Filter struct {
	Include string

	Exclude string
	// contains filtered or unexported fields
}

func (*Filter) Init

func (f *Filter) Init() (err error)

func (*Filter) Match

func (f *Filter) Match(ip string) bool

type NetIPConfig

type NetIPConfig struct {
	Enabled      bool
	Type         string // netInterface / api / cmd
	NetInterface *NetInterface
	NetIPApiUrl  string
	CommandLine  *CommandLine
}

func NewNetIPConfig

func NewNetIPConfig() *NetIPConfig

type NetInterface

type NetInterface struct {
	Name   string
	Filter *Filter
}

func NewNetInterface

func NewNetInterface() *NetInterface

Jump to

Keyboard shortcuts

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