ginx

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMw

func AuthMw(apikeys ...string) func(*gin.Context)

func CaptchaCheck

func CaptchaCheck(uuid, code string) bool

func CaptchaHandler

func CaptchaHandler(c *gin.Context)

func ErrCodeHandler

func ErrCodeHandler(c *gin.Context)

func FlagSet

func FlagSet(defaultPort int) *pflag.FlagSet

func LogMw

func LogMw(c *gin.Context)

func LogoutHandler

func LogoutHandler(c *gin.Context)

func New

func New(conf *Config, routers Routers, mwBefore, mwAfter []gin.HandlerFunc) (*http.Server, error)

Types

type Config

type Config struct {
	System    string      `json:"system" yaml:"system"`
	Prefix    string      `json:"prefix" yaml:"prefix"`
	Endpoint  string      `json:"endpoint" yaml:"endpoint"`
	Addr      string      `json:"addr" yaml:"addr"`
	Port      int         `json:"port" yaml:"port"`
	Origins   []string    `json:"origins" yaml:"origins"`
	Headers   []string    `json:"headers" yaml:"headers"`
	Debug     bool        `json:"debug" yaml:"debug"`
	Pprof     bool        `json:"pprof" yaml:"pprof"`
	RequestID bool        `json:"requestid" yaml:"requestid"`
	Metrics   bool        `json:"metrics" yaml:"metrics"`
	Store     StoreConfig `json:"store" yaml:"store"`
	// contains filtered or unexported fields
}

func (*Config) Commit

func (s *Config) Commit() string

func (*Config) Version

func (s *Config) Version() string

func (*Config) WithAddr

func (s *Config) WithAddr(v string) *Config

func (*Config) WithCommit

func (s *Config) WithCommit(v string) *Config

func (*Config) WithDebug

func (s *Config) WithDebug(v bool) *Config

func (*Config) WithEndpoint

func (s *Config) WithEndpoint(v string) *Config

func (*Config) WithHeaders

func (s *Config) WithHeaders(v []string) *Config

func (*Config) WithMetrics

func (s *Config) WithMetrics(v bool) *Config

func (*Config) WithOrigins

func (s *Config) WithOrigins(v []string) *Config

func (*Config) WithPort

func (s *Config) WithPort(v int) *Config

func (*Config) WithPprof

func (s *Config) WithPprof(v bool) *Config

func (*Config) WithPrefix

func (s *Config) WithPrefix(v string) *Config

func (*Config) WithRequestID

func (s *Config) WithRequestID(v bool) *Config

func (*Config) WithStore

func (s *Config) WithStore(v StoreConfig) *Config

func (*Config) WithSystem

func (s *Config) WithSystem(v string) *Config

func (*Config) WithVersion

func (s *Config) WithVersion(v string) *Config

type Controller

type Controller interface {
	Authed(*gin.RouterGroup)
	UnAuth(*gin.RouterGroup)
}

type RegisterFunc

type RegisterFunc func(*gin.RouterGroup)

type Routers

type Routers []RegisterFunc

func (Routers) Apply

func (rs Routers) Apply(g *gin.RouterGroup)

func (*Routers) Register

func (rs *Routers) Register(f RegisterFunc)

type StoreConfig

type StoreConfig struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	Addr    string `json:"addr" yaml:"addr"`
	Port    int    `json:"port" yaml:"port"`
	Pass    string `json:"pass" yaml:"pass"`
	DB      int    `json:"db" yaml:"db"`
}

func (*StoreConfig) WithAddr

func (s *StoreConfig) WithAddr(v string) *StoreConfig

func (*StoreConfig) WithDB

func (s *StoreConfig) WithDB(v int) *StoreConfig

func (*StoreConfig) WithEnabled

func (s *StoreConfig) WithEnabled(v bool) *StoreConfig

func (*StoreConfig) WithPass

func (s *StoreConfig) WithPass(v string) *StoreConfig

func (*StoreConfig) WithPort

func (s *StoreConfig) WithPort(v int) *StoreConfig

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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