Documentation
¶
Index ¶
- func DumpConn(conn net.Conn, recv io.Writer, send io.Writer) net.Conn
- func IPv4ToInt(ip net.IP) uint32
- func ParseCIDR(cidr string) (net.IP, *net.IPNet, error)
- func ParseCIDRs(cidrs []string) ([]*net.IPNet, error)
- func ParseIP(ip string) net.IP
- type ConnDebugger
- type ConnDumper
- type DumpListener
- type LimitListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCIDR ¶
ParseCIDR parses s as a CIDR notation IP address and prefix length, like "192.0.2.0/24" or "2001:db8::/32", as defined in RFC 4632 and RFC 4291. If no mask supplyed, the default "/32" or "/128" will be appended. It returns the IP address and the network implied by the IP and prefix length. For example, ParseCIDR("192.0.2.1/24") returns the IP address 192.0.2.1 and the network 192.0.2.0/24.
func ParseCIDRs ¶
ParseCIDRs parse a string representation of an IP and returns a net.IP with the minimum byte representation or nil if input is invalid.
Types ¶
type ConnDebugger ¶
type ConnDebugger struct {
net.Conn
Writer io.Writer
RecvPrefix string
RecvSuffix string
SendPrefix string
SendSuffix string
Timestamp bool
// contains filtered or unexported fields
}
ConnDebugger a connection debug utility
func (*ConnDebugger) Close ¶
func (cd *ConnDebugger) Close() error
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
type ConnDumper ¶
ConnDumper a connection dump utility
func (*ConnDumper) Close ¶
func (cd *ConnDumper) Close() (err error)
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
type DumpListener ¶
type DumpListener struct {
net.Listener
Path string // dump path
RecvPrefix string
RecvSuffix string
SendPrefix string
SendSuffix string
Timestamp bool
// contains filtered or unexported fields
}
DumpListener a listener dump utility
func NewDumpListener ¶
func NewDumpListener(listener net.Listener, path string) *DumpListener
NewDumpListener wrap a net.conn for dump
func (*DumpListener) Accept ¶
func (dl *DumpListener) Accept() (conn net.Conn, err error)
Accept waits for and returns the next connection to the listener.
func (*DumpListener) Disable ¶
func (dl *DumpListener) Disable(disabled bool)
Disable disable the dumper or not
type LimitListener ¶
LimitListener a Listener that accepts at most n simultaneous connections from the provided Listener.
func NewLimitListener ¶
func NewLimitListener(l net.Listener, sema chan struct{}) *LimitListener
NewLimitListener create a Listener that accepts at most cap(sema) simultaneous connections from the provided Listener.
func (*LimitListener) Close ¶
func (ll *LimitListener) Close() error