obfuscator

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package obfuscator transforms injected JavaScript into a semantically equivalent but structurally different form on every request, making signature-based detection ineffective against static fingerprinting.

Index

Constants

View Source
const (
	MarkerStart = "/* __mirage_injected_start__ */"
	MarkerEnd   = "/* __mirage_injected_end__ */"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeObfuscator

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

func NewNodeObfuscator

func NewNodeObfuscator(cfg config.ObfuscatorConfig, logger *slog.Logger) (*NodeObfuscator, error)

NewNodeObfuscator starts cfg.MaxConcurrent sidecar processes. Returns an error if any process fails to start (e.g. node not in PATH, sidecar/node_modules not installed). Callers should fall back to NopObfuscator on error.

func (*NodeObfuscator) Obfuscate

func (ob *NodeObfuscator) Obfuscate(ctx context.Context, html []byte) ([]byte, error)

Obfuscate scans html for injected script blocks and obfuscates them. Returns html unchanged if no marker is present (fast path).

func (*NodeObfuscator) Shutdown

func (ob *NodeObfuscator) Shutdown(ctx context.Context) error

type NopObfuscator

type NopObfuscator struct{}

NopObfuscator is the identity transform. Used when obfuscation is disabled or as a fallback when the Node sidecar is unavailable.

func (*NopObfuscator) Obfuscate

func (n *NopObfuscator) Obfuscate(_ context.Context, html []byte) ([]byte, error)

func (*NopObfuscator) Shutdown

func (n *NopObfuscator) Shutdown(_ context.Context) error

Jump to

Keyboard shortcuts

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