Documentation ¶
Index ¶
- Variables
- func ParseIPZone(s string) (net.IP, string)
- func PaseNetwork(s string) statistic.Type
- func Value[T any](s interface{ ... }, k any, Default T) T
- type Address
- func ParseAddress(network statistic.Type, addr string) (ad Address, _ error)
- func ParseAddressSplit(network statistic.Type, addr string, port Port) (ad Address)
- func ParseIPAddr(ad *net.IPAddr) Address
- func ParseSysAddr(ad net.Addr) (Address, error)
- func ParseTCPAddress(ad *net.TCPAddr) Address
- func ParseUDPAddr(ad *net.UDPAddr) Address
- func ParseUnixAddr(ad *net.UnixAddr) Address
- type CurrentKey
- type DestinationKey
- type DialerResolverProxy
- type Discard
- type DiscardConn
- func (*DiscardConn) Close() error
- func (*DiscardConn) LocalAddr() net.Addr
- func (*DiscardConn) Read(b []byte) (n int, err error)
- func (*DiscardConn) RemoteAddr() net.Addr
- func (*DiscardConn) SetDeadline(t time.Time) error
- func (*DiscardConn) SetReadDeadline(t time.Time) error
- func (*DiscardConn) SetWriteDeadline(t time.Time) error
- func (*DiscardConn) Write(b []byte) (n int, err error)
- type DiscardPacketConn
- func (*DiscardPacketConn) Close() error
- func (*DiscardPacketConn) LocalAddr() net.Addr
- func (*DiscardPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)
- func (*DiscardPacketConn) SetDeadline(t time.Time) error
- func (*DiscardPacketConn) SetReadDeadline(t time.Time) error
- func (*DiscardPacketConn) SetWriteDeadline(t time.Time) error
- func (*DiscardPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)
- type DomainAddr
- func (d *DomainAddr) Hostname() string
- func (d *DomainAddr) IP() (net.IP, error)
- func (d *DomainAddr) IPHost() (string, error)
- func (d *DomainAddr) Network() string
- func (d *DomainAddr) NetworkType() statistic.Type
- func (d *DomainAddr) OverrideHostname(s string) Address
- func (d *DomainAddr) OverridePort(p Port) Address
- func (d *DomainAddr) Port() Port
- func (s *DomainAddr) RangeValue(f func(k, v any) bool)
- func (d *DomainAddr) String() string
- func (d *DomainAddr) TCPAddr() (*net.TCPAddr, error)
- func (d *DomainAddr) Type() Type
- func (d *DomainAddr) UDPAddr() (*net.UDPAddr, error)
- func (s *DomainAddr) Value(key any) (any, bool)
- func (d *DomainAddr) WithResolver(resolver dns.DNS, canCover bool) bool
- func (s *DomainAddr) WithValue(key, value any)
- func (d *DomainAddr) Zone() string
- type FakeIPKey
- type IPAddr
- type InboundKey
- type PacketProxy
- type Port
- type PortUint16
- type Proxy
- type ResolverProxy
- type SourceKey
- type StreamProxy
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var DiscardNetConn net.Conn = &DiscardConn{}
View Source
var DiscardNetPacketConn net.PacketConn = &DiscardPacketConn{}
Functions ¶
func PaseNetwork ¶
Types ¶
type Address ¶
type Address interface { // Hostname return hostname of address, eg: www.example.com, 127.0.0.1, ff::ff Hostname() string // IP return net.IP, if address is ip else resolve the domain and return one of ips IP() (net.IP, error) // Port return port of address Port() Port // Type return type of address, domain or ip Type() Type NetworkType() statistic.Type net.Addr // WithResolver will use call IP(), IPHost(), UDPAddr(), TCPAddr() // return the current resolver is applied, if can't cover return false WithResolver(_ dns.DNS, canCover bool) bool // OverrideHostname clone address(exclude Values) and change hostname OverrideHostname(string) Address OverridePort(Port) Address Zone() string // IPv6 scoped addressing zone UDPAddr() (*net.UDPAddr, error) TCPAddr() (*net.TCPAddr, error) // IPHost if address is ip, return host, else resolve domain to ip and return JoinHostPort(ip,port) IPHost() (string, error) WithValue(key, value any) Value(key any) (any, bool) RangeValue(func(k, v any) bool) }
var EmptyAddr Address = &emptyAddr{}
func ParseAddressSplit ¶
func ParseIPAddr ¶
func ParseTCPAddress ¶
func ParseUDPAddr ¶
func ParseUnixAddr ¶
type CurrentKey ¶
type CurrentKey struct{}
type DestinationKey ¶
type DestinationKey struct{}
func (DestinationKey) String ¶
func (DestinationKey) String() string
type DialerResolverProxy ¶
type DialerResolverProxy interface { Proxy ResolverProxy }
type Discard ¶
type Discard struct{}
func (Discard) PacketConn ¶
func (Discard) PacketConn(Address) (net.PacketConn, error)
type DiscardConn ¶
type DiscardConn struct{}
func (*DiscardConn) Close ¶
func (*DiscardConn) Close() error
func (*DiscardConn) LocalAddr ¶
func (*DiscardConn) LocalAddr() net.Addr
func (*DiscardConn) RemoteAddr ¶
func (*DiscardConn) RemoteAddr() net.Addr
func (*DiscardConn) SetDeadline ¶
func (*DiscardConn) SetDeadline(t time.Time) error
func (*DiscardConn) SetReadDeadline ¶
func (*DiscardConn) SetReadDeadline(t time.Time) error
func (*DiscardConn) SetWriteDeadline ¶
func (*DiscardConn) SetWriteDeadline(t time.Time) error
type DiscardPacketConn ¶
type DiscardPacketConn struct{}
func (*DiscardPacketConn) Close ¶
func (*DiscardPacketConn) Close() error
func (*DiscardPacketConn) LocalAddr ¶
func (*DiscardPacketConn) LocalAddr() net.Addr
func (*DiscardPacketConn) SetDeadline ¶
func (*DiscardPacketConn) SetDeadline(t time.Time) error
func (*DiscardPacketConn) SetReadDeadline ¶
func (*DiscardPacketConn) SetReadDeadline(t time.Time) error
func (*DiscardPacketConn) SetWriteDeadline ¶
func (*DiscardPacketConn) SetWriteDeadline(t time.Time) error
type DomainAddr ¶
type DomainAddr struct {
// contains filtered or unexported fields
}
func (*DomainAddr) Hostname ¶
func (d *DomainAddr) Hostname() string
func (*DomainAddr) IPHost ¶
func (d *DomainAddr) IPHost() (string, error)
func (*DomainAddr) Network ¶
func (d *DomainAddr) Network() string
func (*DomainAddr) NetworkType ¶
func (d *DomainAddr) NetworkType() statistic.Type
func (*DomainAddr) OverrideHostname ¶
func (d *DomainAddr) OverrideHostname(s string) Address
func (*DomainAddr) OverridePort ¶
func (d *DomainAddr) OverridePort(p Port) Address
func (*DomainAddr) Port ¶
func (d *DomainAddr) Port() Port
func (*DomainAddr) RangeValue ¶
func (s *DomainAddr) RangeValue(f func(k, v any) bool)
func (*DomainAddr) String ¶
func (d *DomainAddr) String() string
func (*DomainAddr) Type ¶
func (d *DomainAddr) Type() Type
func (*DomainAddr) WithResolver ¶
func (d *DomainAddr) WithResolver(resolver dns.DNS, canCover bool) bool
func (*DomainAddr) WithValue ¶
func (s *DomainAddr) WithValue(key, value any)
func (*DomainAddr) Zone ¶
func (d *DomainAddr) Zone() string
type IPAddr ¶
type IPAddr struct { Address // contains filtered or unexported fields }
func (IPAddr) OverridePort ¶
type InboundKey ¶
type InboundKey struct{}
func (InboundKey) String ¶
func (InboundKey) String() string
type PacketProxy ¶
type PacketProxy interface {
PacketConn(Address) (net.PacketConn, error)
}
type Port ¶
var EmptyPort Port = PortUint16(0)
func ParsePort ¶
func ParsePort[T constraints.Integer](p T) Port
func ParsePortStr ¶
type PortUint16 ¶
type PortUint16 uint16
func (PortUint16) Port ¶
func (p PortUint16) Port() uint16
func (PortUint16) String ¶
func (p PortUint16) String() string
type ResolverProxy ¶
func WrapDNS ¶
func WrapDNS(d dns.DNS) ResolverProxy
Click to show internal directories.
Click to hide internal directories.