tester

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Compact denylist format blocker validator

This module provides a test suite checks that the rules present in test.deny are correctly understood and processed by a Blocker implementation.

Documentation

Overview

Package tester provides an implementation-agnostic way to test a Blocker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocker

type Blocker interface {
	ReadHeader(r io.Reader) (Header, error)
	ReadDenylist(r io.ReadSeekCloser) error
	IsPathBlocked(p path.Path) bool
	IsCidBlocked(c cid.Cid) bool
}

Blocker defines the minimal interface that a blocker should support to be tested.

type Header interface {
	Name() string
	Hints() map[string]string
}

Header represents a denylist header.

type Suite

type Suite struct {
	TestHeader           bool
	TestCID              bool
	TestCIDPath          bool
	TestIPNSPath         bool
	TestDoubleHashLegacy bool
	TestDoubleHash       bool
	// contains filtered or unexported fields
}

Suite repesents the test suite and different test types can be enabled/disabled to match what the Blocker implementation supports.

func (*Suite) Run

func (s *Suite) Run(b Blocker) error

Run performs blocker-validation tests based on test.deny using the given blocker. Only the enabled tests in the suite are performed.

Jump to

Keyboard shortcuts

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