Documentation ¶
Index ¶
- func IsBlockError(err error) bool
- func LogLevel(err error) slog.Level
- type Accepter
- type Address
- func ParseAddress(network string, addr string) (ad Address, _ error)
- func ParseAddressPort(network string, addr string, port uint16) (ad Address)
- func ParseDomainPort(network string, addr string, port uint16) (ad Address)
- func ParseIPAddr(net string, ip net.IP, port uint16) Address
- func ParseNetipAddr(net string, ip netip.Addr, port uint16) Address
- func ParseSysAddr(ad net.Addr) (Address, error)
- type AddressNetwork
- type ChannelStreamListener
- type Context
- type ContextResolver
- type DNSRawRequest
- type DNSServer
- type DialError
- type DomainAddr
- type DomainAddress
- type DynamicProxy
- type EmptyDispatch
- type ErrorResolver
- type Handler
- type IPAddr
- type IPAddress
- type Listener
- type LogConn
- type LookupIPOption
- type Packet
- type PacketListener
- type PacketProxy
- type ProcessDumper
- type Proxy
- type Resolver
- type ResolverMode
- type Server
- type StreamListener
- type StreamMeta
- type StreamProxy
- type WriteBack
- type WriteBackFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBlockError ¶ added in v0.3.6
Types ¶
type Address ¶
type Address interface { // Hostname return hostname of address, eg: www.example.com, 127.0.0.1, ff::ff Hostname() string // Port return port of address Port() uint16 // IsFqdn return true if address is FQDN // fqdn must impl [DomainAddress] // otherwise must impl [IPAddress] IsFqdn() bool Equal(Address) bool net.Addr }
var EmptyAddr Address = &DomainAddr{hostname: unique.Make("")}
func ParseAddressPort ¶
func ParseDomainPort ¶ added in v0.3.5
func ParseNetipAddr ¶ added in v0.3.7
type AddressNetwork ¶ added in v0.3.7
type AddressNetwork byte
const ( Unknown AddressNetwork = iota TCP UDP IP )
func ParseAddressNetwork ¶ added in v0.3.7
func ParseAddressNetwork(network string) AddressNetwork
func (AddressNetwork) Network ¶ added in v0.3.7
func (n AddressNetwork) Network() string
type ChannelStreamListener ¶ added in v0.3.6
type ChannelStreamListener struct {
// contains filtered or unexported fields
}
func NewChannelStreamListener ¶ added in v0.3.6
func NewChannelStreamListener(addr net.Addr) *ChannelStreamListener
func (*ChannelStreamListener) Accept ¶ added in v0.3.6
func (c *ChannelStreamListener) Accept() (net.Conn, error)
func (*ChannelStreamListener) Addr ¶ added in v0.3.6
func (c *ChannelStreamListener) Addr() net.Addr
func (*ChannelStreamListener) Close ¶ added in v0.3.6
func (c *ChannelStreamListener) Close() error
func (*ChannelStreamListener) NewConn ¶ added in v0.3.6
func (c *ChannelStreamListener) NewConn(conn net.Conn)
type Context ¶ added in v0.3.6
type Context struct { Source net.Addr `metrics:"Source"` Inbound net.Addr `metrics:"Inbound"` Destination net.Addr `metrics:"Destination"` FakeIP net.Addr `metrics:"FakeIP"` Hosts net.Addr `metrics:"Hosts"` context.Context DomainString string `metrics:"DOMAIN"` IPString string `metrics:"IP"` Tag string `metrics:"Tag"` Hash string `metrics:"Hash"` // sniffy Protocol string `metrics:"Protocol"` Process string `metrics:"Process"` TLSServerName string `metrics:"TLS Servername"` HTTPHost string `metrics:"HTTP Host"` // dns resolver Component string `metrics:"Component"` Resolver ContextResolver `metrics:"-"` UDPMigrateID uint64 `metrics:"UDP MigrateID"` ForceMode bypass.Mode `metrics:"-"` SniffMode bypass.Mode `metrics:"-"` Mode bypass.Mode `metrics:"MODE"` ModeReason string `metrics:"MODE Reason"` SkipRoute bool `metrics:"-"` }
func GetContext ¶ added in v0.3.6
func WithContext ¶ added in v0.3.6
type ContextResolver ¶ added in v0.3.6
type ContextResolver struct { Resolver Resolver ResolverSelf Resolver Mode ResolverMode SkipResolve bool `metrics:"-"` ForceFakeIP bool `metrics:"-"` }
func (ContextResolver) Opts ¶ added in v0.3.6
func (r ContextResolver) Opts(reverse bool) []func(*LookupIPOption)
type DNSRawRequest ¶ added in v0.3.6
type DNSServer ¶ added in v0.3.5
type DNSServer interface { Server HandleUDP(context.Context, net.PacketConn) error HandleTCP(context.Context, net.Conn) error Do(context.Context, *DNSRawRequest) error }
var EmptyDNSServer DNSServer = &emptyDNSServer{}
type DialError ¶ added in v0.3.7
type DialError struct { // Op is the operation which caused the error, such as // "read" or "write". Op string // Net is the network type on which this error occurred, // such as "tcp" or "udp6". Net string Sniff string // Addr is the network address for which this error occurred. // For local operations, like Listen or SetDeadline, Addr is // the address of the local endpoint being manipulated. // For operations involving a remote network connection, like // Dial, Read, or Write, Addr is the remote address of that // connection. Addr net.Addr // Err is the error that occurred during the operation. // The Error method panics if the error is nil. Err error }
OpError is the error type usually returned by functions in the net package. It describes the operation, network type, and address of an error.
func NewDialError ¶ added in v0.3.7
type DomainAddr ¶
type DomainAddr struct { AddressNetwork // contains filtered or unexported fields }
func (*DomainAddr) Equal ¶ added in v0.3.7
func (d *DomainAddr) Equal(o Address) bool
func (*DomainAddr) Hostname ¶
func (d *DomainAddr) Hostname() string
func (*DomainAddr) IsFqdn ¶ added in v0.3.4
func (d *DomainAddr) IsFqdn() bool
func (*DomainAddr) Port ¶
func (d *DomainAddr) Port() uint16
func (*DomainAddr) String ¶
func (d *DomainAddr) String() string
func (*DomainAddr) UniqueHostname ¶ added in v0.3.7
func (d *DomainAddr) UniqueHostname() unique.Handle[string]
type DomainAddress ¶ added in v0.3.7
type DynamicProxy ¶
type DynamicProxy struct {
// contains filtered or unexported fields
}
func NewDynamicProxy ¶
func NewDynamicProxy(p Proxy) *DynamicProxy
func (*DynamicProxy) PacketConn ¶
func (d *DynamicProxy) PacketConn(ctx context.Context, a Address) (net.PacketConn, error)
func (*DynamicProxy) Set ¶
func (d *DynamicProxy) Set(p Proxy)
type EmptyDispatch ¶
type EmptyDispatch struct{}
type ErrorResolver ¶
func (ErrorResolver) Close ¶
func (e ErrorResolver) Close() error
func (ErrorResolver) LookupIP ¶
func (e ErrorResolver) LookupIP(_ context.Context, domain string, opts ...func(*LookupIPOption)) ([]net.IP, error)
func (ErrorResolver) Raw ¶
func (e ErrorResolver) Raw(_ context.Context, req dnsmessage.Question) (dnsmessage.Message, error)
type Handler ¶
type Handler interface { HandleStream(*StreamMeta) HandlePacket(*Packet) }
type IPAddr ¶ added in v0.3.5
type IPAddr struct { Addr netip.Addr AddressNetwork // contains filtered or unexported fields }
type Listener ¶ added in v0.3.3
type Listener interface { PacketListener StreamListener Server }
func NewListener ¶ added in v0.3.6
func NewListener(s net.Listener, p PacketListener) Listener
type LookupIPOption ¶ added in v0.3.4
type LookupIPOption struct {
Mode ResolverMode
}
type Packet ¶
type PacketListener ¶ added in v0.3.6
type PacketProxy ¶
type ProcessDumper ¶ added in v0.3.5
type Proxy ¶
type Proxy interface { StreamProxy PacketProxy Dispatch(context.Context, Address) (Address, error) }
func NewErrProxy ¶
type ResolverMode ¶ added in v0.3.6
type ResolverMode int
const ( ResolverModeNoSpecified ResolverMode = iota ResolverModePreferIPv6 ResolverModePreferIPv4 )
type StreamListener ¶ added in v0.3.6
type StreamMeta ¶
Click to show internal directories.
Click to hide internal directories.