web

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package web is responsible for serving browser and API requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthServiceInterface added in v0.10.0

type AuthServiceInterface interface {
	CheckToken(token string) bool

	GenerateToken() string

	AddToken(token string)

	DeleteToken(token string)

	Shutdown() error
}

type Config added in v0.7.0

type Config struct {
	Debug   bool
	Version string

	Port  string
	IsTLS bool

	Login    string
	Password string

	SkipLogin      bool
	AuthCookieName string
	MaxTokenLife   time.Duration
}

type Server added in v0.4.0

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

func NewWebServer added in v0.4.0

func NewWebServer(cnf Config,
	fs *files.FileStorage,
	ts *tags.TagStorage,
	auth AuthServiceInterface,
	share ShareServiceInterface,
	lg *clog.Logger,
) (*Server, error)

NewWebServer just creates new Web struct

func (Server) Shutdown added in v0.4.0

func (s Server) Shutdown() error

func (*Server) Start added in v0.4.0

func (s *Server) Start() error

Start starts the server. It has to be ran in goroutine

Server stops when ctx.Done()

type ShareServiceInterface added in v0.10.0

type ShareServiceInterface interface {
	GetAllTokens() map[string][]int

	CheckToken(token string) bool

	CreateToken(filesIDs []int) (token string)

	GetFilesIDs(token string) ([]int, error)

	DeleteToken(token string)

	CheckFile(token string, id int) bool

	FilterFiles(token string, files []files.File) ([]files.File, error)

	FilterTags(token string, tags tags.Tags) (tags.Tags, error)

	DeleteFile(id int)

	Shutdown() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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