chooser

package
v7.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChooseOptions

type ChooseOptions struct {
	// Domain 是待选择的域名
	Domain string

	// 如果找不到合适的域名就直接返回空
	FailFast bool
}

ChooseOptions 选择器的选项

type Chooser

type Chooser interface {
	// Choose 从给定的 IP 地址列表中选择一批 IP 地址用于发送请求
	Choose(context.Context, []net.IP, *ChooseOptions) []net.IP

	// FeedbackGood 反馈一批 IP 地址请求成功
	FeedbackGood(context.Context, []net.IP, *FeedbackOptions)

	// FeedbackBad 反馈一批 IP 地址请求失败
	FeedbackBad(context.Context, []net.IP, *FeedbackOptions)
}

Chooser 选择器接口

func NewDirectChooser

func NewDirectChooser() Chooser

NewDirectChooser 创建直接选择器

func NewIPChooser

func NewIPChooser(options *IPChooserConfig) Chooser

NewIPChooser 创建 IP 选择器

func NewShuffleChooser

func NewShuffleChooser(chooser Chooser) Chooser

NewShuffleChooser 创建随机混淆选择器

func NewSmartIPChooser

func NewSmartIPChooser(options *SmartIPChooserConfig) Chooser

NewSmartIPChooser 创建智能 IP 选择器

func NewSubnetChooser

func NewSubnetChooser(options *SubnetChooserConfig) Chooser

NewSubnetChooser 创建子网选择器

type FeedbackOptions

type FeedbackOptions struct {
	// Domain 是待反馈的域名
	Domain string
}

FeedbackOptions 反馈的选项

type IPChooserConfig

type IPChooserConfig struct {
	// FreezeDuration IP 冻结时长(默认:600s)
	FreezeDuration time.Duration
}

IPChooserConfig IP 选择器的选项

type SmartIPChooserConfig

type SmartIPChooserConfig IPChooserConfig

SmartIPChooserConfig 智能 IP 选择器的选项

type SubnetChooserConfig

type SubnetChooserConfig IPChooserConfig

SubnetChooserConfig 子网选择器的选项

Jump to

Keyboard shortcuts

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