gosrvx

package
v0.0.0-...-11273d6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 22 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRouterHook

func AddRouterHook(hook RouterHook)

export

func AttachFuncMiddleware

func AttachFuncMiddleware(handlerFunc http.HandlerFunc, middlewares ...func(handler http.Handler) http.Handler) http.Handler

export

func AttachHookRoute

func AttachHookRoute()

export

func AttachMiddleware

func AttachMiddleware(handler http.Handler, middlewares ...func(handler http.Handler) http.Handler) http.Handler

export

func AttachRouterPlugin

func AttachRouterPlugin(plugins ...RouterPlugin)

export

func AttchProgressRoute

func AttchProgressRoute(router *RootRouter, wsPath string, restricted bool)

export

func GetProgress

func GetProgress(key string, code string) *progx.Progress

export

func GetRequestId

func GetRequestId(r *http.Request) string

func GetUserKey

func GetUserKey(r *http.Request) string

func InitTomlConfig

func InitTomlConfig(filepath string, properties interface{}) (err error)

export

func ListenAndServe

func ListenAndServe(handler http.Handler, port int64)

export

func ListenAndServeTLS

func ListenAndServeTLS(certificate string, key string, handler http.Handler, port int64)

export

func NewLog

func NewLog(config *LogConfig) *logx.Logger

export

func ProgressSetupHandler

func ProgressSetupHandler(w http.ResponseWriter, r *http.Request)

func ProtectPrefix

func ProtectPrefix(pathPrefix string) *routex.Router

export

func SetupLogs

func SetupLogs(config *LogConfig)

export

func SetupPasswordAuthorizeServer

func SetupPasswordAuthorizeServer(client authx.ClientInfo, pwdHandler func(username, password string) (string, error), storeFile string) *authx.Server

export nolint[lll]

func SetupProgressRoute

func SetupProgressRoute(wsPath string, restricted bool)

export

Types

type LogConfig

type LogConfig struct {
	LogLevel  string
	LogPath   string
	LogFile   string
	MaxSize   int
	MaxAge    int
	MaxBackup int
	Compress  bool
	Stdout    bool
}

type RootRouter

type RootRouter struct {
	*routex.Router
	// contains filtered or unexported fields
}

func EnableRouterAudit

func EnableRouterAudit(loggers ...logx.StdLog) *RootRouter

export

func GetRouter

func GetRouter(routerKey string) *RootRouter

export

func NewAuditRouter

func NewAuditRouter(logger logx.StdLog, routerKey ...string) *RootRouter

export

func NewRouter

func NewRouter(routerKey ...string) *RootRouter

export

func Router

func Router(routerKey ...string) *RootRouter

export

func (*RootRouter) AttachPlugins

func (rr *RootRouter) AttachPlugins(plugins ...RouterPlugin)

func (*RootRouter) AuditMiddleware

func (rr *RootRouter) AuditMiddleware(next http.Handler) http.Handler

func (*RootRouter) AuthorizeMiddleware

func (rr *RootRouter) AuthorizeMiddleware(next http.Handler) http.Handler

func (*RootRouter) CurrentRouteConfig

func (rr *RootRouter) CurrentRouteConfig(r *http.Request) (routex.RouteConfig, bool)

func (*RootRouter) EnableAudit

func (rr *RootRouter) EnableAudit(loggers ...logx.StdLog)

func (*RootRouter) EnableAuthFilter

func (rr *RootRouter) EnableAuthFilter(filter ...func(w http.ResponseWriter, req *http.Request, next http.Handler))

func (*RootRouter) EnableRecover

func (rr *RootRouter) EnableRecover()

func (*RootRouter) ProtectPrefix

func (rr *RootRouter) ProtectPrefix(pathPrefix string) *routex.Router

func (*RootRouter) RecoverMiddleware

func (rr *RootRouter) RecoverMiddleware(next http.Handler) http.Handler

func (*RootRouter) ServeHTTP

func (rr *RootRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*RootRouter) SetAuthFilter

func (rr *RootRouter) SetAuthFilter(filter func(w http.ResponseWriter, req *http.Request, next http.Handler))

type RouterHook

type RouterHook func()

type RouterPlugin

type RouterPlugin interface {
	Inject(*RootRouter)
}

type TokenIssuer

type TokenIssuer struct {
	*authx.Server
	// contains filtered or unexported fields
}

func NewTokenIssuer

func NewTokenIssuer(server *authx.Server, tokenPath string) *TokenIssuer

export

func (*TokenIssuer) AuthFilter

func (t *TokenIssuer) AuthFilter(w http.ResponseWriter, r *http.Request, next http.Handler)

func (*TokenIssuer) AuthorizeDisposeHandlerFunc

func (t *TokenIssuer) AuthorizeDisposeHandlerFunc(w http.ResponseWriter, r *http.Request)

func (*TokenIssuer) AuthorizeDisposeMiddleware

func (t *TokenIssuer) AuthorizeDisposeMiddleware(next http.Handler) http.Handler

func (*TokenIssuer) Inject

func (t *TokenIssuer) Inject(rr *RootRouter)

func (*TokenIssuer) Setup

func (t *TokenIssuer) Setup(server *authx.Server, tokenPath string)

Jump to

Keyboard shortcuts

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