plugin

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	log.Logger

	// 是否启用默认配置
	Defaults *bool `default:"${DEFAULT=true}"`
	// 是否显示详细信息
	Verbose bool `default:"${VERBOSE=false}"`
	// 日志配置
	Level string `default:"${LEVEL=info}"`
	// 是否在出错时打印输出
	Pwe *bool `default:"${PWE=true}"`

	// 是否重试
	Retry *bool `default:"${RETRY=true}"`
	// 重试次数
	Counts int `default:"${COUNTS=5}"`
	// 重试间隔
	Backoff time.Duration `default:"${BACKOFF=5s}"`
	// 超时时间
	Timeout time.Duration `default:"${TIMEOUT=60m}"`

	// 代理
	Proxy *config.Proxy `default:"${PROXY}"`
	// 多个代理
	Proxies []*config.Proxy `default:"${PROXIES}"`
	// 卡片
	Card config.Card `default:"${CARD}"`
	// 命令列表
	Commands []string `default:"${COMMANDS}"`
	// contains filtered or unexported fields
}

Base 插件基础

func (*Base) After added in v1.2.4

func (b *Base) After() (err error)

func (*Base) Before added in v1.2.4

func (b *Base) Before() (err error)

func (*Base) Carding

func (b *Base) Carding() (card any, err error)

func (*Base) Cleanup

func (b *Base) Cleanup() *cleanup.Builder

func (*Base) Command

func (b *Base) Command(command string) (builder *command.Builder)

func (*Base) Default

func (b *Base) Default() bool

func (*Base) Elapsed

func (b *Base) Elapsed() time.Duration

func (*Base) Expressions

func (b *Base) Expressions() (expressions core.Expressions)

func (*Base) Fields

func (b *Base) Fields() gox.Fields[any]

func (*Base) Home

func (b *Base) Home(paths ...string) (final string)

func (*Base) Http

func (b *Base) Http() *http.Client

func (*Base) Parse

func (b *Base) Parse(to map[string]string, configs ...string)

func (*Base) Parses

func (b *Base) Parses(to map[string][]string, configs ...string)

func (*Base) Request added in v1.0.6

func (b *Base) Request() *resty.Request

func (*Base) Scheme

func (b *Base) Scheme() (scheme string)

func (*Base) Setup

func (b *Base) Setup() (err error)

func (*Base) Since added in v1.1.0

func (b *Base) Since() time.Duration

func (*Base) Value added in v1.0.8

func (b *Base) Value(key string) *internal.Value

type Bootstrap

type Bootstrap struct {
	*Base
	// contains filtered or unexported fields
}

func New

func New(constructor Constructor) (bootstrap *Bootstrap)

func (*Bootstrap) Alias

func (b *Bootstrap) Alias(name string, value string) *Bootstrap

func (*Bootstrap) Boot

func (b *Bootstrap) Boot()

func (*Bootstrap) Name

func (b *Bootstrap) Name(name string) *Bootstrap

type Config

type Config interface {
	// Fields 导出所有字段
	Fields() gox.Fields[any]
	// contains filtered or unexported methods
}

Config 配置

type Constructor

type Constructor func() Plugin

type Plugin

type Plugin interface {
	// Scheme 卡片模板
	Scheme() (scheme string)

	// Carding 卡片数据
	Carding() (card any, err error)

	// Config 加载配置
	Config() (config Config)

	// Setup 设置配置信息
	Setup() (err error)

	// Before 插件运行前执行
	Before() (err error)

	// Steps 插件运行步骤
	Steps() step.Steps

	// After 插件运行后执行
	After() (err error)

	// Expressions 表达式
	Expressions() core.Expressions
}

Plugin 插件接口,任何插件都需要实现这个接口

Jump to

Keyboard shortcuts

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