config

package
v0.0.0-...-bb19556 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocateConfigFile

func LocateConfigFile() string

LocateConfigFile will attempt to locate a config file based on common locations

Types

type Config

type Config struct {
	DNS       DNS               `toml:"dns"`
	SubDomain map[string]Domain `toml:"subdomain"`
	Static    map[string]Domain `toml:"static"`
}

Config is the main configuration object

func GetConfig

func GetConfig() *Config

GetConfig returns the Config structure for this application

func Load

func Load(filename string) (*Config, error)

Load will load the configuration from a passed filename

type DNS

type DNS struct {
	Port     int     `toml:"port"`
	Protocol string  `toml:"protocol"`
	Domain   *Domain `toml:"domain"`
	Soa      *Soa    `toml:"soa"`
	Ns       *Ns     `toml:"ns"`
}

DNS is a the toplevel collection of times returned when the config is parsed

type Domain

type Domain struct {
	Domain        string `toml:"domain"`
	ReverseDomain string `toml:"reverse_domain"`
	Prefix        string `toml:"prefix"`
	Mask          int    `toml:"mask"`
	ResponseType  string `toml:"response_type"`
}

Domain is the structure used to represent domain configurations in the config file

type Ns

type Ns struct {
	Servers []string `toml:"servers"`
}

Ns is a list of Nameservers returned when an NS record is returned

type Soa

type Soa struct {
	TTL     int    `toml:"ttl"`
	Refresh int    `toml:"refresh"`
	Retry   int    `toml:"retry"`
	Expire  int    `toml:"expire"`
	Minimum int    `toml:"minimum"`
	Mname   string `toml:"mname"`
	Rname   string `toml:"rname"`
}

Soa contains the parameters for the SOA record returned for this domain

func (*Soa) String

func (soa *Soa) String(domain string) string

String returns formatted string for an SOA record

Jump to

Keyboard shortcuts

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