svc

package
v0.0.0-...-4347809 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClientPool *models.ClientPool
)
View Source
var CloudmillWebsocketOpenRoutes = Routes{
	Route{
		Name:        "HealthCheck",
		Method:      "GET,OPTIONS",
		Pattern:     "/healthz",
		HandlerFunc: okHandler,
	},

	Route{
		Name:        "ReadinessCheck",
		Method:      "GET,OPTIONS",
		Pattern:     "/readyz",
		HandlerFunc: okHandler,
	},

	Route{
		Name:        "LivenessCheck",
		Method:      "GET,OPTIONS",
		Pattern:     "/livez",
		HandlerFunc: okHandler,
	},
}
View Source
var CloudmillWebsocketProtectedRoutes = Routes{
	Route{
		Name:        "connect",
		Method:      "GET,OPTIONS",
		Pattern:     "/connect",
		HandlerFunc: AcceptConnection,
	},
}

Functions

func AcceptConnection

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

func AuthMiddleware

func AuthMiddleware(
	next http.Handler,
	secretKey interface{},
	authConfig AuthConfig,
) http.Handler

func ConvertToByteSecretKey

func ConvertToByteSecretKey(secretKey interface{}) ([]byte, error)

func NewRouter

func NewRouter(
	authMiddleware func(next http.Handler, secretKey interface{}, authConfig AuthConfig) http.Handler,
) *mux.Router

func StartCloudmillWebsocket

func StartCloudmillWebsocket()

Types

type AuthConfig

type AuthConfig struct {
	JwtCookieName  string
	CsrfCookieName string
	CsrfHeaderName string
}

type JwtClaim

type JwtClaim struct {
	CustomClaims UserCustomClaim
	jwt.RegisteredClaims
}

type Route

type Route struct {
	Name         string
	Description  string
	Method       string
	Pattern      string
	HandlerFunc  http.HandlerFunc
	Authenticate bool
}

type Routes

type Routes []Route

type UserCustomClaim

type UserCustomClaim struct {
	AccountId uuid.UUID
	Username  string
	Email     string
}

Jump to

Keyboard shortcuts

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