Documentation
¶
Index ¶
- func NewHostMapper(opts ...Option) hosts.HostMapper
- type Mapping
- type Option
- func FileLoaderOption(fileLoader loader.Loader) Option
- func HTTPLoaderOption(httpLoader loader.Loader) Option
- func LoggerOption(logger logger.Logger) Option
- func MappingsOption(mappings []Mapping) Option
- func RedisLoaderOption(redisLoader loader.Loader) Option
- func ReloadPeriodOption(period time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHostMapper ¶
func NewHostMapper(opts ...Option) hosts.HostMapper
NewHostMapper creates a new HostMapper with the given options. It starts a background goroutine for periodic reload from external loaders.
Types ¶
type Option ¶
type Option func(opts *options)
Option configures a hostMapper.
func FileLoaderOption ¶
FileLoaderOption sets a file-based loader for hosts mappings (supports both Loader and Lister).
func HTTPLoaderOption ¶
HTTPLoaderOption sets an HTTP-based loader for hot-reloadable hosts mappings.
func LoggerOption ¶
LoggerOption sets the logger for the hostMapper.
func MappingsOption ¶
MappingsOption sets the static host-to-IP mappings.
func RedisLoaderOption ¶
RedisLoaderOption sets a Redis-based loader for hot-reloadable hosts mappings.
func ReloadPeriodOption ¶
ReloadPeriodOption sets the period for automatic reload from external loaders.