config

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdguardUpstream

type AdguardUpstream struct {
	APIServerURL string `koanf:"api_server_url"`
	Login        string `koanf:"login"`
	Password     string `koanf:"password"`
	AutoPTR      bool   `koanf:"auto_ptr"`
}

func (*AdguardUpstream) Validate

func (u *AdguardUpstream) Validate() error

type Client

type Client struct {
	Name       string   `koanf:"name"`
	Secret     string   `koanf:"secret"`
	XFRAllowed bool     `koanf:"xfr_allowed"`
	AutoDelete bool     `koanf:"auto_delete"`
	Zones      []string `koanf:"zones"`
	Types      []string `koanf:"types"`
}

type CloudflareUpstream added in v0.10.0

type CloudflareUpstream struct {
	ZoneID string `koanf:"zone_id"`
	Token  string `koanf:"token"`
}

func (*CloudflareUpstream) Validate added in v0.10.0

func (u *CloudflareUpstream) Validate() error

type Config

type Config struct {
	Listener Listener `koanf:"listener"`
	Upstream Upstream `koanf:"upstream"`
}

func LoadConfig

func LoadConfig(files ...string) (*Config, error)

func (*Config) NewRuntime

func (c *Config) NewRuntime() (*Runtime, error)

func (*Config) Validate

func (c *Config) Validate() error

type Listener

type Listener struct {
	Kind    ListenerKind    `koanf:"kind"`
	RFC2136 RFC2136Listener `koanf:"rfc2136"`
}

type ListenerKind

type ListenerKind string
const (
	ListenerKindNone    ListenerKind = ""
	ListenerKindRFC2136 ListenerKind = "rfc2136"
)

func (ListenerKind) MarshalText

func (k ListenerKind) MarshalText() ([]byte, error)

func (*ListenerKind) UnmarshalText

func (k *ListenerKind) UnmarshalText(data []byte) error

type RFC2136Listener

type RFC2136Listener struct {
	Addr    string   `koanf:"addr"`
	Nets    []string `koanf:"nets"`
	Clients []Client `koanf:"clients"`
}

func (*RFC2136Listener) Validate

func (l *RFC2136Listener) Validate() error

type Runtime

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

func (*Runtime) NewListener

func (r *Runtime) NewListener() (listener.Listener, error)

func (*Runtime) NewUpstream

func (r *Runtime) NewUpstream() (upstream.Upstream, error)

type Upstream

type Upstream struct {
	Kind       UpstreamKind       `koanf:"kind"`
	Adguard    AdguardUpstream    `koanf:"adguard"`
	Cloudflare CloudflareUpstream `koanf:"cloudflare"`
}

type UpstreamKind

type UpstreamKind string
const (
	UpstreamKindNone       UpstreamKind = ""
	UpstreamKindAdGuard    UpstreamKind = "adguard"
	UpstreamKindCloudflare UpstreamKind = "cloudflare"
)

func (UpstreamKind) MarshalText

func (k UpstreamKind) MarshalText() ([]byte, error)

func (*UpstreamKind) UnmarshalText

func (k *UpstreamKind) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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