waf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseDir  = "/var/lib/elchi/waf"
	ArchiveURL      = "https://archive.elchi.io/index.json"
	DefaultArch     = "wasm-amd64"
	DownloadTimeout = 300 // 5 minutes
)

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveBinary

type ArchiveBinary struct {
	Arch        string `json:"arch"`
	DownloadURL string `json:"download_url"`
	SHA256      string `json:"sha256"`
}

ArchiveBinary represents a WASM binary download info

type ArchiveRelease

type ArchiveRelease struct {
	Version  string          `json:"version"`
	Date     time.Time       `json:"date"`
	Binaries []ArchiveBinary `json:"binaries"`
}

ArchiveRelease represents a single coroza release from the archive API

type ArchiveResponse

type ArchiveResponse struct {
	CorozaReleases []ArchiveRelease `json:"coroza_releases"`
}

ArchiveResponse represents the full response from archive API

type Downloader

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

func NewDownloader

func NewDownloader() *Downloader

func (*Downloader) DownloadBinary

func (d *Downloader) DownloadBinary(version string, destPath string) error

DownloadBinary downloads a WASM binary for the given version and architecture

func (*Downloader) GetAvailableVersions

func (d *Downloader) GetAvailableVersions() (*ArchiveResponse, error)

GetAvailableVersions fetches available WAF versions from archive API

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) GetDownloadedVersions

func (m *Manager) GetDownloadedVersions() ([]string, error)

GetDownloadedVersions returns list of locally downloaded WAF versions

func (*Manager) ProcessWafVersionCommand

func (m *Manager) ProcessWafVersionCommand(request *client.RequestWafVersion) *client.ResponseWafVersion

ProcessWafVersionCommand handles the WAF version command

func (*Manager) SetVersion

func (m *Manager) SetVersion(version string, forceDownload bool) (string, error)

SetVersion downloads and installs a specific WAF version

type PermissionManager

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

func NewPermissionManager

func NewPermissionManager() *PermissionManager

func (*PermissionManager) CreateVersionDirectory

func (pm *PermissionManager) CreateVersionDirectory(version string) (string, error)

CreateVersionDirectory creates a directory for a specific WAF version

func (*PermissionManager) EnsureBaseDirectory

func (pm *PermissionManager) EnsureBaseDirectory() error

EnsureBaseDirectory creates the base directory for WAF WASM files if it doesn't exist

func (*PermissionManager) SetBinaryPermissions

func (pm *PermissionManager) SetBinaryPermissions(filePath string) error

SetBinaryPermissions sets appropriate permissions for WAF WASM files

Jump to

Keyboard shortcuts

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