routing

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy string

Policy represents the routing decision

const (
	Direct Policy = "direct"
	Proxy  Policy = "proxy"
	Block  Policy = "block"
)

type Router

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

Router evaluates target addresses against a set of rules

func NewRouter

func NewRouter(rules []*Rule, defaultPolicy Policy) *Router

NewRouter creates a new router with the given rules and default policy

func (*Router) Route

func (r *Router) Route(targetAddr string) Policy

Route resolves the target routing policy for a given host (IP or domain) targetAddr can be "example.com:443" or "1.2.3.4:80" or just the hostname.

type Rule

type Rule struct {
	Type   string // "domain_suffix", "domain_keyword", "ip_cidr"
	Value  string
	Policy Policy
	// contains filtered or unexported fields
}

Rule defines a single routing condition and its target policy

Jump to

Keyboard shortcuts

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