bypass

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bypass implements address-based routing that decides whether a target address should skip the proxy chain and connect directly.

The package provides:

  • NewBypass: a local bypass that matches addresses against CIDR, IP range, wildcard, and exact-address patterns, with optional periodic reload from file, Redis, or HTTP sources.
  • BypassGroup: composes multiple bypass rules; whitelist rules use AND logic, blacklist rules use OR logic (evaluated only if whitelist fails).
  • Plugin-based bypass (gRPC and HTTP) in the plugin sub-package.

Matching modes:

  • Blacklist (whitelist=false): matching addresses bypass the proxy. This is the default.
  • Whitelist (whitelist=true): matching addresses go through the proxy chain; all other addresses bypass the proxy.

Index

Constants

This section is empty.

Variables

View Source
var ErrBypass = errors.New("bypass")

ErrBypass is returned by wrapped connections when the bypass rule determines that the connection should skip the proxy chain.

Functions

func BypassGroup added in v0.0.3

func BypassGroup(bypasses ...bypass.Bypass) bypass.Bypass

BypassGroup creates a composite Bypass from multiple rules. Whitelist rules use AND logic (all must match); blacklist rules use OR logic (any match triggers bypass) and are only evaluated when whitelist rules fail.

func NewBypass

func NewBypass(opts ...Option) bypass.Bypass

NewBypass creates and initializes a local Bypass instance.

In blacklist mode (the default), addresses matching any pattern bypass the proxy. In whitelist mode (set via WhitelistOption(true)), matching addresses go through the proxy chain and all others bypass the proxy.

If a reload period is configured, patterns from external loaders are refreshed automatically in the background.

Types

type Option

type Option func(opts *options)

Option is a functional option for configuring a Bypass instance.

func FileLoaderOption

func FileLoaderOption(fileLoader loader.Loader) Option

FileLoaderOption sets the file loader for reading bypass patterns from a file or directory.

func HTTPLoaderOption

func HTTPLoaderOption(httpLoader loader.Loader) Option

HTTPLoaderOption sets the HTTP loader for reading bypass patterns from an HTTP endpoint.

func LoggerOption

func LoggerOption(logger logger.Logger) Option

LoggerOption sets the logger for debug and warning messages.

func MatchersOption

func MatchersOption(matchers []string) Option

MatchersOption sets the static bypass patterns (CIDR, IP range, wildcard, or address).

func NetworkOption added in v0.28.1

func NetworkOption(network string) Option

NetworkOption restricts this bypass to a specific network protocol. Network and address predicates are combined before whitelist mode is applied to the resulting match. Accepts values like "tcp" or "udp".

func RedisLoaderOption

func RedisLoaderOption(redisLoader loader.Loader) Option

RedisLoaderOption sets the Redis loader for reading bypass patterns from a Redis set or key.

func ReloadPeriodOption

func ReloadPeriodOption(period time.Duration) Option

ReloadPeriodOption sets the interval between automatic reloads of bypass patterns from external loaders (file, Redis, HTTP).

func WhitelistOption

func WhitelistOption(whitelist bool) Option

WhitelistOption sets whether the bypass operates in whitelist mode. In whitelist mode, matching addresses go through the proxy chain; all others bypass the proxy.

Directories

Path Synopsis
Package bypass implements plugin-based Bypass using gRPC and HTTP transports.
Package bypass implements plugin-based Bypass using gRPC and HTTP transports.

Jump to

Keyboard shortcuts

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