rustconn

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthSaver

type AuthSaver struct {
	DiscordAuths DiscordAuthsStore
	Users        UsersStore
	AuthSuccess  chan types.DiscordAuth
	// contains filtered or unexported fields
}

An AuthSaver saves Discord -> Rust user authentications

func NewAuthSaver

func NewAuthSaver(da DiscordAuthsStore, u UsersStore, as chan types.DiscordAuth, done chan struct{}) *AuthSaver

NewAuthSaver creates a new AuthSaver

func (*AuthSaver) Run

func (a *AuthSaver) Run()

Run writes users sent in through the AuthSuccess channel

type DiscordAuthsStore

type DiscordAuthsStore interface {
	Remove(types.SteamInfo) error
}

type RaidAlerter

type RaidAlerter struct {
	RaidStore  RaidStore
	RaidNotify chan types.RaidAlert
	SleepTime  time.Duration
	// contains filtered or unexported fields
}

A RaidAlerter sends notifications on raids

func NewRaidAlerter

func NewRaidAlerter(ral RaidStore, rnc chan types.RaidAlert, done chan struct{}) *RaidAlerter

NewRaidAlerter constructs a RaidAlerter

func (*RaidAlerter) Run

func (r *RaidAlerter) Run()

Run checks for raids that need to be alerted and sends them out through the RaidNotify channel. It runs in a loop.

type RaidStore

type RaidStore interface {
	GetReady(*[]types.RaidAlert) error
	Remove(types.RaidAlert) error
}

A RaidStore stores raid information

type Server

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

A Server runs the HTTP server, notification channels, and DB writing.

func NewServer

func NewServer(sc *ServerConfig, channels ServerChannels, options ServerOptions) *Server

NewServer creates a Server

func (*Server) Start

func (s *Server) Start() error

Serve starts the HTTP server, raid alerter, and Discord auth manager

func (*Server) Stop

func (s *Server) Stop()

type ServerAuth

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

func (ServerAuth) Handle

func (sa ServerAuth) Handle(next http.Handler) http.Handler

type ServerChannels

type ServerChannels struct {
	RaidNotify  chan types.RaidAlert
	DiscordAuth chan types.DiscordAuth
	AuthSuccess chan types.DiscordAuth
	ChatChan    chan types.ChatMessage
}

type ServerConfig

type ServerConfig struct {
	BindAddr string
	Port     int
	Storage  storage.Storage
}

ServerConfig contains the base Server configuration

type ServerOptions

type ServerOptions struct {
	RaidAlerts bool
	ChatRelay  bool
}

type UsersStore

type UsersStore interface {
	UpsertBase(types.BaseUser) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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