sniff

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sniffer

type Sniffer struct {
	Timeout       time.Duration
	RewriteDomain bool // Whether to rewrite the address even when it's already a domain
	TCPPorts      utils.PortUnion
	UDPPorts      utils.PortUnion
}

Sniffer is a server core RequestHook that performs packet inspection and possibly rewrites the request address based on what's in the protocol header. This is mainly for inbounds that inherently cannot get domain information (e.g. TUN), in which case sniffing can restore the domains and apply ACLs correctly. Currently supports HTTP, HTTPS (TLS) and QUIC.

func (*Sniffer) Check

func (h *Sniffer) Check(isUDP bool, reqAddr string) bool

func (*Sniffer) TCP

func (h *Sniffer) TCP(stream quic.Stream, reqAddr *string) ([]byte, error)

func (*Sniffer) UDP

func (h *Sniffer) UDP(data []byte, reqAddr *string) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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