sslbypass

package
v1.0.134 Latest Latest
Warning

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

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

Documentation

Overview

Package sslbypass is the SSL-inspection bypass matcher: a runtime-managed list of host patterns (FQDN globs via hostutil.MatchFQDN semantics, or "~"-prefixed regexes) that must always bypass SSL inspection regardless of what the PBAC policy says, with pre-compiled matching and JSON file persistence. Extracted from package main's policy.go per ADR-0002 (policy.go decomposition Phase B).

package main keeps the surfaces: the `sslBypass` singleton, the /api/ssl-bypass handlers, the inspection-rules startup slice, cluster sync, and config-version rollback — all through aliases. Matches sits on the per-CONNECT hot path (resolveSSLAction).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

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

Matcher holds a list of host patterns that must always bypass SSL inspection, regardless of what the PBAC policy says. Patterns are managed at runtime via /api/ssl-bypass and persisted to a JSON file so they survive restarts without modifying config.yaml. The zero value is a valid empty matcher.

func (*Matcher) Add

func (m *Matcher) Add(p string) error

Add appends a single pattern. No-ops if the pattern is already present.

func (*Matcher) List

func (m *Matcher) List() []string

List returns a snapshot of all raw patterns.

func (*Matcher) Load

func (m *Matcher) Load(path string) error

Load reads bypass patterns from a JSON file (array of strings). A missing file is treated as an empty list (not an error). Sets the persistence path so subsequent Save() calls write to this file.

func (*Matcher) Matches

func (m *Matcher) Matches(host string) bool

Matches reports whether host matches any configured bypass pattern. Glob patterns follow hostutil.MatchFQDN semantics ("*.co.il" matches "www.co.il"). Regex patterns (prefix "~") are matched against the lower-cased bare host.

func (*Matcher) Path

func (m *Matcher) Path() string

Path reports the persistence path ("" = persistence disabled).

func (*Matcher) Remove

func (m *Matcher) Remove(p string) bool

Remove deletes a pattern by exact string match. Returns true if removed.

func (*Matcher) Save

func (m *Matcher) Save()

Save atomically persists the current patterns to the configured JSON file. A temporary file + rename ensures a crash mid-write never corrupts the list.

func (*Matcher) Set

func (m *Matcher) Set(patterns []string) error

Set atomically replaces all bypass patterns.

func (*Matcher) SetPathForTest

func (m *Matcher) SetPathForTest(path string)

SetPathForTest points persistence at path without loading.

Jump to

Keyboard shortcuts

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