ircsts

package
v0.0.0-...-1a94ce6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ircsts implements storage for IRCv3 Strict Transport Security policies. The consumer supplies the Store; the library never chooses a path.

Index

Constants

This section is empty.

Variables

View Source
var ErrSTSPolicyViolation = errors.New("ircsts: refusing insecure connect under STS policy")

ErrSTSPolicyViolation indicates an insecure connection was refused because an STS policy applies.

Functions

This section is empty.

Types

type FileStore

type FileStore struct {
	// Path is the location of the JSON file backing the store.
	Path string
	// contains filtered or unexported fields
}

FileStore is a Store that persists policies as JSON on disk at a consumer-supplied path.

func (*FileStore) Delete

func (s *FileStore) Delete(host string) error

Delete removes the policy for host.

func (*FileStore) Get

func (s *FileStore) Get(host string) (Policy, bool, error)

Get returns the policy for host and reports whether one was found, evicting it if it has expired.

func (*FileStore) Set

func (s *FileStore) Set(p Policy) error

Set stores the policy, keyed by its lowercased host.

type Policy

type Policy struct {
	Host string `json:"host"`
	Port int    `json:"port"`
	// Expires is the UTC expiry time; the zero value means the policy never expires.
	Expires time.Time `json:"expires"`
	Preload bool      `json:"preload"`
}

Policy describes a Strict Transport Security policy for a single host.

type Store

type Store interface {
	// Get returns the policy for host and reports whether one was found.
	Get(host string) (Policy, bool, error)
	// Set stores the policy.
	Set(p Policy) error
	// Delete removes the policy for host.
	Delete(host string) error
}

Store persists Strict Transport Security policies and is provided by the consumer.

Jump to

Keyboard shortcuts

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