zonefile

package
v0.0.0-...-682d07f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAssertion     = ":A:"
	TypeShard         = ":S:"
	TypePshard        = ":P:"
	TypeZone          = ":Z:"
	TypeSignature     = ":sig:"
	TypeName          = ":name:"
	TypeIP6           = ":ip6:"
	TypeIP4           = ":ip4:"
	TypeRedirection   = ":redir:"
	TypeDelegation    = ":deleg:"
	TypeNameSet       = ":nameset:"
	TypeCertificate   = ":cert:"
	TypeServiceInfo   = ":srv:"
	TypeRegistrar     = ":regr:"
	TypeRegistrant    = ":regt:"
	TypeInfraKey      = ":infra:"
	TypeExternalKey   = ":extra:"
	TypeNextKey       = ":next:"
	TypeEd25519       = ":ed25519:"
	TypeUnspecified   = ":unspecified:"
	TypePTTLS         = ":tls:"
	TypeCUTrustAnchor = ":trustAnchor:"
	TypeCUEndEntity   = ":endEntity:"
	TypeNoHash        = ":noHash:"
	TypeSha256        = ":sha256:"
	TypeSha384        = ":sha384:"
	TypeSha512        = ":sha512:"
	TypeShake256      = ":shake256:"
	TypeFnv64         = ":fnv64:"
	TypeFnv128        = ":fnv128:"
	TypeKM12          = ":bloomKM12:"
	TypeKM16          = ":bloomKM16:"
	TypeKM20          = ":bloomKM20:"
	TypeKM24          = ":bloomKM24:"
	TypeKSRains       = ":rains:"
)
View Source
const ID = 57346
View Source
const ZFPEofCode = 1
View Source
const ZFPErrCode = 2
View Source
const ZFPFlag = -1000
View Source
const ZFPInitialStackSize = 16
View Source
const ZFPLast = 212
View Source
const ZFPPrivate = 57344

Variables

View Source
var (
	ZFPDebug        = 0
	ZFPErrorVerbose = false
)
View Source
var ZFPAct = [...]int{}/* 212 elements not displayed */
View Source
var ZFPChk = [...]int{}/* 184 elements not displayed */
View Source
var ZFPDef = [...]int{}/* 184 elements not displayed */
View Source
var ZFPErrorMessages = [...]struct {
	state int
	token int
	msg   string
}{}
View Source
var ZFPExca = [...]int{
	-1, 1,
	1, -1,
	-2, 0,
}
View Source
var ZFPPact = [...]int{}/* 184 elements not displayed */
View Source
var ZFPPgo = [...]int{

	0, 211, 210, 209, 208, 207, 59, 206, 205, 204,
	203, 1, 202, 2, 201, 200, 199, 198, 197, 196,
	195, 194, 193, 192, 191, 190, 189, 57, 49, 40,
	39, 32, 29, 21, 26, 24, 22, 18, 19, 17,
	188, 0, 119, 187, 37, 186, 3, 185, 184, 183,
	182, 181, 143,
}
View Source
var ZFPR1 = [...]int{}/* 121 elements not displayed */
View Source
var ZFPR2 = [...]int{}/* 121 elements not displayed */
View Source
var ZFPStatenames = [...]string{}
View Source
var ZFPTok1 = [...]int{

	1,
}
View Source
var ZFPTok2 = [...]int{

	2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
	12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
	22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
	32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
	42, 43, 44, 45,
}
View Source
var ZFPTok3 = [...]int{
	0,
}
View Source
var ZFPToknames = [...]string{
	"$end",
	"error",
	"$unk",
	"ID",
	"assertionType",
	"shardType",
	"pshardType",
	"zoneType",
	"nameType",
	"ip4Type",
	"ip6Type",
	"redirType",
	"delegType",
	"namesetType",
	"certType",
	"srvType",
	"regrType",
	"regtType",
	"infraType",
	"extraType",
	"nextType",
	"sigType",
	"ed25519Type",
	"unspecified",
	"tls",
	"trustAnchor",
	"endEntity",
	"noHash",
	"sha256",
	"sha384",
	"sha512",
	"shake256",
	"fnv64",
	"fnv128",
	"bloomKM12",
	"bloomKM16",
	"bloomKM20",
	"bloomKM24",
	"rains",
	"rangeBegin",
	"rangeEnd",
	"lBracket",
	"rBracket",
	"lParenthesis",
	"rParenthesis",
}

Functions

func AddSigs

func AddSigs(sec section.WithSigForward, signatures []signature.Sig)

AddSigs adds signatures to section

func DecodeCertificate

func DecodeCertificate(ptype object.ProtocolType, usage object.CertificateUsage,
	hashAlgo algorithmTypes.Hash, certificat string) (object.Certificate,
	error)

func DecodeEd25519PublicKeyData

func DecodeEd25519PublicKeyData(pkeyInput string, keyphase string) (keys.PublicKey, error)

DecodeEd25519PublicKeyData returns the publicKey or an error in case pkeyInput is malformed i.e. it is not in zone file format.

func DecodePublicKeyID

func DecodePublicKeyID(keyphase string) (keys.PublicKeyID, error)

func DecodeSrv

func DecodeSrv(name, portString, priorityString string) (object.ServiceInfo, error)

func DecodeValidity

func DecodeValidity(validSince, validUntil string) (int64, int64, error)

func GetEncoding

func GetEncoding(s section.Section, forSigning bool) string

GetEncoding returns an encoding in zonefile format

func ZFPErrorMessage

func ZFPErrorMessage(state, lookAhead int) string

func ZFPParse

func ZFPParse(ZFPlex ZFPLexer) int

func ZFPStatname

func ZFPStatname(s int) string

func ZFPTokname

func ZFPTokname(c int) string

func ZFPlex1

func ZFPlex1(lex ZFPLexer, lval *ZFPSymType) (char, token int)

Types

type IO

type IO struct{}

Parser can be used to parse and encode RAINS zone files

func (IO) Decode

func (p IO) Decode(zoneFile []byte) ([]section.WithSigForward, error)

Decode returns all assertions contained in the given zonefile

func (IO) DecodeNameQueriesUnsafe

func (p IO) DecodeNameQueriesUnsafe(encoding []byte) []*query.Name

DecodeNameQueriesUnsafe takes as input a byte string of name queries encoded in a format resembling the zone file format. It returns the queries. It panics when the input format is incorrect.

func (IO) Encode

func (p IO) Encode(sections []section.Section) string

Encode returns the given sections represented in the zone file format if it is a zoneSection. In all other cases it returns the sections in a displayable format similar to the zone file format

func (IO) EncodeAndStore

func (p IO) EncodeAndStore(path string, sections []section.Section) error

EncodeAndStore stores the given section represented in zone file format if it is an assertion, shard, pshard, or zone. In all other cases it stores the section in a displayable format similar to the zone file format

func (IO) EncodeSection

func (p IO) EncodeSection(section section.Section) string

EncodeSection returns the given section represented in the zone file format if it is a zoneSection. In all other cases it returns the section in a displayable format similar to the zone file format

func (IO) LoadZonefile

func (p IO) LoadZonefile(path string) ([]section.WithSigForward, error)

LoadZonefile takes as input a path to a file containing a zone in zonefile format. It returns the zone exactly as it is in the zonefile or an error in case of failure.

type WordScanner

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

WordScanner uses bufio.Scanner to scan words of the input. Additionally it keeps track of the line (of the input) on which the scanner currently is

func NewWordScanner

func NewWordScanner(data []byte) *WordScanner

NewWordScanner returns a WordScanner

func (*WordScanner) LineNumber

func (ws *WordScanner) LineNumber() int

LineNumber returns the number of the line of the input data on which the current Token of the scanner is.

func (*WordScanner) Scan

func (ws *WordScanner) Scan() bool

Scan moves the Scanner to the next Token, which will then be available through the Bytes or Text method. False is returned when the scan stops, either by reaching the end of the input or an error.

func (*WordScanner) Text

func (ws *WordScanner) Text() string

Text returns the value of the current Token generated by a call to Scan as a newly allocated string.

func (*WordScanner) TextLine

func (ws *WordScanner) TextLine() string

type ZFPLex

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

func (*ZFPLex) Error

func (l *ZFPLex) Error(s string)

The parser calls this method on a parse error.

func (*ZFPLex) Lex

func (l *ZFPLex) Lex(lval *ZFPSymType) int

type ZFPLexer

type ZFPLexer interface {
	Lex(lval *ZFPSymType) int
	Error(s string)
}

type ZFPParser

type ZFPParser interface {
	Parse(ZFPLexer) int
	Lookahead() int
	Result() []section.WithSigForward
}

func ZFPNewParser

func ZFPNewParser() ZFPParser

type ZFPParserImpl

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

func (*ZFPParserImpl) Lookahead

func (p *ZFPParserImpl) Lookahead() int

func (*ZFPParserImpl) Parse

func (ZFPrcvr *ZFPParserImpl) Parse(ZFPlex ZFPLexer) int

func (*ZFPParserImpl) Result

func (p *ZFPParserImpl) Result() []section.WithSigForward

type ZFPSymType

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

type ZoneFileIO

type ZoneFileIO interface {
	//Decode takes as input a byte string of section(s) in zonefile format. It returns a slice of
	//all contained assertions, shards, and zones in the provided order or an error in case of
	//failure.
	Decode(zoneFile []byte) ([]section.WithSigForward, error)

	//DecodeNameQueriesUnsafe takes as input a byte string of name queries encoded in a format
	//resembling the zone file format. It returns the queries. It panics when the input format is
	//incorrect.
	DecodeNameQueriesUnsafe(encoding []byte) []*query.Name

	//LoadZonefile takes as input a path to a file containing a zone in zonefile
	//format. It returns the zone exactly as it is in the zonefile or an error
	//in case of failure.
	LoadZonefile(path string) ([]section.WithSigForward, error)

	//Encode returns the given sections represented in zone file format if it is an assertion,
	//shard, or zone. In all other cases it returns the sections in a displayable format similar to
	//the zonefile format
	Encode(sections []section.Section) string

	//EncodeSection returns the given section represented in zone file format if it is an assertion,
	//shard, or zone. In all other cases it returns the section in a displayable format similar to
	//the zonefile format
	EncodeSection(section section.Section) string

	//EncodeAndStore stores the given sections represented in zone file format if it is an
	//assertion, shard, pshard, or zone. In all other cases it stores the sections in a displayable
	//format similar to the zone file format
	EncodeAndStore(path string, section []section.Section) error
}

ZoneFileIO is the interface for all parsers of zone files for RAINS

Jump to

Keyboard shortcuts

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