sfsapp

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CConfigPath = "etc/sfs/app.conf"
View Source
const CDefaultFilename = "file.dat"
View Source
const CInfoFilename = "fileinfo.json"

Variables

This section is empty.

Functions

func GenerateId

func GenerateId() string

GenerateId -

func ShiftPath

func ShiftPath(p string) (head, tail string)

ShiftPath splits off the first component of p, which will be cleaned of relative components before processing. head will never contain a slash and tail will always be a rooted path without trailing slash.

Types

type App

type App struct {
	LoadedConfig Config
}

App - main application

func (*App) CheckHeaderToken

func (app *App) CheckHeaderToken(r *http.Request) (err error)

func (*App) GetPort

func (app *App) GetPort() string

GetPort returns default port either from config or from environment variable environment variable has priority

func (*App) ServeAPI

func (app *App) ServeAPI(w http.ResponseWriter, r *http.Request)

func (*App) ServeHTTP

func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*App) ValidateToken

func (app *App) ValidateToken(tokenString string) (userClaim Claims, err error)

ValidateToken - validate if token is fine

type Claims

type Claims struct {
	CustomID int64 `json:"user_id"`
	jwt.StandardClaims
}

Claims - jwt claims

type Config

type Config struct {
	ServerPort    string `json:"server_port"`
	FilesPath     string `json:"files_path"`
	SignatureSalt string `json:"signature_salt"`
}

Config - structure of config file

Jump to

Keyboard shortcuts

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