route

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWrapCloseConn added in v0.3.8

func NewWrapCloseConn(conn net.Conn, f func()) net.Conn

func SplitModeArgs

func SplitModeArgs(s string) (x unique.Handle[bypass.ModeEnum], ok bool)

func TrimComment

func TrimComment(s string) string

Types

type Args

type Args struct {
	Tag                  string
	Mode                 bypass.Mode
	ResolveStrategy      bypass.ResolveStrategy
	UdpProxyFqdnStrategy bypass.UdpProxyFqdnStrategy
}

func ParseArgs

func ParseArgs(mode bypass.Mode, fs RawArgs) Args

ParseArgs parse args args: tag=tag,udp_proxy_fqdn,resolve_strategy=prefer_ipv6

func (Args) ToModeConfig

func (a Args) ToModeConfig(hostname []string) *bypass.ModeConfig

type Dialer

type Dialer interface {
	Get(ctx context.Context, network string, str string, tag string) (netapi.Proxy, error)
}

type LoopbackDetector added in v0.3.8

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

func NewLoopback added in v0.3.8

func NewLoopback() *LoopbackDetector

func (*LoopbackDetector) CheckConnLoopback added in v0.3.8

func (l *LoopbackDetector) CheckConnLoopback(meta *netapi.StreamMeta) bool

func (*LoopbackDetector) Cycle added in v0.3.8

func (l *LoopbackDetector) Cycle(meta *netapi.Context, addr netapi.Address) bool

func (*LoopbackDetector) IsLoopback added in v0.3.8

func (l *LoopbackDetector) IsLoopback(ctx *netapi.Context, path string, pid uint) bool

func (*LoopbackDetector) NewConn added in v0.3.8

func (l *LoopbackDetector) NewConn(conn net.Conn) net.Conn

type Object added in v0.3.8

type Object struct {
	Ctx         *netapi.Context
	NetowrkMode bypass.Mode
	Host        netapi.Address
}

type RawArgs added in v0.3.7

type RawArgs []string

func (RawArgs) Range added in v0.3.7

func (a RawArgs) Range(f func(k, v string) bool)

type RejectHistory added in v0.3.7

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

func NewRejectHistory added in v0.3.8

func NewRejectHistory() *RejectHistory

func (*RejectHistory) Get added in v0.3.7

func (h *RejectHistory) Get() *gc.BlockHistoryList

func (*RejectHistory) Push added in v0.3.7

func (h *RejectHistory) Push(ctx context.Context, protocol string, host string)

type Resolver

type Resolver interface {
	Get(resolver, fallback string) netapi.Resolver
}

type Route

type Route struct {
	ProcessDumper netapi.ProcessDumper

	*RejectHistory
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute(d Dialer, r Resolver, ProcessDumper netapi.ProcessDumper) *Route

func (*Route) AddMatcher added in v0.3.8

func (s *Route) AddMatcher(name string, f func(*Object) bypass.ModeEnum)

func (*Route) Close

func (f *Route) Close() error

func (*Route) Conn

func (s *Route) Conn(ctx context.Context, host netapi.Address) (net.Conn, error)

func (*Route) Dispatch

func (s *Route) Dispatch(ctx context.Context, host netapi.Address) (netapi.Address, error)

func (*Route) LookupIP

func (f *Route) LookupIP(ctx context.Context, domain string, opts ...func(*netapi.LookupIPOption)) ([]net.IP, error)

func (*Route) PacketConn

func (s *Route) PacketConn(ctx context.Context, host netapi.Address) (net.PacketConn, error)

func (*Route) Raw

func (*Route) Resolver

func (s *Route) Resolver(ctx context.Context, domain string) netapi.Resolver

func (*Route) Search

func (s *Route) Search(ctx context.Context, addr netapi.Address) bypass.ModeEnum

func (*Route) SearchProcess added in v0.3.7

func (s *Route) SearchProcess(ctx *netapi.Context, process netapi.Process) (bypass.ModeEnum, bool)

func (*Route) Tags

func (s *Route) Tags() iter.Seq[string]

type RuleController added in v0.3.7

type RuleController struct {
	gc.UnimplementedBypassServer
	// contains filtered or unexported fields
}

func NewRuleController added in v0.3.7

func NewRuleController(db config.DB, r *Route) *RuleController

func (*RuleController) BlockHistory added in v0.3.7

func (*RuleController) Load added in v0.3.7

func (s *RuleController) Load(ctx context.Context, empty *emptypb.Empty) (*bypass.Config, error)

func (*RuleController) Reload added in v0.3.7

func (s *RuleController) Reload(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error)

func (*RuleController) Save added in v0.3.7

func (s *RuleController) Save(ctx context.Context, config *bypass.Config) (*emptypb.Empty, error)

func (*RuleController) Test added in v0.3.7

type Uri added in v0.3.7

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

func SplitHostArgs

func SplitHostArgs(s string) (uri *Uri, args string, ok bool)

func (*Uri) Data added in v0.3.7

func (u *Uri) Data() string

func (*Uri) Scheme added in v0.3.7

func (u *Uri) Scheme() string

func (*Uri) SetData added in v0.3.7

func (u *Uri) SetData(str string)

func (*Uri) String added in v0.3.7

func (u *Uri) String() string

Jump to

Keyboard shortcuts

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