server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigDir       string             `json:"-"`
	MaxBufferLines  int                `json:"maxBufferLines"`
	PublicKey       ed25519.PublicKey  `json:"publicKey"`
	PrivateKey      ed25519.PrivateKey `json:"privateKey"`
	ServerReporting Reporting          `json:"serverReporting"`
}

Config is a struct for storing basic server configuration

func LoadConfig

func LoadConfig(configDir, filename string) Config

LoadConfig loads a Config from a json file specified by filename

func (*Config) Identity

func (config *Config) Identity() identity.Identity

Identity returns an encapsulation of the servers keys for running ricochet

func (*Config) Save

func (config *Config) Save(dir, filename string)

Save dumps the latest version of the config to a json file given by filename

type Instance

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

Instance encapsulates the Ricochet application.

func (*Instance) HandleFetchRequest

func (si *Instance) HandleFetchRequest() []*protocol.GroupMessage

HandleFetchRequest returns a list of all messages in the servers buffer

func (*Instance) HandleGroupMessage

func (si *Instance) HandleGroupMessage(gm *protocol.GroupMessage)

HandleGroupMessage takes in a group message and distributes it to all listening peers

func (*Instance) Init

Init sets up a Server Instance

type Reporting

type Reporting struct {
	LogMetricsToFile    bool   `json:"logMetricsToFile"`
	ReportingGroupID    string `json:"reportingGroupId"`
	ReportingServerAddr string `json:"reportingServerAddr"`
}

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 struct {
	// contains filtered or unexported fields
}

Server encapsulates a complete, compliant Cwtch server.

func (*Server) Run

func (s *Server) Run(acn connectivity.ACN, serverConfig Config)

Run starts a server with the given privateKey TODO: surface errors TODO: handle HUP/KILL signals to exit and close Tor gracefully TODO: handle user input to exit

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown kills the app closing all connections and freeing all goroutines

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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