libdctlint

package
v0.0.0-...-9ba10be Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package libdctlint provides a library to check/lint Domain Connect service provider template.

Check results are communicated via zerolog messages in interactive mode, or via a DCTLMessage list when library mode is active (SetLib(true)).

Index

Constants

View Source
const (
	TypeNS         uint16 = 2
	TypeCNAME      uint16 = 5
	TypeNULL       uint16 = 10
	TypeTXT        uint16 = 16
	TypeSRV        uint16 = 33
	TypeTLSA       uint16 = 52
	TypeSMIMEA     uint16 = 53
	TypeOPENPGPKEY uint16 = 61
	TypeSVCB       uint16 = 64
	TypeHTTPS      uint16 = 65
	TypeURI        uint16 = 256
)
View Source
const MaxTTL = (1 << 31) - 1 // 2147483647

Variables

This section is empty.

Functions

func ProjectVersion

func ProjectVersion() uint

ProjectVersion returns the dc-template-linter project version number.

Types

type Conf

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

Conf holds template checking instructions. The field type FileName must be updated each time CheckTemplate() is called to match with the bufio.Reader argument.

func NewConf

func NewConf() *Conf

NewConf will create template check configuration.

func (*Conf) CheckTemplate

func (conf *Conf) CheckTemplate(f *bufio.Reader) exitvals.CheckSeverity

CheckTemplate takes bufio.Reader as an argument and will run template checks according to the Conf configuration. Please remember to set conf.fileName appropriately before calling this function to avoid confusing results.

In library mode (SetLib(true)) all DCTL messages are stored and accessible via GetMessages() after this call returns.

func (*Conf) GetAndCheckTemplate

func (conf *Conf) GetAndCheckTemplate(f *bufio.Reader) (internal.Template, exitvals.CheckSeverity)

GetAndCheckTemplate is used in dctweb. Do not use applications outside of this project.

func (*Conf) GetMessages

func (c *Conf) GetMessages() []DCTLMessage

GetMessages returns the list of DCTL messages captured during the most recent CheckTemplate() call when library mode is active (SetLib(true)). The slice is reset at the start of each CheckTemplate() call.

func (*Conf) GetToleration

func (c *Conf) GetToleration() zerolog.Level

func (*Conf) SetCheckLogos

func (c *Conf) SetCheckLogos(b bool) *Conf

func (*Conf) SetCloudflare

func (c *Conf) SetCloudflare(b bool) *Conf

func (*Conf) SetFilename

func (c *Conf) SetFilename(fn string) *Conf

func (*Conf) SetIncrement

func (c *Conf) SetIncrement(b bool) *Conf

func (*Conf) SetIndent

func (c *Conf) SetIndent(i uint) *Conf

func (*Conf) SetInplace

func (c *Conf) SetInplace(b bool) *Conf

func (*Conf) SetLib

func (c *Conf) SetLib(b bool) *Conf

SetLib enables or disables library mode. When enabled, CheckTemplate() captures DCTL messages to an internal list instead of writing to the zerolog global logger. Captured messages are accessible via GetMessages().

func (*Conf) SetLogger

func (c *Conf) SetLogger(l zerolog.Logger) *Conf

func (*Conf) SetMergeOrFail

func (c *Conf) SetMergeOrFail(b bool) *Conf

func (*Conf) SetPrettyPrint

func (c *Conf) SetPrettyPrint(b bool) *Conf

func (*Conf) SetTTL

func (c *Conf) SetTTL(t uint32) *Conf

func (*Conf) SetToleration

func (c *Conf) SetToleration(s string) *Conf

type DCTLMessage

type DCTLMessage struct {
	Code    internal.DCTL
	Level   zerolog.Level
	Message string
}

DCTLMessage holds a captured linting message produced during a library-mode template check. Code is the DCTL code that triggered the message, Level is its zerolog severity, and Message is the JSON-encoded zerolog event string.

Jump to

Keyboard shortcuts

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