Documentation ¶
Index ¶
- Constants
- Variables
- func APIHandlerStruct(handler interface{}) (interface{}, error)
- func Key(keys []*crypto.Key, name string) *crypto.Key
- type ActorKey
- type ActorKeyData
- type AddCodesParams
- type AddMediatorPublicKeysParams
- type AddMediatorPublicKeysSignedParams
- type AdminSettings
- type Appointment
- type AppointmentsSettings
- type BaseDatabase
- type BookAppointmentParams
- type BookAppointmentSignedParams
- type Booking
- type CancelAppointmentParams
- type CancelAppointmentSignedParams
- type CheckProviderDataParams
- type CheckProviderDataSignedParams
- type ClientSettings
- type CodesData
- type CommandsDefinition
- type CommandsDefinitions
- type CommandsMaker
- type ConfirmProviderParams
- type ConfirmProviderSignedParams
- type Context
- type CorsSettings
- type Database
- type DatabaseDefinition
- type DatabaseDefinitions
- type DatabaseMaker
- type DatabaseOps
- type DatabaseSettings
- type Definitions
- type DeleteSettingsParams
- type Distance
- type GetAppointmentParams
- type GetAppointmentSignedParams
- type GetAppointmentsByZipCodeParams
- type GetKeysParams
- type GetPendingProviderDataParams
- type GetPendingProviderDataSignedParams
- type GetProviderAppointmentsParams
- type GetProviderAppointmentsSignedParams
- type GetSettingsParams
- type GetStatsParams
- type GetTokenParams
- type GetVerifiedProviderDataParams
- type GetVerifiedProviderDataSignedParams
- type HTTPServerSettings
- type JSONRPCServerSettings
- type KeyChain
- type KeyData
- type KeyLists
- type Keys
- type Level
- type List
- type Lock
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) Trace(args ...interface{})
- func (l *Logger) Tracef(format string, args ...interface{})
- func (l *Logger) Warning(args ...interface{})
- func (l *Logger) Warningf(format string, args ...interface{})
- type MailSettings
- type Map
- type Meter
- type MeterDefinition
- type MeterDefinitions
- type MeterMaker
- type MeterSettings
- type Metric
- type MetricSettings
- type MetricsServer
- type Object
- type ProviderAppointments
- type ProviderData
- type ProviderKeyData
- type ProviderQueueData
- type PublishAppointmentsParams
- type PublishAppointmentsSignedParams
- type RESTServerSettings
- type RPCSettings
- type RateLimit
- type Request
- type ResetDBParams
- type ResetDBSignedParams
- type Response
- type Set
- type SetEntry
- type Settings
- type SettingsValidator
- type SignedAppointment
- type SignedKeyData
- type SignedProviderData
- type SignedTokenData
- type SigningSettings
- type Slot
- type SortedSet
- type SortedSetEntry
- type StatsValue
- type StorageSettings
- type StoreProviderDataParams
- type StoreProviderDataSignedParams
- type StoreSettingsParams
- type TLSSettings
- type TimeWindow
- func Day(value int64) TimeWindow
- func Hour(value int64) TimeWindow
- func MakeTimeWindow(t int64, twType string) TimeWindow
- func Minute(value int64) TimeWindow
- func Month(value int64) TimeWindow
- func QuarterHour(value int64) TimeWindow
- func Second(value int64) TimeWindow
- func Week(value int64) TimeWindow
- type TimeWindowFunc
- type TokenData
- type UploadDistancesParams
- type UploadDistancesSignedParams
- type Value
Constants ¶
View Source
const ( PanicLogLevel = Level(log.PanicLevel) FatalLogLevel = Level(log.FatalLevel) ErrorLogLevel = Level(log.ErrorLevel) WarnLogLevel = Level(log.WarnLevel) InfoLogLevel = Level(log.InfoLevel) DebugLogLevel = Level(log.DebugLevel) TraceLogLevel = Level(log.TraceLevel) )
Variables ¶
View Source
var Log = Logger{}
Functions ¶
func APIHandlerStruct ¶ added in v0.0.6
func APIHandlerStruct(handler interface{}) (interface{}, error)
returns a new struct that we can coerce the valid form parameters into
Types ¶
type ActorKey ¶
type ActorKey struct { Data string `json:"data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` // contains filtered or unexported fields }
func (*ActorKey) KeyData ¶
func (a *ActorKey) KeyData() (*ActorKeyData, error)
func (*ActorKey) ProviderKeyData ¶
func (a *ActorKey) ProviderKeyData() (*ProviderKeyData, error)
type ActorKeyData ¶
type AddCodesParams ¶
type AddMediatorPublicKeysSignedParams ¶
type AddMediatorPublicKeysSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *AddMediatorPublicKeysParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type AdminSettings ¶
type AdminSettings struct { Signing *SigningSettings `json:"signing,omitempty"` Client *ClientSettings `json:"client,omitempty"` }
type Appointment ¶
type Appointment struct { Timestamp time.Time `json:"timestamp"` Duration int64 `json:"duration"` Properties map[string]interface{} `json:"properties"` SlotData []*Slot `json:"slotData"` ID []byte `json:"id"` PublicKey []byte `json:"publicKey"` }
func MakeAppointment ¶
func MakeAppointment(timestamp time.Time, slots, duration int64) (*Appointment, error)
func (*Appointment) Sign ¶
func (k *Appointment) Sign(key *crypto.Key) (*SignedAppointment, error)
type AppointmentsSettings ¶
type AppointmentsSettings struct { DataTTLDays int64 `json:"data_ttl_days,omitempty"` HTTP *HTTPServerSettings `json:"http,omitempty"` REST *RESTServerSettings `json:"rest,omitempty"` JSONRPC *JSONRPCServerSettings `json:"jsonrpc,omitempty"` Keys []*crypto.Key `json:"keys,omitempty"` Secret []byte `json:"secret,omitempty"` ProviderCodesEnabled bool `json:"provider_codes_enabled,omitempty"` UserCodesEnabled bool `json:"user_codes_enabled,omitempty"` UserCodesReuseLimit int64 `json:"user_codes_reuse_limit"` ProviderCodesReuseLimit int64 `json:"provider_codes_reuse_limit"` }
type BaseDatabase ¶
type BaseDatabase struct { }
type BookAppointmentParams ¶
type BookAppointmentParams struct { ProviderID []byte `json:"providerID"` ID []byte `json:"id"` EncryptedData *crypto.ECDHEncryptedData `json:"encryptedData"` SignedTokenData *SignedTokenData `json:"signedTokenData"` Timestamp *time.Time `json:"timestamp"` }
type BookAppointmentSignedParams ¶
type BookAppointmentSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *BookAppointmentParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type Booking ¶
type Booking struct { ID []byte `json:"id"` PublicKey []byte `json:"publicKey"` Token []byte `json:"token"` EncryptedData *crypto.ECDHEncryptedData `json:"encryptedData"` }
type CancelAppointmentParams ¶
type CancelAppointmentParams struct { ProviderID []byte `json:"providerID"` SignedTokenData *SignedTokenData `json:"signedTokenData"` ID []byte `json:"id"` }
type CancelAppointmentSignedParams ¶
type CancelAppointmentSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *CancelAppointmentParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type CheckProviderDataParams ¶
type CheckProviderDataSignedParams ¶
type CheckProviderDataSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *CheckProviderDataParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type ClientSettings ¶
type CommandsDefinition ¶
type CommandsDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker CommandsMaker `json:"-"` }
type CommandsDefinitions ¶
type CommandsDefinitions []CommandsDefinition
type ConfirmProviderParams ¶
type ConfirmProviderParams struct { PublicProviderData *SignedProviderData `json:"publicProviderData"` EncryptedProviderData *crypto.ECDHEncryptedData `json:"encryptedProviderData"` SignedKeyData *SignedKeyData `json:"signedKeyData"` }
this data is accessible to the provider, nothing "secret" should be stored here...
type ConfirmProviderSignedParams ¶
type ConfirmProviderSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *ConfirmProviderParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type CorsSettings ¶
type Database ¶
type Database interface { Close() error Open() error Reset() error Lock(lockKey string) (Lock, error) DatabaseOps }
A database can deliver and accept message
type DatabaseDefinition ¶
type DatabaseDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker DatabaseMaker `json:"-"` SettingsValidator SettingsValidator `json:"-"` }
type DatabaseDefinitions ¶
type DatabaseDefinitions map[string]DatabaseDefinition
type DatabaseMaker ¶
type DatabaseOps ¶
type DatabaseSettings ¶
type DatabaseSettings struct { Type string `json:"type"` Settings interface{} }
type Definitions ¶
type Definitions struct { CommandsDefinitions DatabaseDefinitions MeterDefinitions }
func MergeDefinitions ¶
func MergeDefinitions(a, b Definitions) Definitions
func (Definitions) Marshal ¶
func (d Definitions) Marshal() map[string]interface{}
func (Definitions) MarshalJSON ¶
func (d Definitions) MarshalJSON() ([]byte, error)
We perform JSON marshalling manually to gain more flexibility...
type DeleteSettingsParams ¶
type DeleteSettingsParams struct {
ID []byte `json:"id"`
}
type GetAppointmentParams ¶
type GetAppointmentParams struct { ProviderID []byte `json:"providerID"` SignedTokenData *SignedTokenData `json:"signedTokenData"` ID []byte `json:"id"` }
type GetAppointmentSignedParams ¶
type GetAppointmentSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *GetAppointmentParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type GetKeysParams ¶
type GetKeysParams struct { }
type GetPendingProviderDataParams ¶
type GetPendingProviderDataParams struct {
N int64 `json:"n"`
}
type GetPendingProviderDataSignedParams ¶
type GetPendingProviderDataSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *GetPendingProviderDataParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type GetProviderAppointmentsSignedParams ¶
type GetProviderAppointmentsSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *GetProviderAppointmentsParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type GetSettingsParams ¶
type GetSettingsParams struct {
ID []byte `json:"id"`
}
type GetStatsParams ¶
type GetTokenParams ¶
type GetVerifiedProviderDataParams ¶
type GetVerifiedProviderDataParams struct {
N int64 `json:"n"`
}
type GetVerifiedProviderDataSignedParams ¶
type GetVerifiedProviderDataSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *GetVerifiedProviderDataParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type HTTPServerSettings ¶ added in v0.0.6
type HTTPServerSettings struct { TLS *TLSSettings `json:"tls,omitempty"` BindAddress string `json:"bind_address"` TCPRateLimits []*RateLimit `json:"tcp_rate_limits"` }
type JSONRPCServerSettings ¶
type JSONRPCServerSettings struct { Cors *CorsSettings `json:"cors,omitempty"` HTTP *HTTPServerSettings `json:"http,omitempty"` }
Settings for the JSON-RPC server
type KeyData ¶
type KeyData struct { Signing []byte `json:"signing"` Encryption []byte `json:"encryption"` QueueData *ProviderQueueData `json:"queueData"` }
type MailSettings ¶
type MailSettings struct { SmtpHost string `json:"smtp_host"` SmtpPort int64 `json:"smtp_port"` SmtpUser string `json:"smtp_user"` SmtpPassword string `json:"smtp_password"` Sender string `json:"sender"` MailSubject string `json:"mail_subject"` MailTemplate string `json:"mail_template"` MailDelay int64 `json:"mail_delay"` }
type Meter ¶
type Meter interface { // Add the given value to the metric Add(id string, name string, data map[string]string, tw TimeWindow, value int64) error // Add the given value to the metric, but only if the given uid hasn't been counted yet AddOnce(id string, name string, uid string, data map[string]string, tw TimeWindow, value int64) error // Add the maximum value to the metric AddMax(id string, name string, uid string, data map[string]string, tw TimeWindow, value int64) error // Return the metric and its assigned quota Get(id string, name string, data map[string]string, tw TimeWindow) (*Metric, error) // Return metrics for a given ID and time interval Range(id string, from, to int64, name, twType string) ([]*Metric, error) N(id string, to int64, n int64, name, twType string) ([]*Metric, error) }
type MeterDefinition ¶
type MeterDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker MeterMaker `json:"-"` SettingsValidator SettingsValidator `json:"-"` }
type MeterDefinitions ¶
type MeterDefinitions map[string]MeterDefinition
type MeterMaker ¶
type MeterSettings ¶
type MeterSettings struct { Type string `json:"type"` Settings interface{} }
type Metric ¶
type Metric struct { Name string TimeWindow TimeWindow Value int64 Data map[string]string }
type MetricSettings ¶
type MetricSettings struct {
BindAddress string `json:"bind_address"`
}
type MetricsServer ¶
type ProviderAppointments ¶
type ProviderAppointments struct { Provider *SignedProviderData `json:"provider"` Offers []*SignedAppointment `json:"offers"` Booked [][]byte `json:"booked"` KeyChain *KeyChain `json:"keyChain"` }
type ProviderData ¶
type ProviderData struct { Name string `json:"name"` Street string `json:"street"` City string `json:"city"` ZipCode string `json:"zipCode"` Description string `json:"description"` }
func (*ProviderData) Sign ¶
func (k *ProviderData) Sign(key *crypto.Key) (*SignedProviderData, error)
type ProviderKeyData ¶
type ProviderKeyData struct { Encryption []byte `json:"encryption"` Signing []byte `json:"signing"` QueueData *ProviderQueueData `json:"queueData"` Timestamp *time.Time `json:"timestamp,omitempty"` }
type ProviderQueueData ¶
type PublishAppointmentsParams ¶
type PublishAppointmentsParams struct { Timestamp *time.Time `json:"timestamp"` Offers []*SignedAppointment `json:"offers"` }
type PublishAppointmentsSignedParams ¶
type PublishAppointmentsSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *PublishAppointmentsParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type RESTServerSettings ¶ added in v0.0.6
type RESTServerSettings struct { Cors *CorsSettings `json:"cors,omitempty"` HTTP *HTTPServerSettings `json:"http,omitempty"` }
Settings for the JSON-RPC server
type RPCSettings ¶
type RPCSettings struct {
BindAddress string `json:"bind_address"`
}
type RateLimit ¶ added in v0.0.6
type RateLimit struct { TimeWindow *TimeWindow `json:"timeWindow"` Type string `json:"type"` Limit int64 `json:"limit"` }
type ResetDBParams ¶ added in v0.0.4
type ResetDBSignedParams ¶ added in v0.0.4
type ResetDBSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *ResetDBParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type Settings ¶
type Settings struct { Test bool `json:"test,omitempty"` Admin *AdminSettings `json:"admin,omitempty"` Definitions *Definitions `json:"definitions,omitempty"` Storage *StorageSettings `json:"storage,omitempty"` Appointments *AppointmentsSettings `json:"appointments,omitempty"` Database *DatabaseSettings `json:"database,omitempty"` Meter *MeterSettings `json:"meter,omitempty"` Metrics *MetricSettings `json:"metrics,omitempty"` DatabaseObj Database `json:"-"` MeterObj Meter `json:"-"` MetricsObj MetricsServer `json:"-"` }
type SettingsValidator ¶
type SignedAppointment ¶
type SignedAppointment struct { UpdatedAt time.Time `json:"updatedAt"` Bookings []*Booking `json:"bookings"` // only for providers BookedSlots []*Slot `json:"bookedSlots"` // for users JSON string `json:"data" coerce:"name:json"` Data *Appointment `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type SignedKeyData ¶
type SignedProviderData ¶
type SignedProviderData struct { JSON string `json:"data" coerce:"name:json"` Data *ProviderData `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` ID []byte `json:"id"` }
type SignedTokenData ¶
type SigningSettings ¶
type SortedSet ¶
type SortedSet interface { Object Del([]byte) (bool, error) Add([]byte, int64) error Range(int64, int64) ([]*SortedSetEntry, error) RangeByScore(int64, int64) ([]*SortedSetEntry, error) At(int64) (*SortedSetEntry, error) Score([]byte) (int64, error) PopMin(int64) ([]*SortedSetEntry, error) RemoveRangeByScore(int64, int64) error }
type SortedSetEntry ¶
type StatsValue ¶
type StorageSettings ¶
type StorageSettings struct { Keys []*crypto.Key `json:"keys,omitempty"` SettingsTTLDays int64 `json:"settings_ttl_days"` HTTP *HTTPServerSettings `json:"http,omitempty"` JSONRPC *JSONRPCServerSettings `json:"jsonrpc,omitempty"` REST *RESTServerSettings `json:"rest,omitempty"` }
type StoreProviderDataParams ¶
type StoreProviderDataParams struct { EncryptedData *crypto.ECDHEncryptedData `json:"encryptedData"` Code []byte `json:"code"` }
type StoreProviderDataSignedParams ¶
type StoreProviderDataSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *StoreProviderDataParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
type StoreSettingsParams ¶
type StoreSettingsParams struct { ID []byte `json:"id"` Data interface{} `json:"data"` }
type TLSSettings ¶
type TimeWindow ¶
func Day ¶
func Day(value int64) TimeWindow
func Hour ¶
func Hour(value int64) TimeWindow
func MakeTimeWindow ¶
func MakeTimeWindow(t int64, twType string) TimeWindow
func Minute ¶
func Minute(value int64) TimeWindow
func Month ¶
func Month(value int64) TimeWindow
func QuarterHour ¶
func QuarterHour(value int64) TimeWindow
func Second ¶
func Second(value int64) TimeWindow
func Week ¶
func Week(value int64) TimeWindow
func (*TimeWindow) Copy ¶
func (t *TimeWindow) Copy() TimeWindow
func (*TimeWindow) EqualTo ¶ added in v0.0.6
func (t *TimeWindow) EqualTo(tw *TimeWindow) bool
func (*TimeWindow) IncreaseBy ¶
func (t *TimeWindow) IncreaseBy(n int64)
type TimeWindowFunc ¶
type TimeWindowFunc func(int64) TimeWindow
type TokenData ¶
type UploadDistancesParams ¶
type UploadDistancesSignedParams ¶
type UploadDistancesSignedParams struct { JSON string `json:"data" coerce:"name:json"` Data *UploadDistancesParams `json:"-" coerce:"name:data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.