Documentation ¶
Index ¶
- Constants
- func NewTokenBoardServer(store storage.MessageStoreInterface, tokenService *privacypass.TokenServer) tapir.Application
- type Config
- func CreateConfig(configDir, filename string, encrypted bool, password string, ...) (*Config, error)
- func LoadConfig(configDir, filename string, encrypted bool, password string) (*Config, error)
- func LoadCreateDefaultConfigFile(configDir, filename string, encrypted bool, password string, ...) (*Config, error)
- func (config *Config) CheckPassword(checkpass string) bool
- func (config *Config) GetAttribute(key string) string
- func (config *Config) GetMaxMessageMBs() int
- func (config *Config) GetMaxMessages() int
- func (config *Config) Identity() primitives.Identity
- func (config *Config) Onion() string
- func (config *Config) Save() error
- func (config *Config) SetAttribute(key, val string)
- func (config *Config) SetMaxMessageMBs(newval int)
- func (config *Config) TokenServiceIdentity() primitives.Identity
- type Reporting
- type Server
- type Servers
- type Statistics
- type TokenboardServer
Constants ¶
const ( // AttrAutostart is the attribute key for autostart setting AttrAutostart = "autostart" // AttrDescription is the attribute key for a user set server description AttrDescription = "description" // AttrStorageType is used by clients that may need info about stored server config types/styles AttrStorageType = "storageType" )
const ( // StorageTypeDefaultPassword is a AttrStorageType that indicated a app default password was used StorageTypeDefaultPassword = "storage-default-password" // StorageTypePassword is a AttrStorageType that indicated a user password was used to protect the profile StorageTypePassword = "storage-password" // StoreageTypeNoPassword is a AttrStorageType that indicated a no password was used to protect the profile StoreageTypeNoPassword = "storage-no-password" )
const MessagesPerMB = 250
messages are ~4kb of storage
const (
// ServerConfigFile is the standard filename for a server's config to be written to in a directory
ServerConfigFile = "serverConfig.json"
)
Variables ¶
This section is empty.
Functions ¶
func NewTokenBoardServer ¶
func NewTokenBoardServer(store storage.MessageStoreInterface, tokenService *privacypass.TokenServer) tapir.Application
NewTokenBoardServer generates new Server for Token Board
Types ¶
type Config ¶
type Config struct { ConfigDir string `json:"-"` FilePath string `json:"-"` Encrypted bool `json:"-"` PublicKey ed25519.PublicKey `json:"publicKey"` PrivateKey ed25519.PrivateKey `json:"privateKey"` TokenServerPublicKey ed25519.PublicKey `json:"tokenServerPublicKey"` TokenServerPrivateKey ed25519.PrivateKey `json:"tokenServerPrivateKey"` TokenServiceK ristretto255.Scalar `json:"tokenServiceK"` ServerReporting Reporting `json:"serverReporting"` Attributes map[string]string `json:"attributes"` // messages are ~4kb of storage // -1 == infinite MaxStorageMBs int `json:"maxStorageMBs"` // contains filtered or unexported fields }
Config is a struct for storing basic server configuration
func CreateConfig ¶
func CreateConfig(configDir, filename string, encrypted bool, password string, defaultLogToFile bool) (*Config, error)
CreateConfig creates a default config and saves it to a json file specified by filename if the encrypted flag is true the config is store encrypted by password
func LoadConfig ¶
LoadConfig loads a Config from a json file specified by filename
func LoadCreateDefaultConfigFile ¶
func LoadCreateDefaultConfigFile(configDir, filename string, encrypted bool, password string, defaultLogToFile bool) (*Config, error)
LoadCreateDefaultConfigFile loads a Config from or creates a default config and saves it to a json file specified by filename if the encrypted flag is true the config is store encrypted by password
func (*Config) CheckPassword ¶
CheckPassword returns true if the given password produces the same key as the current stored key, otherwise false.
func (*Config) GetAttribute ¶
GetAttribute gets a server attribute
func (*Config) GetMaxMessageMBs ¶
func (*Config) GetMaxMessages ¶
GetMaxMessages returns the config setting for Max messages converting from MaxMB to messages or -1 for infinite
func (*Config) Identity ¶
func (config *Config) Identity() primitives.Identity
Identity returns an encapsulation of the servers keys
func (*Config) SetAttribute ¶
SetAttribute sets a server attribute
func (*Config) SetMaxMessageMBs ¶
func (*Config) TokenServiceIdentity ¶
func (config *Config) TokenServiceIdentity() primitives.Identity
TokenServiceIdentity returns an encapsulation of the servers token server (experimental)
type Reporting ¶
type Reporting struct {
LogMetricsToFile bool `json:"logMetricsToFile"`
}
Reporting is a struct for storing a the config a server needs to be a peer, and connect to a group to report
type Server ¶
type Server interface { Identity() primitives.Identity Run(acn connectivity.ACN) error KeyBundle() *model.KeyBundle CheckStatus() (bool, error) Stop() Destroy() GetStatistics() Statistics Delete(password string) error Onion() string ServerBundle() string TofuBundle() string GetAttribute(string) string SetAttribute(string, string) SetMonitorLogging(bool) }
Server encapsulates a complete, compliant Cwtch server.
type Servers ¶
type Servers interface { LoadServers(password string) ([]string, error) CreateServer(password string) (Server, error) GetServer(onion string) Server ListServers() []string DeleteServer(onion string, currentPassword string) error LaunchServer(string) StopServer(string) Stop() Destroy() }
Servers is an interface to manage multiple Cwtch servers Unlike a standalone server, server's dirs will be under one "$CwtchDir/servers" and use a cwtch style localID to obscure what servers are hosted. Users are of course free to use a default password. This means Config file will be encrypted with cwtch/storage/v1/file_enc and monitor files will not be generated
func NewServers ¶
func NewServers(acn connectivity.ACN, directory string) Servers
NewServers returns a Servers interface to manage a collection of servers expecting directory: $CWTCH_HOME/servers
type Statistics ¶
Statistics is an encapsulation of information about the server that an operator might want to know at a glance.
type TokenboardServer ¶
type TokenboardServer struct { applications.AuthApp TokenService *privacypass.TokenServer LegacyMessageStore storage.MessageStoreInterface // contains filtered or unexported fields }
TokenboardServer defines the token board server
func (*TokenboardServer) Init ¶
func (ta *TokenboardServer) Init(connection tapir.Connection)
Init initializes the cryptographic TokenBoardApp
func (*TokenboardServer) Listen ¶
func (ta *TokenboardServer) Listen()
Listen processes the messages for this application
func (*TokenboardServer) NewInstance ¶
func (ta *TokenboardServer) NewInstance() tapir.Application
NewInstance creates a new TokenBoardApp