web

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: MIT Imports: 27 Imported by: 5

Documentation

Index

Constants

View Source
const MODULE = "web"

Variables

View Source
var JwtExpire = time.Hour * 24 * 30
View Source
var JwtKey = []byte("boat")
View Source
var Server *http.Server

Functions

func Engine

func Engine() *gin.Engine

func JwtGenerate

func JwtGenerate(id string, admin bool) (string, error)

func OpenStaticFile added in v0.0.2

func OpenStaticFile(name string) (file http.File, err error)

func Serve

func Serve() error

func ServeAutoCert added in v0.0.4

func ServeAutoCert() error

func ServeHTTP

func ServeHTTP() error

func ServeTLS

func ServeTLS() error

func ServeUnix added in v0.0.4

func ServeUnix() error

func Shutdown

func Shutdown() error

func Startup

func Startup() error

func Static

func Static(fs http.FileSystem, path, prefix, index string)

Static 静态目录 path url路径。 prefix 基本路径(主要用于zip文件)。 index 默认首页,index.html 代表SPA应用。

func StaticDir added in v0.0.2

func StaticDir(dir string, path, prefix, index string)

func StaticEmbedFS added in v0.0.2

func StaticEmbedFS(fs embed.FS, path, prefix, index string)

func StaticFS added in v0.0.2

func StaticFS(fs fs.FS, path, prefix, index string)

func StaticZip added in v0.0.2

func StaticZip(zip string, path, prefix, index string)

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	Admin bool `json:"admin,omitempty"`
}

func JwtVerify

func JwtVerify(str string) (*Claims, error)

type Store added in v0.1.0

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

func (*Store) Dir added in v0.1.0

func (s *Store) Dir(dir string, base string)

func (*Store) EmbedFS added in v0.1.0

func (s *Store) EmbedFS(fs embed.FS, base string)

func (*Store) FS added in v0.1.0

func (s *Store) FS(fs fs.FS, base string)

func (*Store) Open added in v0.1.0

func (s *Store) Open(name string) (file http.File, err error)

func (*Store) Web added in v0.1.0

func (s *Store) Web(fs http.FileSystem, base string)

func (*Store) Zip added in v0.1.0

func (s *Store) Zip(zip string, base string)

type ZipFS added in v0.1.0

type ZipFS struct {
	Filename string
	// contains filtered or unexported fields
}

func (*ZipFS) Open added in v0.1.0

func (z *ZipFS) Open(name string) (file http.File, err error)

type ZipFile added in v0.1.0

type ZipFile struct {
	fs.File
}

func (*ZipFile) Readdir added in v0.1.0

func (f *ZipFile) Readdir(count int) ([]fs.FileInfo, error)

func (*ZipFile) Seek added in v0.1.0

func (f *ZipFile) Seek(offset int64, whence int) (int64, error)

Jump to

Keyboard shortcuts

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