roughtime

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: 21 Imported by: 0

README

Roughtime

This directory contains the roughtime protocol, originally available at https://roughtime.googlesource.com/roughtime/, modified for CloudProxy. The agl_roughtime folder contains the relevant files taken from the original repository.

Documentation

Overview

This contains adapted version of the roughtime client to use Tao.

this is an adapted version of the server code in the roughtime for cloudproxy. this version uses Tao to listen and answer the queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadChain

func LoadChain(jsonData []byte) (chain *config.Chain, err error)

LoadChain loads a JSON-format chain from the given JSON data.

func LoadServers

func LoadServers(jsonData []byte) (servers []config.Server, numSkipped int, err error)

LoadServers loads information about known servers from the given JSON data. It only extracts information about servers with Ed25519 public keys and UDP address. The number of servers skipped because of unsupported requirements is returned in numSkipped.

Types

type Client

type Client struct {
	// Permutation returns a random permutation of [0‥n) that is used to
	// query servers in a random order. If nil, a sensible default is used.
	Permutation func(n int) []int

	// MaxRadiusUs is the maximum interval radius that will be accepted
	// from a server. If zero, a sensible default is used.
	MaxRadius time.Duration

	// MaxDifference is the maximum difference in time between any sample
	// from a server and the quorum-agreed time before that sample is
	// considered suspect. If zero, a sensible default is used.
	MaxDifference time.Duration

	// QueryTimeout is the amount of time a server has to reply to a query.
	// If zero, a sensible default will be used.
	QueryTimeout time.Duration

	// NumQueries is the maximum number of times a query will be sent to a
	// specific server before giving up. If <= zero, a sensible default
	// will be used.
	NumQueries int
	// contains filtered or unexported fields
}

Client represents a Roughtime client and exposes a number of members that can be set in order to configure it. The zero value of a Client is always ready to use and will set sensible defaults.

func NewClient

func NewClient(domainPath, network string, quorum int, servers []config.Server) (*Client, error)

func (*Client) Do

func (c *Client) Do(chain *config.Chain) (*config.Chain, error)

func (*Client) EstablishTime

func (c *Client) EstablishTime(chain *config.Chain, quorum int, servers []config.Server) (TimeResult, error)

EstablishTime queries a number of servers until it has a quorum of overlapping results, or it runs out of servers. Results from the querying the servers are appended to chain.

type Server

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

func NewServer

func NewServer(path, network string, port int, x509Identity *pkix.Name, t tao.Tao) (*Server, error)

func (*Server) ServeForever

func (s *Server) ServeForever() error

type ServerInfo

type ServerInfo struct {
	// QueryDuration is the amount of time that the server took to answer.
	QueryDuration time.Duration

	// Min and Max specify the time window given by the server. These
	// values have been adjusted so that they are comparible across
	// servers, even though they are queried at different times.
	Min, Max *big.Int
}

ServerInfo contains information from a specific server.

type TimeResult

type TimeResult struct {
	// MonoUTCDelta may be nil, in which case a time could not be
	// established. Otherwise it contains the difference between the
	// Roughtime epoch and the monotonic clock.
	MonoUTCDelta *time.Duration

	// ServerErrors maps from server name to query error.
	ServerErrors map[string]error

	// ServerInfo contains information about each server that was queried.
	ServerInfo map[string]ServerInfo

	// OutOfRangeAnswer is true if one or more of the queries contained a
	// significantly incorrect time, as defined by MaxDifference. In this
	// case, the reply will have been recorded in the chain.
	OutOfRangeAnswer bool
}

TimeResult is the result of trying to establish the current time by querying a number of servers.

Directories

Path Synopsis
agl_roughtime
config
Package config contains JSON structs for encoding information about Roughtime servers.
Package config contains JSON structs for encoding information about Roughtime servers.
monotime
Package monotime provides access to the system's monotonic clock.
Package monotime provides access to the system's monotonic clock.
protocol
Package protocol implements the core of the Roughtime protocol.
Package protocol implements the core of the Roughtime protocol.
this is an adapted version of the client code to cnonect to cloudproxy.
this is an adapted version of the client code to cnonect to cloudproxy.
this is an adapted version of the server code in the roughtime for cloudproxy.
this is an adapted version of the server code in the roughtime for cloudproxy.

Jump to

Keyboard shortcuts

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