config

package
v0.0.0-...-6b33518 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: AGPL-3.0-or-later Imports: 20 Imported by: 18

Documentation

Index

Constants

View Source
const AddFriendConfigVersion = 2
View Source
const DialingConfigVersion = 1
View Source
const SignedConfigVersion = 1

Variables

View Source
var StdClient = &Client{
	ConfigServerURL: "https://configs.vuvuzela.io",
}

Functions

func RegisterService

func RegisterService(service string, innerConfigType InnerConfig)

func VerifyConfigChain

func VerifyConfigChain(configs ...*SignedConfig) error

Types

type AddFriendConfig

type AddFriendConfig struct {
	Version     int
	Coordinator CoordinatorConfig
	PKGServers  []pkg.PublicServerConfig
	MixServers  []mixnet.PublicServerConfig
	CDNServer   CDNServerConfig
	Registrar   RegistrarConfig
}

func (*AddFriendConfig) MarshalJSON

func (c *AddFriendConfig) MarshalJSON() ([]byte, error)

func (*AddFriendConfig) UnmarshalJSON

func (c *AddFriendConfig) UnmarshalJSON(data []byte) error

func (*AddFriendConfig) UseLatestVersion

func (c *AddFriendConfig) UseLatestVersion()

func (*AddFriendConfig) Validate

func (c *AddFriendConfig) Validate() error

type CDNServerConfig

type CDNServerConfig struct {
	Key     ed25519.PublicKey
	Address string
}

func (CDNServerConfig) MarshalEasyJSON

func (v CDNServerConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CDNServerConfig) MarshalJSON

func (v CDNServerConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CDNServerConfig) UnmarshalEasyJSON

func (v *CDNServerConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CDNServerConfig) UnmarshalJSON

func (v *CDNServerConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Client

type Client struct {
	ConfigServerURL string
}

func (*Client) CurrentConfig

func (c *Client) CurrentConfig(service string) (*SignedConfig, error)

func (*Client) FetchAndVerifyChain

func (c *Client) FetchAndVerifyChain(have *SignedConfig, want string) ([]*SignedConfig, error)

FetchAndVerifyChain fetches and verifies a config chain starting with the have config and ending with the want config. The chain is returned in reverse order so chain[0].Hash() = want and chain[len(chain)-1] = have.

func (*Client) SetCurrentConfig

func (c *Client) SetCurrentConfig(conf *SignedConfig) error

type CoordinatorConfig

type CoordinatorConfig struct {
	Key     ed25519.PublicKey
	Address string
}

func (CoordinatorConfig) MarshalEasyJSON

func (v CoordinatorConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CoordinatorConfig) MarshalJSON

func (v CoordinatorConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CoordinatorConfig) UnmarshalEasyJSON

func (v *CoordinatorConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CoordinatorConfig) UnmarshalJSON

func (v *CoordinatorConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DialingConfig

type DialingConfig struct {
	Version     int
	Coordinator CoordinatorConfig
	MixServers  []mixnet.PublicServerConfig
	CDNServer   CDNServerConfig
}

func (*DialingConfig) MarshalJSON

func (c *DialingConfig) MarshalJSON() ([]byte, error)

func (*DialingConfig) UnmarshalJSON

func (c *DialingConfig) UnmarshalJSON(data []byte) error

func (*DialingConfig) UseLatestVersion

func (c *DialingConfig) UseLatestVersion()

func (*DialingConfig) Validate

func (c *DialingConfig) Validate() error

type Guardian

type Guardian struct {
	Username string
	Key      ed25519.PublicKey
}

func (Guardian) MarshalEasyJSON

func (v Guardian) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Guardian) MarshalJSON

func (v Guardian) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Guardian) UnmarshalEasyJSON

func (v *Guardian) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Guardian) UnmarshalJSON

func (v *Guardian) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type InnerConfig

type InnerConfig interface {
	Validate() error

	UseLatestVersion()
}

type RegistrarConfig

type RegistrarConfig struct {
	Key     ed25519.PublicKey
	Address string
}

func (RegistrarConfig) MarshalEasyJSON

func (v RegistrarConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RegistrarConfig) MarshalJSON

func (v RegistrarConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RegistrarConfig) UnmarshalEasyJSON

func (v *RegistrarConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RegistrarConfig) UnmarshalJSON

func (v *RegistrarConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Server

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

func CreateServer

func CreateServer(persistPath string) (*Server, error)

func LoadServer

func LoadServer(persistPath string) (*Server, error)

func (*Server) CurrentConfig

func (srv *Server) CurrentConfig(service string) (*SignedConfig, string)

CurrentConfig returns the server's current config and its hash. The result must not be modified.

func (*Server) ServeHTTP

func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) SetCurrentConfig

func (srv *Server) SetCurrentConfig(config *SignedConfig) error

type SignedConfig

type SignedConfig struct {
	Version int

	// Service is the name of the service this config corresponds to
	// (e.g., "AddFriend", "Dialing", or "Convo").
	Service string

	Created        time.Time
	Expires        time.Time
	PrevConfigHash string

	// Inner is the configuration specific to a service. The type of
	// the inner config should correspond to the the service name in
	// the signed config.
	Inner InnerConfig

	// Guardians is the set of keys that must sign the next config
	// to replace this config.
	Guardians []Guardian

	// Signatures is a map from base32-encoded signing keys to signatures.
	Signatures map[string][]byte
}

SignedConfig is an entry in a hash chain of configs.

func (*SignedConfig) Hash

func (c *SignedConfig) Hash() string

func (*SignedConfig) MarshalJSON

func (c *SignedConfig) MarshalJSON() ([]byte, error)

func (*SignedConfig) SigningMessage

func (c *SignedConfig) SigningMessage() []byte

func (*SignedConfig) UnmarshalJSON

func (c *SignedConfig) UnmarshalJSON(data []byte) error

func (*SignedConfig) Validate

func (c *SignedConfig) Validate() error

func (*SignedConfig) Verify

func (c *SignedConfig) Verify() error

Jump to

Keyboard shortcuts

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