app

package
v0.0.0-...-8e96a00 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	CreateStore(key string, store Store, expiration time.Duration) error

	ReadStore(key string) (*Store, error)

	DeleteStore(key string) error
}

type DatabaseChannel

type DatabaseChannel interface {
	Subscribe(channel string) *redis.PubSub

	Publish(channel string, message interface{}) (int, error)
}

type RedisDatabase

type RedisDatabase struct {
	Client *redis.Client
}

func (*RedisDatabase) CreateStore

func (db *RedisDatabase) CreateStore(key string, store Store, expiration time.Duration) error

func (*RedisDatabase) DeleteStore

func (db *RedisDatabase) DeleteStore(key string) error

func (*RedisDatabase) ReadStore

func (db *RedisDatabase) ReadStore(key string) (*Store, error)

type RedisDatabaseChannel

type RedisDatabaseChannel struct {
	Client *redis.Client
}

func (*RedisDatabaseChannel) Publish

func (db *RedisDatabaseChannel) Publish(channel string, message interface{}) (int, error)

func (*RedisDatabaseChannel) Subscribe

func (db *RedisDatabaseChannel) Subscribe(channel string) *redis.PubSub

type Server

type Server struct {
	Config          *util.Config
	Database        Database
	DatabaseChannel DatabaseChannel
}

func (*Server) IssueCode

func (server *Server) IssueCode(ctx context.Context, key *proto.Key) (*proto.Code, error)

func (*Server) VerifyCode

func (server *Server) VerifyCode(ctx context.Context, request *proto.VerifyRequest) (*proto.VerifyReply, error)

func (*Server) WaitPermit

func (server *Server) WaitPermit(permitServer proto.KeyLetter_WaitPermitServer) error

type Store

type Store struct {
	Key    string
	Secret string
}

Jump to

Keyboard shortcuts

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