Documentation
¶
Index ¶
- Constants
- func AsBytes(s string) []byte
- func AsString(buf *[]byte) string
- func Catch(f func()) (err error)
- func CatchValue[V any](f func() V) (value V, err error)
- func ClearBlockingCtx(ctx context.Context) context.Context
- func Debug(a any) string
- func GetChildren(ctx context.Context) (context.Context, templ.Component, bool)
- func Hash(input []byte) string
- func InitDefaults(s *SystemConf)
- func IsBlockingCtx(ctx context.Context) bool
- func IsNill(i any) bool
- func LogBlockingWarning(ctx context.Context, entity string, operation string)
- func LogCanceled(ctx context.Context, action string)
- func MarshalJSON(value any) ([]byte, error)
- func MinifyCSS(input []byte) ([]byte, error)
- func RandId() string
- func RenderError(msg string) templ.Component
- func RenderErrorLog(ctx context.Context, w io.Writer, message string, args ...any) error
- func SetBlockingCtx(ctx context.Context) context.Context
- func StripN(buf []byte) []byte
- func Ts()
- func Zip(input []byte) ([]byte, error)
- type Attrs
- type CSP
- type CSPCollector
- type Expirator
- type FuncCollector
- type Primea
- type RenderMap
- func (r *RenderMap) AddImport(specifier string, path string)
- func (r *RenderMap) Destroy()
- func (r *RenderMap) InitImportMap(c *CSPCollector)
- func (r *RenderMap) Render(w io.Writer, index uint64) error
- func (r *RenderMap) RenderBuf(w io.Writer, buf []byte) error
- func (r *RenderMap) WriteAttrs(w io.Writer, attr *Attrs) error
- func (r *RenderMap) WriteImportMap(w io.Writer) error
- func (r *RenderMap) Writer(index uint64) (*RenderWriter, bool)
- type RenderWriter
- type Set
- type SolitaireConf
- type SystemConf
- type Writable
- type WritableNone
- type WritableRenderMap
Constants ¶
View Source
const ( CtxKeyInstance ctxKey = iota CtxKeyDoor CtxKeyThread CtxKeyRenderMap CtxKeyBlocking CtxKeyAdapters CtxKeySessionStore CtxKeyInstanceStore CtxKeyParent CtxKeyAttrs CtxStorageKeyStatus )
View Source
const DefaultCacheControl string = "public, max-age=31536000, immutable"
Variables ¶
This section is empty.
Functions ¶
func CatchValue ¶
func InitDefaults ¶
func InitDefaults(s *SystemConf)
func IsBlockingCtx ¶
func LogBlockingWarning ¶
func LogCanceled ¶
func MarshalJSON ¶
func RenderError ¶
func RenderErrorLog ¶
Types ¶
type Attrs ¶
type Attrs struct {
// contains filtered or unexported fields
}
func (*Attrs) AppendArray ¶
func (*Attrs) SetRaw ¶
func (a *Attrs) SetRaw(attrs templ.Attributes)
type CSP ¶
type CSP struct {
// default-src:
// nil ⇒ emit: default-src 'self'
// len == 0 ⇒ omit: (no default-src directive)
// len > 0 ⇒ emit: default-src <values>
DefaultSources []string
// script-src (user additions only):
// Directive is ALWAYS emitted with at least 'self' plus any collected hashes/sources.
// nil or len == 0 ⇒ no extra user sources added.
ScriptSources []string
// script-src strict-dynamic:
// When true, appends 'strict-dynamic' to script-src (typically used with nonces/hashes).
ScriptStrictDynamic bool
// style-src (user additions only):
// Directive is ALWAYS emitted with at least 'self' plus any collected hashes/sources.
// nil or len == 0 ⇒ no extra user sources added.
StyleSources []string
// connect-src (user additions only):
// Directive is ALWAYS emitted with at least 'self'.
// nil or len == 0 ⇒ results in: connect-src 'self'
// len > 0 ⇒ connect-src 'self' <values>
ConnectSources []string
// form-action:
// nil ⇒ emit: form-action 'none'
// len == 0 ⇒ omit: (no form-action directive)
// len > 0 ⇒ emit: form-action <values>
FormActions []string
// object-src:
// nil ⇒ emit: object-src 'none'
// len == 0 ⇒ omit: (no object-src directive)
// len > 0 ⇒ emit: object-src <values>
ObjectSources []string
// frame-src:
// nil ⇒ emit: frame-src 'none'
// len == 0 ⇒ omit: (no frame-src directive)
// len > 0 ⇒ emit: frame-src <values>
FrameSources []string
// frame-ancestors:
// nil ⇒ emit: frame-ancestors 'none'
// len == 0 ⇒ omit: (no frame-ancestors directive)
// len > 0 ⇒ emit: frame-ancestors <values>
FrameAcestors []string
// base-uri:
// nil ⇒ emit: base-uri 'none'
// len == 0 ⇒ omit: (no base-uri directive)
// len > 0 ⇒ emit: base-uri <values>
BaseURIAllow []string
// img-src:
// nil or len == 0 ⇒ omit
// len > 0 ⇒ emit: img-src <values>
ImgSources []string
// font-src:
// nil or len == 0 ⇒ omit
// len > 0 ⇒ emit: font-src <values>
FontSources []string
// media-src:
// nil or len == 0 ⇒ omit
// len > 0 ⇒ emit: media-src <values>
MediaSources []string
// sandbox:
// nil or len == 0 ⇒ omit
// len > 0 ⇒ emit: sandbox <flags>
Sandbox []string
// worker-src:
// nil or len == 0 ⇒ omit
// len > 0 ⇒ emit: worker-src <values>
WorkerSources []string
// report-to:
// "" ⇒ omit
// set ⇒ emit: report-to <value>
// NOTE: To make this effective, you must also send a corresponding
// `Report-To` HTTP response header that defines the reporting group.
ReportTo string
}
func (*CSP) NewCollector ¶
func (c *CSP) NewCollector() *CSPCollector
type CSPCollector ¶
type CSPCollector struct {
// contains filtered or unexported fields
}
func (*CSPCollector) Generate ¶
func (c *CSPCollector) Generate() string
func (*CSPCollector) ScriptHash ¶
func (c *CSPCollector) ScriptHash(hash []byte)
func (*CSPCollector) ScriptSource ¶
func (c *CSPCollector) ScriptSource(source string)
func (*CSPCollector) StyleHash ¶
func (c *CSPCollector) StyleHash(hash []byte)
func (*CSPCollector) StyleSource ¶
func (c *CSPCollector) StyleSource(source string)
type Expirator ¶
type Expirator struct {
// contains filtered or unexported fields
}
func NewExpirator ¶
func NewExpirator(on func()) *Expirator
type FuncCollector ¶
type FuncCollector struct {
// contains filtered or unexported fields
}
func NewFuncCollector ¶
func NewFuncCollector() *FuncCollector
func (*FuncCollector) Add ¶
func (c *FuncCollector) Add(f func())
func (*FuncCollector) Apply ¶
func (c *FuncCollector) Apply()
type RenderMap ¶
type RenderMap struct {
// contains filtered or unexported fields
}
func NewRenderMap ¶
func NewRenderMap() *RenderMap
func (*RenderMap) InitImportMap ¶
func (r *RenderMap) InitImportMap(c *CSPCollector)
type RenderWriter ¶
type RenderWriter struct {
// contains filtered or unexported fields
}
func (*RenderWriter) Len ¶
func (rw *RenderWriter) Len() int
func (*RenderWriter) Submit ¶
func (rw *RenderWriter) Submit()
func (*RenderWriter) SubmitEmpty ¶
func (rw *RenderWriter) SubmitEmpty()
func (*RenderWriter) SubmitError ¶
func (rw *RenderWriter) SubmitError(err error, args ...any)
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() Set[T]
type SolitaireConf ¶
type SolitaireConf struct {
Ping time.Duration
FlushSize int
RollDuration time.Duration
FlushTimeout time.Duration
Queue int
Pending int
SyncTimeout time.Duration
}
func GetSolitaireConf ¶
func GetSolitaireConf(s *SystemConf) *SolitaireConf
type SystemConf ¶
type SystemConf struct {
// SessionInstanceLimit is the max number of page instances per session.
// When exceeded, the oldest inactive ones are suspended.
// Default: 12.
SessionInstanceLimit int
// SessionTTL controls how long session lives.
// Default behavior (value 0): session ends, when no more
// instances left, cookie expires when browser closes.
SessionTTL time.Duration
// InstanceConnectTimeout controls how long new instance waits
// before shutdown for the first client connection.
// Default: RequestTimeout
InstanceConnectTimeout time.Duration
// InstanceGoroutineLimit is the max goroutines per page instance.
// Controls resource use for rendering and reactive updates. Default: 16.
InstanceGoroutineLimit int
// InstanceTTL is how long an inactive instance is kept before cleanup.
// Active = browser connected. Default: 40minutes.
InstanceTTL time.Duration
// ServerCacheControl defines cache control header value for JS and CSS
// resources prepared by the framework.
// Default "public, max-age=31536000, immutable"
ServerCacheControl string
// ServerDisableGzip disables gzip compression for HTML, JS, and CSS if true.
ServerDisableGzip bool
// DisconnectHiddenTimer is how long hidden/background instances stay connected.
// Default: InstanceTTL/2.
DisconnectHiddenTimer time.Duration
// RequestTimeout is the max duration of a client-server request (hook).
// Default: 30s.
RequestTimeout time.Duration
// SolitairePing is the max idle time before rolling the request.
// Default: 15s.
SolitairePing time.Duration
// SolitaireSyncTimeout is the max pending duration of a server→client sync task,
// including user calls. Exceeding this kills the instance.
// Default: InstanceTTL.
SolitaireSyncTimeout time.Duration
// SolitaireRollTimeout is how long an active sync connection lasts before
// rolling to a new one if the queue is long. Default: 1s.
SolitaireRollTimeout time.Duration
// SolitaireFlushTimeout is the max time before forcing a flush.
// Default: 30ms
SolitaireFlushTimeout time.Duration
// SolitaireFlushSizeLimit is the max buffered bytes before forcing a flush.
// Default: 32 KB
SolitaireFlushSizeLimit int
// SolitaireQueue is the max queued server→client sync task.
// Exceeding this kills the instance. Default: 1024.
SolitaireQueue int
// SolitairePending is the max unresolved server→client sync tasks.
// Throttles sending when reached. Default: 256.
SolitairePending int
}
SystemConf defines global configuration for sessions, instances, client-server communication, and performance. Defaults are auto-initialized.
type WritableNone ¶
type WritableNone struct{}
func (WritableNone) Destroy ¶
func (w WritableNone) Destroy()
type WritableRenderMap ¶
func (*WritableRenderMap) Destroy ¶
func (wrm *WritableRenderMap) Destroy()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.