util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOverlapValidityForSignatures

func GetOverlapValidityForSignatures(sigs []signature.Sig) (int64, int64)

GetOverlapValidityForSignatures returns the union of the validity windows for all signatures Returns 0,0 if no valid window exists (there exist gaps)

func Load

func Load(path string, object interface{}) error

Load fetches the gob encoded object from the file located at path. Make sure that all types that are behind an interface are registered in the init method.

func NewNotificationMessage

func NewNotificationMessage(tok token.Token, t section.NotificationType, data string) message.Message

NewNotificationMessage creates a new message containing one notification body with values obtained from the input parameter

func NewNotificationsMessage

func NewNotificationsMessage(tokens []token.Token, types []section.NotificationType, data []string) (message.Message, error)

NewNotificationsMessage creates a new message containing notification bodies with values obtained from the input parameter

func NewQueryMessage

func NewQueryMessage(name, context string, expTime int64, objType []object.Type,
	queryOptions []query.Option, token token.Token) message.Message

NewQueryMessage creates a new message containing a query body with values obtained from the input parameter

func Save

func Save(path string, object interface{}) error

Save stores the object to the file located at the specified path gob encoded.

func SendQuery

func SendQuery(msg message.Message, addr net.Addr, timeout time.Duration) (
	message.Message, error)

SendQuery creates a connection with connInfo, frames msg and writes it to the connection. It then waits for the response. When it receives the response or times out, it returns the answer or an error.

Types

type MaxCacheValidity

type MaxCacheValidity struct {
	AssertionValidity time.Duration
	ShardValidity     time.Duration
	PshardValidity    time.Duration
	ZoneValidity      time.Duration
}

MaxCacheValidity defines the maximum duration each section containing signatures can be valid, starting from time.Now()

type MsgSectionSender

type MsgSectionSender struct {
	Sender   net.Addr
	Sections []section.Section
	Token    token.Token
}

MsgSectionSender contains the message section section and connection infos about the sender

type SectionWithSigSender

type SectionWithSigSender struct {
	Sender   net.Addr
	Sections []section.WithSigForward
	Token    token.Token
}

SectionWithSigSender contains a section with a signature and connection infos about the sender

Jump to

Keyboard shortcuts

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