app

package
v0.0.0-...-7fbff23 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredentials = errors.New("invalid credentials")
	ErrUserExists         = errors.New("user already exists")
	ErrBadPassword        = errors.New("password is too short")
	ErrWeakPassword       = errors.New("password is too weak")
	ErrIncorrectPassword  = errors.New("password is incorrect")
	ErrInvalidEmail       = errors.New("email address is invalid")
	ErrInvalidJSON        = errors.New("invalid JSON input")
	ErrUserNotFound       = errors.New("user not found")
	ErrUserNotResetting   = errors.New("password token and email combo not valid")
	ErrDatasetNotFound    = errors.New("dataset not found")
	ErrNotLoggedIn        = errors.New("not logged in")
	ErrInvalidImage       = errors.New("invalid base64 image")
	ErrInvalidAddress     = errors.New("invalid address")
	ErrImageNotFound      = errors.New("image not found")
	ErrInvalidOption      = errors.New("invalid option")
	ErrMissingForm        = errors.New("missing form")
	ErrInsuffientFunds    = errors.New("insufficient funds")
)

Functions

func GenerateOTP

func GenerateOTP(length int) (string, error)

Types

type FileHiveServer

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

FileHiveServer is the web server used to serve the FileHive application.

func NewServer

func NewServer(listener net.Listener, db *repo.Database, staticFileDir string, walletBackend fil.WalletBackend, filecoinBackend fil.FilecoinBackend, opts ...Option) (*FileHiveServer, error)

NewServer instantiates a new FileHiveServer with the provided options.

func (*FileHiveServer) Close

func (s *FileHiveServer) Close() error

Close shutsdown the Gateway listener.

func (*FileHiveServer) Serve

func (s *FileHiveServer) Serve() error

Serve begins listening on the configured address.

type Option

type Option func(*Options) error

Option represents a db option.

func Domain

func Domain(domain string) Option

Domain sets the domain the server is running on. Defaults to the current domain of the request only (recommended).

This should be a hostname and not a URL. If set, the domain is treated as being prefixed with a '.' - e.g. "example.com" becomes ".example.com" and matches "www.example.com" and "secure.example.com".

func FilecoinAddress

func FilecoinAddress(filecoinAddress string) Option

func JWTKey

func JWTKey(key []byte) Option

JWTKey represents a JSON Web Token key for the server. Use this if you want to persist the key to disk. If This option is nil a random key will be generated.

func MailDomain

func MailDomain(mailDomain string) Option

func MailgunKey

func MailgunKey(mailgunKey string) Option

func SSLCert

func SSLCert(sslCert string) Option

SSLCert is required if using the UseSSL option.

func SSLKey

func SSLKey(sslKey string) Option

SSLKey is required if using the UseSSL option.

func TestMode

func TestMode(testMode bool) Option

TestMode option allows exposes an additional API to generate mock coins.

func UseSSL

func UseSSL(useSSL bool) Option

UseSSL option allows you to set SSL on the server.

type Options

type Options struct {
	JWTKey          []byte
	Domain          string
	UseSSL          bool
	FilecoinAddress string
	SSLCert         string
	SSLKey          string
	TestMode        bool
	MailgunKey      string
	MailDomain      string
}

Options represents the filehive server options.

func (*Options) Apply

func (o *Options) Apply(opts ...Option) error

Apply sets the provided options in the main options struct.

Jump to

Keyboard shortcuts

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