sts

package
v1.5.1-0...-475df33 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sts persists IRCv3 Strict Transport Security policies.

Package sts persists IRCv3 Strict Transport Security policies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store mirrors sts.ts's STSPolicies class (the file's default-exported singleton), wrapped in a struct rather than package state for the same reason every other Stage 9/10 store is - independent instances per server/test.

func New

func New(homePath string) *Store

New mirrors the STSPolicies constructor: path is Config.getHomePath() joined with "sts-policies.json" (internal/config.Loaded.HomePath()), loaded synchronously so an existing file's live (non-expired) policies are available immediately.

func (*Store) Close

func (s *Store) Close()

Close stops any pending debounced save and flushes it immediately, mirroring how a process exit would still leave a `refresh()` scheduled by Node's debounce eventually running on its own timer - useful for tests and graceful shutdown so a trailing update isn't lost.

func (*Store) Get

func (s *Store) Get(host string) (port int, ok bool)

Get mirrors STSPolicies.get, narrowed to what model.STSLookup needs (the callers this stage has - Network.Validate - only ever read the port). An expired policy is evicted and a debounced save scheduled, exactly like the TS getter's side effect.

func (*Store) RefreshExpiration

func (s *Store) RefreshExpiration(host string)

RefreshExpiration mirrors STSPolicies.refreshExpiration exactly, including its apparent omission of a debounced save afterward (the refreshed expiry is only persisted the next time some other mutation schedules a save) - preserved for parity rather than silently fixed, since it's the original's actual behavior, not a porting mistake.

func (*Store) Update

func (s *Store) Update(host string, port, durationSeconds int)

Update mirrors STSPolicies.update: durationSeconds <= 0 clears any existing policy for host (the server is telling us to stop upgrading), otherwise (re)sets it with a fresh expiry.

Jump to

Keyboard shortcuts

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