Documentation ¶
Overview ¶
Package filtertest contains common constants and utilities for the internal filtering packages.
Index ¶
Constants ¶
const BlockRule = "|" + ReqHost + "^"
BlockRule is the common blocking rule for filtering tests that blocks ReqHost.
const CacheTTL = 1 * time.Hour
CacheTTL is the common long cache-TTL for filtering tests.
const FilterMaxSize = 640 * uint64(datasize.KB)
FilterMaxSize is the maximum size of the downloadable rule-list for filtering tests.
const ReqFQDN = ReqHost + "."
ReqFQDN is the common request FQDN for filtering tests.
const ReqHost = "www.host.example"
ReqHost is the common request host for filtering tests.
const ServerName = "testServer/1.0"
ServerName is the common server name for filtering tests.
const Staleness = 1 * time.Hour
Staleness is the common long staleness for filtering tests.
const Timeout = 1 * time.Second
Timeout is the common timeout for filtering tests.
Variables ¶
var RemoteIP = netip.MustParseAddr("1.2.3.4")
RemoteIP is the common client IP for filtering tests
Functions ¶
func PrepareRefreshable ¶
func PrepareRefreshable( tb testing.TB, reqCh chan<- struct{}, text string, code int, ) (cachePath string, srvURL *url.URL)
PrepareRefreshable launches an HTTP server serving the given text and code, as well as creates a cache file. If code is zero, the server isn't started. If reqCh not nil, a signal is sent every time the server is called. The server uses ServerName as the value of the Server header.
Types ¶
This section is empty.