config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultACLPolicy = acl.MustParsePolicy("allow " + acl.Wildcard)

Functions

func WatchACLConfig

func WatchACLConfig(kv *api.KV, key string) watch.Watchable[*ACL]

func WatchCaddyConfig

func WatchCaddyConfig(kv *api.KV, key string) watch.Watchable[*caddy.Config]

func WatchConsulCatalog

func WatchConsulCatalog(catalog *api.Catalog, cfg service.ExtractConfig) watch.Watchable[service.Map]

func WatchConsulKey

func WatchConsulKey(kv *api.KV, key string) watch.Watchable[*api.KVPair]

func WatchConsulPrefix

func WatchConsulPrefix(kv *api.KV, prefix string) watch.Watchable[[]*api.KVPair]

func WatchStaticServices

func WatchStaticServices(kv *api.KV, prefix string) watch.Watchable[service.Map]

func WatchZoneConfig

func WatchZoneConfig(kv *api.KV, key string) watch.Watchable[*Zone]

Types

type ACL

type ACL struct {
	Networks      map[string]acl.Network
	Groups        map[string][]string
	DefaultPolicy acl.Policy
	DefaultAction acl.Action
}

func DefaultACLConfig

func DefaultACLConfig() *ACL

func (*ACL) MatchGroups

func (c *ACL) MatchGroups(network string) ([]string, bool)

func (*ACL) MatchNetwork

func (c *ACL) MatchNetwork(ip *net.IP) (string, bool)

func (*ACL) UnmarshalJSON

func (c *ACL) UnmarshalJSON(data []byte) error

type ConsulConfig

type ConsulConfig struct {
	Endpoint           *url.URL
	Token              string
	GlobalConfigPrefix string

	Tags TagConfig
	Keys KeyConfig
}

func DefaultConsulConfig

func DefaultConsulConfig() *ConsulConfig

func (*ConsulConfig) UnmarshalJSON

func (c *ConsulConfig) UnmarshalJSON(data []byte) error

type ErrorHandler

type ErrorHandler func(error) (time.Duration, bool)

type KeyConfig

type KeyConfig struct {
	Name  string `json:"name"`
	Zone  string `json:"zone"`
	ACL   string `json:"acl"`
	Proxy string `json:"proxy"`
}

func DefaultKeyConfig

func DefaultKeyConfig() KeyConfig

type RemoteConfig

type RemoteConfig interface {
	Ready() bool
	Services() service.Map
	ACL() *ACL
	Zone() *Zone
	Caddy() *caddy.Config
}

type TagConfig

type TagConfig struct {
	Service   string `json:"service"`
	NoPublish string `json:"no_publish"`
}

func DefaultTagConfig

func DefaultTagConfig() TagConfig

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(onChange func(RemoteConfig) bool, onError ErrorHandler) *Watcher

func (*Watcher) ACL

func (w *Watcher) ACL() *ACL

func (*Watcher) Caddy

func (w *Watcher) Caddy() *caddy.Config

func (*Watcher) Ready

func (w *Watcher) Ready() bool

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context, catalog *api.Catalog, kv *api.KV, configPrefix string, extractCfg service.ExtractConfig) error

func (*Watcher) Services

func (w *Watcher) Services() service.Map

func (*Watcher) Zone

func (w *Watcher) Zone() *Zone

type Zone

type Zone struct {
	DefaultZone string   `json:"default_zone,omitempty"`
	Zones       []string `json:"zones,omitempty"`
}

func DefaultZoneConfig

func DefaultZoneConfig() *Zone

Jump to

Keyboard shortcuts

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