server

package
v0.0.0-...-74453a8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Route variable
	Route *gin.Engine
	// ListenConfig variable
	ListenConfig ListenConf
	// ListenSslConfig variable
	ListenSslConfig ListenSslConf
	// Mode variable
	Mode ModeConfg
)
View Source
var DefaultResourceName = ""

DefaultResourceName variable

View Source
var PrivateKey = make(map[string]interface{})

PrivateKey variable

View Source
var PublicKey = make(map[string]interface{})

PublicKey variable

Functions

func CorsHandler

func CorsHandler() gin.HandlerFunc

CorsHandler function

func DefaultHeader

func DefaultHeader() gin.HandlerFunc

DefaultHeader function

func Error

func Error(c *gin.Context, code string, message string, t ...string) gin.H

Error function

func ErrorResponse

func ErrorResponse(code string, message string) gin.H

ErrorResponse function

func GetSessionStore

func GetSessionStore(option SessionOption) sessions.Store

GetSessionStore function

func GinReUnmarshal

func GinReUnmarshal(i interface{}) (gin.H, error)

GinReUnmarshal function

func GinUnmarshal

func GinUnmarshal(r io.Reader) (gin.H, error)

GinUnmarshal function

func LoadDefaultLifecycle

func LoadDefaultLifecycle()

LoadDefaultLifecycle is enable lifecycle liveness and readiness probe

func LoadServer

func LoadServer()

LoadServer function

func LoadSession

func LoadSession(resourceName string) gin.HandlerFunc

LoadSession function

func NewSvcLifecycle

func NewSvcLifecycle() *svcLifecycle

func NotFoundResponse

func NotFoundResponse(c *gin.Context)

NotFoundResponse function

func PairValues

func PairValues(i, o interface{}) error

PairValues function

func ParseRequest

func ParseRequest(c *gin.Context, request interface{}) error

ParseRequest function

func ResponseJSON

func ResponseJSON(c *gin.Context, code int, obj interface{})

ResponseJSON function

func Session

func Session(c *gin.Context) sessions.Session

Session function

func Start

func Start()

Start function

func Stop

func Stop()

Types

type Config

type Config *config.Config

Config type config

type CorsConf

type CorsConf struct {
	CorsOptions CorsOptions `json:"cors" bson:"cors"`
}

CorsConf struct

var Cors CorsConf

Cors variable

type CorsOptions

type CorsOptions struct {
	UseSetting       bool     `json:"useSetting" bson:"useSetting"`
	AllowAllOrigins  bool     `json:"allowAllOrigins" bson:"allowAllOrigins"`
	AllowOrigins     []string `json:"allowOrigins" bson:"allowOrigins"`
	AllowMethods     []string `json:"allowMethods" bson:"allowMethods"`
	AllowHeaders     []string `json:"allowHeaders" bson:"allowHeaders"`
	AllowCredentials bool     `json:"allowCredentials" bson:"allowCredentials"`
	ExposeHeaders    []string `json:"exposeHeaders" bson:"exposeHeaders"`
	AllowWildcard    bool     `json:"allowWildcard" bson:"allowWildcard"`
	MaxAgeSec        int      `json:"maxAgeSec" bson:"maxAgeSec"`
}

CorsOptions is option of cors that defined from config

type JwtConf

type JwtConf struct {
	JwtOptions []JwtOption `json:"jwtResources" bson:"jwtResources"`
}

JwtConf struct

var (
	// Secret variable
	Secret JwtConf
)

type JwtOption

type JwtOption struct {
	Name          string `json:"name" bson:"name"`
	Secret        string `json:"secret" bson:"secret"`
	Algorithm     string `json:"algorithm" bson:"algorithm"`
	ExpirationSec int    `json:"expiration" bson:"expiration"`
	PrivateKey    string `json:"privateKey" bson:"privateKey"`
	PublicKey     string `json:"publicKey" bson:"publicKey"`
}

JwtOption struct

func GetJwtOption

func GetJwtOption(resourceName string) JwtOption

GetJwtOption function

type Listen

type Listen struct {
	ListenAddr string `json:"listenAddr" bson:"listenAddr"`
	ListenPort string `json:"listenPort" bson:"listenPort"`
	Ssl        bool   `json:"ssl" bson:"ssl"`
}

Listen struct

type ListenConf

type ListenConf struct {
	Listen Listen `json:"listen" bson:"listen"`
}

ListenConf struct

type ListenSsl

type ListenSsl struct {
	AutoTls    bool     `json:"autotls" bson:"autotls"`
	Domain     []string `json:"domain" bson:"domain"`
	ListenAddr string   `json:"listenAddr" bson:"listenAddr"`
	ListenPort string   `json:"listenPort" bson:"listenPort"`
	CertFile   string   `json:"certFile" bson:"certFile"`
	KeyFile    string   `json:"keyFile" bson:"keyFile"`
	SslOnly    bool     `json:"sslOnly" bson:"sslOnly"`
}

ListenSsl struct

type ListenSslConf

type ListenSslConf struct {
	ListenSsl ListenSsl `json:"ssl" bson:"ssl"`
}

ListenSslConf struct

type Map

type Map map[string]interface{}

Map type

type ModeConfg

type ModeConfg struct {
	Mode string `json:"mode" bson:"mode"`
}

ModeConfg struct

type SessionConf

type SessionConf struct {
	SessionOption []SessionOption `json:"sessionResources" bson:"sessionResources"`
}

SessionConf struct

var (
	// Sess variable
	Sess SessionConf
)

type SessionOption

type SessionOption struct {
	Name          string `json:"name" bson:"name"`
	Type          string `json:"type" bson:"type"`
	Host          string `json:"host" bson:"host"`
	Secret        string `json:"secret" bson:"secret"`
	Password      string `json:"password" bson:"password"`
	ExpirationSec int    `json:"expiration" bson:"expiration"`
	SessionName   string `json:"sessionName" bson:"sessionName"`
}

SessionOption struct

func GetSessionResource

func GetSessionResource(resourceName string) SessionOption

GetSessionResource function

Jump to

Keyboard shortcuts

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