Documentation
¶
Overview ¶
Package hop provides a hop (node group) implementation that selects a node from a group of proxy nodes using load-balancing strategies, filters, and bypass rules. It supports periodic reloading of node lists from file, Redis, or HTTP sources.
Index ¶
- func NewHop(opts ...Option) hop.Hop
- func NewHopGroup(opts ...HopGroupOption) *hopGroup
- type HopEntry
- type HopGroupOption
- type Option
- func BypassOption(bp bypass.Bypass) Option
- func FailFilterSettingsOption(maxFails int, timeout time.Duration) Option
- func FileLoaderOption(fileLoader loader.Loader) Option
- func HTTPLoaderOption(httpLoader loader.Loader) Option
- func LoggerOption(logger logger.Logger) Option
- func NameOption(name string) Option
- func NodeOption(nodes ...*chain.Node) Option
- func RedisLoaderOption(redisLoader loader.Loader) Option
- func ReloadPeriodOption(period time.Duration) Option
- func SelectorOption(s selector.Selector[*chain.Node]) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHopGroup ¶ added in v0.28.1
func NewHopGroup(opts ...HopGroupOption) *hopGroup
NewHopGroup creates a new hopGroup and starts probe goroutines for entries that have probe configurations.
Types ¶
type HopEntry ¶ added in v0.28.1
type HopEntry struct {
// contains filtered or unexported fields
}
HopEntry wraps a hop.Hop with an optional matcher and an independent failure marker for hop-level probe tracking. The entry's marker is separate from any node-level markers inside the hop so that probe Reset() cannot undo a node-level failCodes Mark().
func NewHopEntry ¶ added in v0.28.1
NewHopEntry creates a HopEntry. matcher may be nil (unconditional catch-all). probe may be nil (no health check for this entry).
type HopGroupOption ¶ added in v0.28.1
type HopGroupOption func(*hopGroupOptions)
HopGroupOption configures a hopGroup.
func WithEntriesOption ¶ added in v0.28.1
func WithEntriesOption(entries ...*HopEntry) HopGroupOption
WithEntriesOption sets the hop entries for the group.
func WithGroupLoggerOption ¶ added in v0.28.1
func WithGroupLoggerOption(log logger.Logger) HopGroupOption
WithGroupLoggerOption sets the logger for the group.
func WithGroupSelectorOption ¶ added in v0.28.1
func WithGroupSelectorOption(s selector.Selector[hop.Hop]) HopGroupOption
WithGroupSelectorOption sets the selector for the group.
type Option ¶
type Option func(*options)
Option configures a hop.
func BypassOption ¶
BypassOption sets a hop-level bypass that can skip the entire hop.
func FailFilterSettingsOption ¶ added in v0.28.1
FailFilterSettingsOption sets the maxFails/failTimeout used by the hop's FailFilter. The pre-selection dead-node filter consults these to decide whether a node is currently marked failed.
func FileLoaderOption ¶
FileLoaderOption sets a loader that reads node configs from a file source.
func HTTPLoaderOption ¶
HTTPLoaderOption sets a loader that reads node configs from an HTTP source.
func LoggerOption ¶
LoggerOption sets the logger for the hop.
func NodeOption ¶
NodeOption sets the initial node list for the hop.
func RedisLoaderOption ¶
RedisLoaderOption sets a loader that reads node configs from a Redis source.
func ReloadPeriodOption ¶
ReloadPeriodOption sets the interval for periodic reloading of node lists.