i

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppSet

type AppSet interface {
	Match(appId string) bool
}

type BufferPolicy

type BufferPolicy interface {
	UserBufferSize(level uint32) int32
}

type ConnHandler

type ConnHandler interface {
	HandleConn(ctx context.Context, dst net.Destination, rw io.ReadWriter) error
}

type DeadlineRW

type DeadlineRW interface {
	buf.ReaderWriter
	ReadDeadline
}

type DefaultInterfaceChangeObserver

type DefaultInterfaceChangeObserver interface {
	OnDefaultInterfaceChanged()
}

type DefaultInterfaceChangeSubject

type DefaultInterfaceChangeSubject interface {
	Register(observer DefaultInterfaceChangeObserver)
	Unregister(observer DefaultInterfaceChangeObserver)
	Notify()
}

type DefaultInterfaceInfo

type DefaultInterfaceInfo interface {
	// Name of the default ipv4 interface
	DefaultInterface4() uint32
	DefaultInterface6() uint32
	// Name of the default ipv4 interface
	DefaultInterfaceName4() string
	DefaultInterfaceName6() string
	// Dns servers of the default ipv4 interface
	DefaultDns4() []netip.Addr
	DefaultDns6() []netip.Addr
	// whether the default interface actually support ipv6
	// -1: no; 0: unknown for now, is checking; 1: yes
	SupportIPv6() int
	// whether the default interface has global ipv6 address
	// as determined by netip.Addr.IsGlobalUnicast()
	HasGlobalIPv6() (bool, error)
	DefaultInterfaceChangeSubject
}

type Dialer

type Dialer interface {
	Dial(ctx context.Context, dst net.Destination) (net.Conn, error)
}

type DialerListener

type DialerListener interface {
	Dialer
	PacketListener
}

type DnsResolver

type DnsResolver interface {
	IPResolver
	ECHResolver
}

type DnsServer

type DnsServer interface {
	HandleQuery(ctx context.Context, msg *dns.Msg, tcp bool) (*dns.Msg, error)
}

type DomainSet

type DomainSet interface {
	Match(domain string) bool
}

type ECHResolver

type ECHResolver interface {
	LookupECH(ctx context.Context, domain string) ([]byte, error)
}

type FakeDnsPool

type FakeDnsPool interface {
	GetDomainFromFakeDNS(ip net.Address) string
	IsIPInIPPool(ip net.Address) bool
}

type FlowConn

type FlowConn interface {
	buf.ReaderWriter
	Close() error
}

type FlowHandler

type FlowHandler interface {
	// Read request data from rw; meanwhile write response data to rw.
	// Returns when there is no more data from rw (io.EOF) and no more response data; or when an
	// error occurs; or when ctx is canceled.
	// rw.CloseWrite() will be called when no more respone data;
	// When an error occurs and it returns, rw might still be used by some goroutines
	// for reading or writing.
	HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
}

type GeoHelper

type GeoHelper interface {
	MatchDomain(domain string, tag string) bool
	MatchIP(ip net.IP, tag string) bool
	MatchAppId(appId string, tag string) bool
}

type Handler

type Handler interface {
	FlowHandler
	PacketHandler
}

type HandlerErrorObserver

type HandlerErrorObserver interface {
	OnHandlerError(tag string, err error)
}

type HandlerWith6Info

type HandlerWith6Info interface {
	Outbound
	Support6() bool
}

type IPResolver

type IPResolver interface {
	LookupIP(ctx context.Context, domain string) ([]net.IP, error)
	LookupIPv4(ctx context.Context, domain string) ([]net.IP, error)
	LookupIPv6(ctx context.Context, domain string) ([]net.IP, error)
}

type IPSet

type IPSet interface {
	Match(ip net.IP) bool
}

type IPv6SupportChangeObserver

type IPv6SupportChangeObserver interface {
	OnIPv6SupportChanged()
}

type IPv6SupportChangeSubject

type IPv6SupportChangeSubject interface {
	Register(observer IPv6SupportChangeObserver)
	Unregister(observer IPv6SupportChangeObserver)
	Notify()
}

type IpToDomain

type IpToDomain interface {
	// if there are multiple domains with same ip, return nothing
	GetDomain(ip net.IP) []string
}

type Listener

type Listener interface {
	Listen(ctx context.Context, addr net.Addr) (net.Listener, error)
}

type OnDefaultInterfaceChanged

type OnDefaultInterfaceChanged func()

func (OnDefaultInterfaceChanged) OnDefaultInterfaceChanged

func (f OnDefaultInterfaceChanged) OnDefaultInterfaceChanged()

type Outbound

type Outbound interface {
	Tag() string
	Handler
}

type OutboundManager

type OutboundManager interface {
	GetHandler(tag string) Outbound
	GetAllHandlers() []Outbound
}

type PacketHandler

type PacketHandler interface {
	// Read request data from rw; meanwhile write response data to rw.
	// Returns when there is no request for a while; or when an
	// error occurs; or when ctx is canceled.
	HandlePacketConn(ctx context.Context, dst net.Destination, p udp.PacketReaderWriter) error
}

type PacketListener

type PacketListener interface {
	ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error)
}

type PortSelector

type PortSelector interface {
	SelectPort() uint16
}

type ProxyDialer

type ProxyDialer interface {
	ProxyDial(ctx context.Context, dst net.Destination, initialData buf.MultiBuffer) (FlowConn, error)
}

type ProxyPacketListener

type ProxyPacketListener interface {
	// dst is the destination of the initial udp packet
	ListenPacket(ctx context.Context, dst net.Destination) (udp.UdpConn, error)
}

type ReadDeadline

type ReadDeadline interface {
	SetReadDeadline(t time.Time) error
}

type Router

type Router interface {
	PickHandler(ctx context.Context, si *session.Info) (Outbound, error)
	// rw is either a buf.ReaderWriter or a udp.PacketConn
	PickHandlerWithData(ctx context.Context, si *session.Info, rw interface{}) (interface{}, Outbound, error)
}

type StatsSetting

type StatsSetting interface {
	CalculateUserStats() bool
	// whether sample throughput and ping
	CalculateOutboundLinkStats() bool
	CalculateInboundLinkStats() bool
	CalculateInboundStats() bool
	CalculateSessionStats() bool
}

type TimeoutSetting

type TimeoutSetting interface {
	HandshakeTimeout() time.Duration
	TcpIdleTimeout() time.Duration
	UdpIdleTimeout() time.Duration
	SshIdleTimeout() time.Duration
	DnsIdleTimeout() time.Duration
	UpLinkOnlyTimeout() time.Duration
	DownLinkOnlyTimeout() time.Duration
}

type UnauthorizedReport

type UnauthorizedReport interface {
	ReportUnauthorized(ip string, credential string)
}

type User

type User interface {
	Uid() string
	Level() uint32
	Secret() string
	Counter() *atomic.Uint64
}

type UserValidator

type UserValidator interface {
	Validate(secret []byte) bool
}

Jump to

Keyboard shortcuts

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