auth

package
v0.0.0-...-b5aa0b6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package auth supports Tao authorization and authentication, primarily by defining and implementing a logic for describing principals, their trust relationships, and their beliefs.

The grammar for a formula in the logic is roughly:

Form ::= Term [from Time] [until Time] says Form
       | Term speaksfor Term
       | forall TermVar : Form
       | exists TermVar : Form
       | Form implies Form
       | Form or Form or ...
       | Form and Form and ...
       | not Form
       | Pred | false | true

Quantification variables range over Terms.

TermVar : Identifier

Times are integers interpreted as 64-bit unix timestamps.

Time ::= int64

Predicates are like boolean-valued pure functions, with a name and zero or more terms as arguments.

Pred ::= Identifier(Term, Term, ...)
       | Identifier()

Terms are concrete values, like strings, integers, or names of principals.

Term ::= Str | Bytes | Int | Prin | PrinTail | TermVar

Int can be any Go int. Str is a double-quoted Go string. Bytes is written as pairs of hex digits, optionally separated by whitespace, between square brackets. Bytes can also be written as base64w without whitespace between curly braces.

Principal names specify a key or a tpm, and zero or more extensions to specify a sub-principal of that key.

PrinType ::= key | tpm
Prin ::= PrinType(Term)
       | PrinType(Term).PrinExt.PrinExt...
PrinExt ::= Identifier(Term, Term, ...)
          | Identifier()

Principal tails represent a sequence of extensions that are not rooted in a principal. They are used to make statements about authorized extensions independent of the root principal. For example, they are used to specify that a given program is authorized to execute on any platform. A PrinTail must be followed by at least one extension.

PrinTail ::= ext.PrinExt.PrinExt...

Identifiers for predicate and principal extension names and quantification variables are limited to simple ascii printable identifiers, with inital upper-case, and no punctuation except '_':

PredName ::= [A-Z][a-zA-Z0-9_]*
ExtName ::= [A-Z][a-zA-Z0-9_]*

The keywords used in the above grammar are:

from, until, says, speaskfor, forall, exists, implies, or, and, not, false,
true, key

The punctuation used are those for strings and byte slices, plus:

'(', ')', ',', '.', ':'

It is possible to represent nonsensical formulas, so some sanity checking may be called for. For example, in general:

  1. The left operand of Says should be Prin or TermVar, as should both operands of Speaksfor.
  2. All TermVar variables should be bound.
  3. Conjunctions should have at least one conjunct.
  4. Disjunctions should have at least one disjunct.
  5. Identifiers should be legal using the above rules.
  6. The parameter for key() should be TermVar or Bytes.

Specific applications may impose additional restrictions on the structure of formulas they accept.

All of the above elements have three distinct representations. The first representation is ast-like, with each element represented by an appropriate Go type, e.g. an int, a string, or a struct containing pointers (or interfaces) for child elements. This representation is meant to be easy to programmatically construct, split apart using type switches, rearrange, traverse, etc.

The second representation is textual, which is convenient for humans but isn't canonical and can involve tricky parsing. When parsing elements from text:

Whitespace is ignored between elements (except around the suprincipal dot
  operator, and before the open paren of a Pred, Prin, or, PrinExt);
For binary operators taking two Forms, the above list shows the productions
  in order of increasing precedence;
In all other cases, operations are parsed left to right;
Parenthesis can be used for specifying precedence explicitly.

When pretty-printing elements to text, a single space is used before and after keywords, commas, and colons. Elements can also be pretty-printed with elision, in which case keys and long strings are truncated.

The third representation is an encoded sequence of bytes. This is meant to be compact, relatively easy to parse, and suitable for passing over sockets, network connections, etc. The encoding format is custom-designed, but is roughly similar to the format used by protobuf.

Several alternative encodings were considered:

Protobuf encoding with protobuf definitions: This would require either
duplicating all Form and Term types as proto definitions, then writing
conversion and validation code. The encoding would likely not be space
efficient, and it would be essentially Tao's only hard dependency on
protobuf.

Protobuf encoding with hand-written encoding/decoding: The goprotobuf
library currently lacks good support for this. Also, protobuf allows
encoded data to be shuffled, making decoding much more complicated than
necessary.

encoding/gob: Not language-agnostic. The self-describing datatype encoding
scheme is probably overkill as well.

strings using textual representation of Form and Term elements: This
pulls into all TCB a somewhat complex lexer and parser. The encoding is
also not space efficient.

The encoding we use instead is meant to be conceptually simple, reasonably space efficient, and simple to decode. And unlike most of the other schemes agove, strictness rather than flexibility is preferred. For example, when decoding a Form used for authorization, unrecognized fields should not be silently skipped, and unexpected types should not be silently coerced.

Each element is encoded as a type tag followed by encodings for one or more values. The tag is encoded as a plain (i.e. not zig-zag encoded) varint, and it determines the meaning, number, and types of the values. Values are encoded according to their type:

An integer or bool is encoded as plain varint.

A string is encoded as a length (plain varint) followed by raw bytes.

A pointer is encoded the same as a boolean optionally followed by a value.

Variable-length slices (e.g. for conjuncts, disjuncts, predicate arguments)
are encoded as a count (plain varint) followed by the encoding for the each
element.

An embedded struct or interface is encoded as a tag and encoded value.

Differences from protobuf:

Our tags carry implicit type information. In protobuf, the low 3 bits of
each tag carries an explicit type marker. That allows protobuf to skip over
unrecognized fields (not a design goal for us). It also means protobuf can
only handle 15 unique tags before overflowing to 2 byte encodings.

Our tags describe both the meaning and the type of all enclosed values, and
we use tags only when the meaning or type can vary (i.e. for interface
types). Protobuf uses tags for every enclosed value, and those tags also
carry type information. Protobuf is more efficient when there are many
optional fields. For us, nearly all fields are required.

Enclosed values in our encoding must appear in order. Protobuf values can
appear in any order. Protobuf encodings can concatenated, truncated, etc.,
all non-features for us.

Note: In most cases, a tag appears only when the type would be ambiguous, i.e. when encoding Term or Form.

Index

Constants

This section is empty.

Variables

View Source
var ElisionCutoff int = 32

ElisionCutoff is the maximum length a String or Byte can be without being elided.

View Source
var ElisionLength int = 24

ElisionLength is the number of characters to show in an elided String or Byte.

Functions

func Marshal

func Marshal(e LogicElement) []byte

Marshal encodes a Form or Term.

func SubprinOrIdentical

func SubprinOrIdentical(child, parent Term) bool

SubprinOrIdentical checks whether child is a subprincipal of parent or is identical to parent.

Types

type And

type And struct {
	Conjunct []Form
}

And conveys formula "Conjunct[0] and Conjunct[1] and ... and Conjunct[n]"

func (And) Format

func (f And) Format(out fmt.State, verb rune)

Format outputs a pretty-printed And.

func (And) Marshal

func (f And) Marshal(buf *Buffer)

Marshal encodes an And.

func (*And) Scan

func (f *And) Scan(state fmt.ScanState, verb rune) error

Scan parses an And, with required outer parens. This function is not greedy.

func (And) ShortString

func (e And) ShortString() string

ShortString returns an elided pretty-printed And.

func (And) String

func (e And) String() string

String returns a pretty-printed And.

type AnyForm

type AnyForm struct {
	Form Form
}

AnyForm is a struct that can be used in when scanning for a Form, since Form itself is an interface and interface pointers are not valid receivers. TODO(kwalsh) Can this be accomplished with a pointer to interface?

func (*AnyForm) Scan

func (f *AnyForm) Scan(state fmt.ScanState, verb rune) error

Scan parses a Form, with optional outer parens. This function is not greedy: it consumes only as much input as necessary to obtain a valid formula. For example, "(p says a and b ...)" and "p says (a and b ...) will be parsed in their entirety, but given "p says a and b ... ", only "p says a" will be parsed.

type AnyTerm

type AnyTerm struct {
	Term Term
}

AnyTerm is a struct that can be used in when scanning for a Term, since Term itself is an interface and interface pointers are not valid receivers. TODO(kwalsh) Can this be accomplished with a pointer to interface?

func (*AnyTerm) Scan

func (t *AnyTerm) Scan(state fmt.ScanState, verb rune) error

Scan parses a Term, with optional outer parens.

type Buffer

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

Buffer holds partially encoded or decode auth elemnts. Note: We could do capacity-doubling, etc., but we favor simplicity for now.

func (*Buffer) Bytes

func (buf *Buffer) Bytes() []byte

Bytes returns the unconsumed portion of the buffer.

func (*Buffer) DecodeBool

func (buf *Buffer) DecodeBool() (bool, error)

DecodeBool calls DecodeVarint then converts the result to a bool.

func (*Buffer) DecodeString

func (buf *Buffer) DecodeString() (string, error)

DecodeString decodes a string, shrinking the buffer.

func (*Buffer) DecodeVarint

func (buf *Buffer) DecodeVarint() (int64, error)

DecodeVarint decodes an int, shrinking the buffer.

func (*Buffer) EncodeBool

func (buf *Buffer) EncodeBool(b bool)

EncodeBool converts b to an int then calls EncodeVarint.

func (*Buffer) EncodeString

func (buf *Buffer) EncodeString(s string)

EncodeString encodes a string as a length and byte array, growing the buffer.

func (*Buffer) EncodeVarint

func (buf *Buffer) EncodeVarint(i int64)

EncodeVarint encodes an int as a (non zig-zag) varint, growing the buffer.

type Bytes

type Bytes []byte

Bytes is a byte slice used as a Term.

func (Bytes) Format

func (t Bytes) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Bytes.

func (Bytes) Identical

func (t Bytes) Identical(other Term) bool

Identical checks if a Bytes is identical to another Term.

func (Bytes) Marshal

func (t Bytes) Marshal(buf *Buffer)

Marshal encodes a Bytes.

func (*Bytes) Scan

func (t *Bytes) Scan(state fmt.ScanState, verb rune) error

Scan parses a Bytes, with optional outer parens.

func (Bytes) ShortString

func (e Bytes) ShortString() string

ShortString returns a pretty-printed Bytes.

func (Bytes) String

func (e Bytes) String() string

String returns a pretty-printed Bytes.

type Const

type Const bool

Const conveys formula "true" or formula "false"

func (Const) Format

func (f Const) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Const.

func (Const) Marshal

func (f Const) Marshal(buf *Buffer)

Marshal encodes a Const.

func (*Const) Scan

func (f *Const) Scan(state fmt.ScanState, verb rune) error

Scan parses a Const, with optional outer parens. This function is not greedy.

func (Const) ShortString

func (e Const) ShortString() string

ShortString returns an elided pretty-printed Const.

func (Const) String

func (e Const) String() string

String returns a pretty-printed Const.

type Exists

type Exists struct {
	Var  string
	Body Form
}

Exists conveys formula "(exists Var : Body)" where Var ranges over Terms.

func (Exists) Format

func (f Exists) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Exists.

func (Exists) Marshal

func (f Exists) Marshal(buf *Buffer)

Marshal encodes an Exists.

func (*Exists) Scan

func (f *Exists) Scan(state fmt.ScanState, verb rune) error

Scan parses an Exists, with optional outer parens. This function is not greedy.

func (Exists) ShortString

func (e Exists) ShortString() string

ShortString returns an elided pretty-printed Exists.

func (Exists) String

func (e Exists) String() string

String returns a pretty-printed Exists.

type Forall

type Forall struct {
	Var  string
	Body Form
}

Forall conveys formula "(forall Var : Body)" where Var ranges over Terms.

func (Forall) Format

func (f Forall) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Forall.

func (Forall) Marshal

func (f Forall) Marshal(buf *Buffer)

Marshal encodes a Forall.

func (*Forall) Scan

func (f *Forall) Scan(state fmt.ScanState, verb rune) error

Scan parses a Forall, with optional outer parens. This function is not greedy.

func (Forall) ShortString

func (e Forall) ShortString() string

ShortString returns an elided pretty-printed Forall.

func (Forall) String

func (e Forall) String() string

String returns a pretty-printed Forall.

type Form

type Form interface {
	LogicElement
	// contains filtered or unexported methods
}

Form is a formula in the Tao authorization logic.

func UnmarshalForm

func UnmarshalForm(bytes []byte) (Form, error)

UnmarshalForm decodes a Form.

type Implies

type Implies struct {
	Antecedent Form
	Consequent Form
}

Implies conveys formula "Antecedent implies Consequent"

func (Implies) Format

func (f Implies) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Implies.

func (Implies) Marshal

func (f Implies) Marshal(buf *Buffer)

Marshal encodes an Implies.

func (*Implies) Scan

func (f *Implies) Scan(state fmt.ScanState, verb rune) error

Scan parses an Implies, with required outer parens. This function is not greedy.

func (Implies) ShortString

func (e Implies) ShortString() string

ShortString returns an elided pretty-printed Implies.

func (Implies) String

func (e Implies) String() string

String returns a pretty-printed Implies.

type Int

type Int int

Int is an int used as a Term.

func (Int) Format

func (t Int) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Int.

func (Int) Identical

func (t Int) Identical(other Term) bool

Identical checks if an Int is identical to another Term.

func (Int) Marshal

func (t Int) Marshal(buf *Buffer)

Marshal encodes an Int.

func (*Int) Scan

func (t *Int) Scan(state fmt.ScanState, verb rune) error

Scan parses an Int, with optional outer parens.

func (Int) ShortString

func (e Int) ShortString() string

ShortString returns an elided pretty-printed Int.

func (Int) String

func (e Int) String() string

String returns a pretty-printed Int.

type LogicElement

type LogicElement interface {

	// Marshal writes a binary encoding of the element into b.
	Marshal(b *Buffer)

	// String returns verbose pretty-printing text for the element.
	String() string

	// ShortString returns short debug-printing text for the element.
	ShortString() string

	// fmt.Formatter is satisfied by all elements. Using format %v will result in
	// verbose pretty-printing, using format %s will result in short
	// debug-printing, and other formats will use an unspecified format.
	fmt.Formatter // Format(out fmt.State, verb rune)
	// contains filtered or unexported methods
}

LogicElement is any element of the authorization logic, i.e. a formula, a term, or a principal extension.

type Not

type Not struct {
	Negand Form
}

Not conveys formula "not Negand"

func (Not) Format

func (f Not) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Not.

func (Not) Marshal

func (f Not) Marshal(buf *Buffer)

Marshal encodes a Not.

func (*Not) Scan

func (f *Not) Scan(state fmt.ScanState, verb rune) error

Scan parses a Not, with optional outer parens. This function is not greedy.

func (Not) ShortString

func (e Not) ShortString() string

ShortString returns an elided pretty-printed Not.

func (Not) String

func (e Not) String() string

String returns a pretty-printed Not.

type Or

type Or struct {
	Disjunct []Form
}

Or conveys formula "Disjunct[0] or Disjunct[1] or ... or Disjunct[n]"

func (Or) Format

func (f Or) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Or.

func (Or) Marshal

func (f Or) Marshal(buf *Buffer)

Marshal encodes an Or.

func (*Or) Scan

func (f *Or) Scan(state fmt.ScanState, verb rune) error

Scan parses an Or, with required outer parens. This function is not greedy.

func (Or) ShortString

func (e Or) ShortString() string

ShortString returns an elided pretty-printed Or.

func (Or) String

func (e Or) String() string

String returns a pretty-printed Or.

type Pred

type Pred struct {
	Name string // [A-Z][a-zA-Z0-9_]*
	Arg  []Term
}

Pred is a predicate, i.e. a boolean-valued (pure) function.

func MakePredicate

func MakePredicate(name string, arg ...interface{}) Pred

MakePredicate creates a predicate with the given name and arguments. Arguments can be Prin, Int (or integer types that be coerced to it), Str (or string), or PrinTail. Anything else is coerced to Str.

func (Pred) Format

func (f Pred) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Pred.

func (Pred) Marshal

func (f Pred) Marshal(buf *Buffer)

Marshal encodes a Pred.

func (*Pred) Scan

func (f *Pred) Scan(state fmt.ScanState, verb rune) error

Scan parses a Pred, with optional outer parens.

func (Pred) ShortString

func (e Pred) ShortString() string

ShortString returns an elided pretty-printed Pred.

func (Pred) String

func (e Pred) String() string

String returns a pretty-printed Pred.

type Prin

type Prin struct {
	Type    string  // The keyword of a principal token, e.g. "key" or "tpm".
	KeyHash Term    // TermVar or Bytes with hashed CryptoKey protobuf structure with purpose CryptoKey.VERIFYING. Or this can be a hashed marshalled TPM AIK, or a X.509 certificate, marshalled as ASN.1 DER then hashed.
	Ext     SubPrin // zero or more extensions for descendents
}

Prin uniquely identifies a principal by a public key, used to verify signatures on credentials issued by the principal, and a sequence of zero or more extensions to identify the subprincipal of that key.

func NewKeyPrin

func NewKeyPrin(material []byte) Prin

NewKeyPrin returns a new Prin of type "key" with the given key material.

func NewPrin

func NewPrin(keytype string, material []byte) Prin

NewPrin returns a new Prin with the given key type and material.

func NewTPM2Prin

func NewTPM2Prin(material []byte) Prin

NewTpm2Prin returns a new Prin of type "tpm2" with the given (ek) key material.

func NewTPMPrin

func NewTPMPrin(material []byte) Prin

NewTpmPrin returns a new Prin of type "tpm" with the given (aik) key material.

func UnmarshalPrin

func UnmarshalPrin(bytes []byte) (p Prin, err error)

UnmarshalPrin decodes a Prin.

func (Prin) Format

func (p Prin) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Prin.

func (Prin) Identical

func (t Prin) Identical(other Term) bool

Identical checks if a Prin is identical to another Term.

func (Prin) MakeSubprincipal

func (t Prin) MakeSubprincipal(e SubPrin) Prin

MakeSubprincipal creates principal p.e... given principal p and extensions e.

func (Prin) Marshal

func (t Prin) Marshal(buf *Buffer)

Marshal encodes a Prin.

func (*Prin) Scan

func (p *Prin) Scan(state fmt.ScanState, verb rune) error

Scan parses a Prin, with optional outer parens.

func (Prin) ShortString

func (e Prin) ShortString() string

ShortString returns an elided pretty-printed Prin.

func (Prin) String

func (e Prin) String() string

String returns a pretty-printed Prin.

type PrinExt

type PrinExt struct {
	Name string // [A-Z][a-zA-Z0-9_]*
	Arg  []Term
}

PrinExt is an extension of a principal.

func UnmarshalPrinExt

func UnmarshalPrinExt(bytes []byte) (p PrinExt, err error)

UnmarshalPrinExt decodes a PrinExt.

func (PrinExt) Format

func (e PrinExt) Format(out fmt.State, verb rune)

Format outputs a pretty-printed PrinExt.

func (PrinExt) Identical

func (e PrinExt) Identical(other PrinExt) bool

Identical checks if one PrinExt is identical to another.

func (PrinExt) Marshal

func (t PrinExt) Marshal(buf *Buffer)

func (*PrinExt) Scan

func (e *PrinExt) Scan(state fmt.ScanState, verb rune) error

Scan parses a PrinExt.

func (PrinExt) ShortString

func (e PrinExt) ShortString() string

ShortString returns an elided pretty-printed PrinExt.

func (PrinExt) String

func (e PrinExt) String() string

String returns a pretty-printed PrinExt.

type PrinTail

type PrinTail struct {
	Ext SubPrin // one or more extensions
}

A PrinTail is a Term that represents a free-floating sequence of PrinExt values. It represents the tail of a list of Prin extensions. Its textual representation always starts with the keyword "ext".

func UnmarshalPrinTail

func UnmarshalPrinTail(bytes []byte) (p PrinTail, err error)

UnmarshalPrinTail decodes a PrinTail.

func (PrinTail) Format

func (p PrinTail) Format(out fmt.State, verb rune)

Format outputs a pretty-printed PrinTail.

func (PrinTail) Identical

func (t PrinTail) Identical(other Term) bool

Identical checks if a PrinTail is identical to another Term.

func (PrinTail) Marshal

func (t PrinTail) Marshal(buf *Buffer)

Marshal encodes a PrinTail.

func (*PrinTail) Scan

func (pt *PrinTail) Scan(state fmt.ScanState, verb rune) error

Scan parses a PrinTail, with optional outer parens.

func (PrinTail) ShortString

func (e PrinTail) ShortString() string

ShortString returns an elided pretty-printed PrinTail.

func (PrinTail) String

func (e PrinTail) String() string

String returns a pretty-printed PrinTail.

type Says

type Says struct {
	Speaker    Term
	Time       *int64 // nil to omit
	Expiration *int64 // nil to omit
	Message    Form
}

Says conveys formula "Speaker from Time until Expiration says Message"

func (Says) Commences

func (f Says) Commences() bool

Commences checks if statement f has a commencement time.

func (Says) Expires

func (f Says) Expires() bool

Expires checks if statement f has an expiration time.

func (Says) Format

func (f Says) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Says.

func (Says) Marshal

func (f Says) Marshal(buf *Buffer)

Marshal encodes a Says.

func (*Says) Scan

func (f *Says) Scan(state fmt.ScanState, verb rune) error

Scan parses a Says, with optional outer parens. This function is not greedy.

func (Says) ShortString

func (e Says) ShortString() string

ShortString returns an elided pretty-printed Says.

func (Says) String

func (e Says) String() string

String returns a pretty-printed Says.

type Speaksfor

type Speaksfor struct {
	Delegate  Term
	Delegator Term
}

Speaksfor conveys formula "Delegate speaksfor Delegator"

func (Speaksfor) Format

func (f Speaksfor) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Speaksfor.

func (Speaksfor) Marshal

func (f Speaksfor) Marshal(buf *Buffer)

Marshal encodes a Speaksfor.

func (*Speaksfor) Scan

func (f *Speaksfor) Scan(state fmt.ScanState, verb rune) error

Scan parses a Speaksfor, with optional outer parens. This function is not greedy.

func (Speaksfor) ShortString

func (e Speaksfor) ShortString() string

ShortString returns an elided pretty-printed Speaksfor.

func (Speaksfor) String

func (e Speaksfor) String() string

String returns a pretty-printed Speaksfor.

type Str

type Str string

Str is a string used as a Term.

func (Str) Format

func (t Str) Format(out fmt.State, verb rune)

Format outputs a pretty-printed Str.

func (Str) Identical

func (t Str) Identical(other Term) bool

Identical checks if a Str is identical to another Term.

func (Str) Marshal

func (t Str) Marshal(buf *Buffer)

Marshal encodes a Str.

func (*Str) Scan

func (t *Str) Scan(state fmt.ScanState, verb rune) error

Scan parses a Str, with optional outer parens.

func (Str) ShortString

func (e Str) ShortString() string

ShortString returns an elided pretty-printed Str.

func (Str) String

func (e Str) String() string

String returns a pretty-printed Str.

type SubPrin

type SubPrin []PrinExt

SubPrin is a series of extensions of a principal.

func UnmarshalSubPrin

func UnmarshalSubPrin(bytes []byte) (SubPrin, error)

UnmarshalSubPrin decodes a SubPrin.

func (SubPrin) Format

func (p SubPrin) Format(out fmt.State, verb rune)

Format outputs a pretty-printed SubPrin.

func (SubPrin) Identical

func (t SubPrin) Identical(other SubPrin) bool

Identical checks if one SubPrin is identical to another.

func (SubPrin) Marshal

func (s SubPrin) Marshal(buf *Buffer)

Marshal encodes a SubPrin.

func (*SubPrin) Scan

func (e *SubPrin) Scan(state fmt.ScanState, verb rune) error

Scan parses a SubPrin.

func (SubPrin) ShortString

func (e SubPrin) ShortString() string

ShortString returns an elided pretty-printed SubPrin.

func (SubPrin) String

func (e SubPrin) String() string

String returns a pretty-printed SubPrin.

type Term

type Term interface {
	LogicElement
	Identical(other Term) bool
	// contains filtered or unexported methods
}

Term is an argument to a predicate or a principal extension.

func UnmarshalTerm

func UnmarshalTerm(bytes []byte) (Term, error)

UnmarshalTerm decodes a Term.

type TermVar

type TermVar string

TermVar is a term-valued variable.

func (TermVar) Format

func (t TermVar) Format(out fmt.State, verb rune)

Format outputs a pretty-printed TermVar.

func (TermVar) Identical

func (t TermVar) Identical(other Term) bool

Identical checks if a TermVar is identical to another Term.

func (TermVar) Marshal

func (t TermVar) Marshal(buf *Buffer)

Marshal encodes a TermVar.

func (*TermVar) Scan

func (t *TermVar) Scan(state fmt.ScanState, verb rune) error

Scan parses a TermVar, with optional outer parens.

func (TermVar) ShortString

func (e TermVar) ShortString() string

ShortString returns an elided pretty-printed TermVar.

func (TermVar) String

func (e TermVar) String() string

String returns a pretty-printed TermVar.

Notes

Bugs

Jump to

Keyboard shortcuts

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