util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddQuitSignal

func AddQuitSignal(group *run.Group)

Types

type Entry

type Entry[T any] struct {
	Value   T
	MinPort int
	MaxPort int
}

func (Entry[T]) IsPortAllowed

func (e Entry[T]) IsPortAllowed(port int) bool

func (Entry[T]) String

func (e Entry[T]) String() string

type QuicConn

type QuicConn struct {
	quic.Stream
	LAddr net.Addr
	RAddr net.Addr
}

func (*QuicConn) LocalAddr

func (c *QuicConn) LocalAddr() net.Addr

func (*QuicConn) RemoteAddr

func (c *QuicConn) RemoteAddr() net.Addr

type Whitelist

type Whitelist struct {
	Networks []Entry[*net.IPNet]
	IPs      []Entry[net.IP]
	Zones    []Entry[string]
	Hosts    []Entry[string]
	// contains filtered or unexported fields
}

func NewWhitelist

func NewWhitelist() *Whitelist

func WhitelistFromStrings

func WhitelistFromStrings(strings []string) *Whitelist

WhitelistFromStrings creates a Whitelist if the host list is not empty, nil otherwise.

func (*Whitelist) AddFromString

func (p *Whitelist) AddFromString(s string)

func (*Whitelist) AddHost

func (p *Whitelist) AddHost(host string, minPort, maxPort int)

AddHost specifies a host name that will use the bypass proxy.

func (*Whitelist) AddIP

func (p *Whitelist) AddIP(ip net.IP, minPort, maxPort int)

AddIP specifies an IP address that will use the bypass proxy. Note that this will only take effect if a literal IP address is dialed. A connection to a named host will never match an IP.

func (*Whitelist) AddNetwork

func (p *Whitelist) AddNetwork(ipNet *net.IPNet, minPort, maxPort int)

AddNetwork specifies an IP range that will use the bypass proxy. Note that this will only take effect if a literal IP address is dialed. A connection to a named host will never match.

func (*Whitelist) AddZone

func (p *Whitelist) AddZone(zone string, minPort, maxPort int)

AddZone specifies a DNS suffix that will use the bypass proxy. A zone of "example.com" matches "example.com" and all of its subdomains.

func (*Whitelist) Contains

func (p *Whitelist) Contains(ctx context.Context, network, addr string, opts ...gost.BypassOption) bool

Contains returns bypass result, `true` blocks the request, `false` pass the request through.

func (*Whitelist) IsAddrAllowed

func (p *Whitelist) IsAddrAllowed(host string, port int) bool

func (*Whitelist) IsPortAllowed

func (p *Whitelist) IsPortAllowed(port int, entry *Entry[any]) bool

Jump to

Keyboard shortcuts

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