zonefile

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 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:"
	TypeScion         = ":scion:"
	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 = 209
View Source
const ZFPPrivate = 57344

Variables

View Source
var (
	ZFPDebug        = 0
	ZFPErrorVerbose = false
)
View Source
var ZFPAct = [...]int{}/* 209 elements not displayed */
View Source
var ZFPChk = [...]int{}/* 164 elements not displayed */
View Source
var ZFPDef = [...]int{}/* 164 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{}/* 164 elements not displayed */
View Source
var ZFPPgo = [...]int{

	0, 208, 207, 206, 205, 204, 65, 203, 202, 201,
	200, 1, 199, 2, 3, 198, 197, 196, 195, 194,
	193, 192, 191, 190, 189, 188, 187, 186, 185, 184,
	0, 101, 183, 66, 182, 4, 181, 180, 179, 178,
	177, 122,
}
View Source
var ZFPR1 = [...]int{

	0, 41, 3, 3, 3, 3, 3, 1, 1, 2,
	10, 10, 4, 4, 5, 6, 6, 6, 6, 9,
	9, 7, 7, 8, 39, 39, 39, 40, 40, 40,
	40, 11, 11, 12, 12, 13, 13, 14, 14, 14,
	14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
	14, 15, 29, 29, 30, 30, 30, 30, 30, 30,
	30, 30, 30, 30, 30, 30, 30, 30, 17, 16,
	18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
	28, 36, 36, 37, 37, 38, 38, 38, 38, 38,
	38, 38, 35, 35, 31, 32, 32, 33, 33, 34,
}
View Source
var ZFPR2 = [...]int{

	0, 1, 0, 2, 2, 2, 2, 1, 2, 6,
	0, 2, 1, 2, 7, 2, 2, 2, 2, 0,
	2, 1, 2, 7, 1, 1, 1, 1, 1, 1,
	1, 1, 2, 5, 7, 1, 2, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 5, 1, 2, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
	2, 2, 4, 2, 5, 4, 2, 2, 4, 4,
	6, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 2, 3, 1, 2, 1, 2, 6,
}
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, 46,
}
View Source
var ZFPTok3 = [...]int{
	0,
}
View Source
var ZFPToknames = [...]string{
	"$end",
	"error",
	"$unk",
	"ID",
	"assertionType",
	"shardType",
	"pshardType",
	"zoneType",
	"nameType",
	"ip4Type",
	"ip6Type",
	"scionType",
	"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 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(s 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
}

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

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