Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Shortcut ¶
type Shortcut interface {
// RouteMethod checks if the address should be routed directly or should
// be proxied, or whether the ideal method is unknown.
RouteMethod(ctx context.Context, addr string) (Method, net.IP)
// SetResolver sets a custom resolver to replace the system default.
SetResolver(r func(ctx context.Context, addr string) (net.IP, error))
}
func New ¶
func New(ipv4DirectSubnets, ipv6DirectSubnets, ipv4ProxySubnets, ipv6ProxySubnets []string) Shortcut
New creates a new shortcut from the subnets for both direct and proxied traffic.
func NewFromReader ¶
NewFromReader is a helper to create shortcut from readers. The content should be in CIDR format, one entry per line.
type SortList ¶
type SortList struct {
// contains filtered or unexported fields
}
func NewSortList ¶
NewSortList creates a shortcut list from a list of CIDR subnets in "a.b.c.d/24" or "2001:db8::/32" format. Each subnet string in one list should be in the same format, i.e., IPv4 only or IPv6 only, but not mixed.