Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterService(service string, innerConfigType InnerConfig)
- func VerifyConfigChain(configs ...*SignedConfig) error
- type AddFriendConfig
- type CDNServerConfig
- type Client
- type CoordinatorConfig
- type DialingConfig
- type Guardian
- type InnerConfig
- type RegistrarConfig
- type Server
- type SignedConfig
Constants ¶
const AddFriendConfigVersion = 2
const DialingConfigVersion = 1
const SignedConfigVersion = 1
Variables ¶
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 ¶
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 ¶
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 ¶
func (Guardian) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Guardian) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Guardian) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Guardian) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type InnerConfig ¶
type InnerConfig interface { Validate() error UseLatestVersion() }
type RegistrarConfig ¶
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 LoadServer ¶
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) 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