Documentation ¶
Index ¶
- func Ntohs(in uint16) uint16
- func ToNetipAddr(in [4]uint32) netip.Addr
- func ToNetipAddrWithFamily(family uint8, in [4]uint32) (netip.Addr, error)
- type BBRInfo
- type Config
- type DCTCPInfo
- type Diag
- func (d *Diag) Close() error
- func (d *Diag) NetDump(opt *NetOption) ([]NetObject, error)
- func (d *Diag) SetOption(o netlink.ConnOption, enable bool) error
- func (d *Diag) TCPDump() ([]NetObject, error)
- func (d *Diag) UDPDump() ([]NetObject, error)
- func (d *Diag) UnixDump(opt *UnixOption) ([]UnixObject, error)
- type DiagMsg
- type InetDiagReqV2
- type MemInfo
- type NetAttribute
- type NetObject
- type NetOption
- type SockID
- type SockOpt
- type UnixAttribute
- type UnixDiagMsg
- type UnixDiagReq
- type UnixDiagRqLen
- type UnixDiagVfs
- type UnixObject
- type UnixOption
- type VegasInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToNetipAddr ¶
ToNetipAddr converts an IP in [4]uint32 representation to netip.Addr.
For the special case 0.0.0.0 or :: it can return an unspecified address. For details, see netip.IsUnspecified.
Types ¶
type Config ¶
type Config struct { // NetNS defines the network namespace NetNS int }
Config contains options for NETLINK_SOCK_DIAG
type Diag ¶
type Diag struct {
// contains filtered or unexported fields
}
Diag represents a netlink wrapper
func (*Diag) SetOption ¶
func (d *Diag) SetOption(o netlink.ConnOption, enable bool) error
SetOption allows to enable or disable netlink socket options.
func (*Diag) TCPDump ¶
Dump returns all TCP connections. It is a wrapper around (*Diag).NetDump(..) for IPPROTO_TCP and the families AF_INET and AF_INET6 for all TCP states.
func (*Diag) UDPDump ¶
Dump returns all TCP connections. It is a wrapper around (*Diag).NetDump(..) for IPPROTO_UDP and the families AF_INET and AF_INET6 for all UDP states.
func (*Diag) UnixDump ¶
func (d *Diag) UnixDump(opt *UnixOption) ([]UnixObject, error)
UnixDump returns Unix socket information.
type DiagMsg ¶
type DiagMsg struct { Family uint8 State uint8 Timer uint8 Retrans uint8 ID SockID Expires uint32 RQueue uint32 WQueue uint32 UID uint32 INode uint32 }
Based on inet_diag_msg
type InetDiagReqV2 ¶
type InetDiagReqV2 struct { Family uint8 Protocol uint8 Ext uint8 Pad uint8 States uint32 ID SockID }
Based on inet_diag_req_v2
type NetAttribute ¶
type NetAttribute struct { MemInfo *MemInfo VegasInfo *VegasInfo Cong *string TOS *uint8 TClass *uint8 Shutdown *uint8 DCTCPInfo *DCTCPInfo Protocol *uint8 SKV6Only *uint8 Mark *uint32 BBRInfo *BBRInfo ClassID *uint32 CGroupID *uint64 SockOpt *SockOpt }
NetAttribute contains various elements
type NetObject ¶
type NetObject struct { DiagMsg NetAttribute }
NetObject represents a network response
type SockID ¶
type SockID struct { SPort uint16 // in network byte order, use Ntohs() for host byte order DPort uint16 // in network byte order, use Ntohs() for host byte order Src [4]uint32 // use ToNetipAddr() for netip.Addr representation Dst [4]uint32 // use ToNetipAddr() for netip.Addr representation If uint32 Cookie [2]uint32 }
Based on inet_diag_sockid
type SockOpt ¶
Based on inet_diag_sockopt Bitfield1 and Bitfield2 are the Go representations for the following bit fields:
__u8 recverr:1, is_icsk:1, freebind:1, hdrincl:1, mc_loop:1, transparent:1, mc_all:1, nodefrag:1; __u8 bind_address_no_port:1, recverr_rfc4884:1, defer_connect:1, unused:5;
type UnixAttribute ¶
type UnixAttribute struct { Name *string Vfs *UnixDiagVfs RQLen *UnixDiagRqLen MemInfo *MemInfo Shutdown *uint8 UID *uint32 Peer *uint32 }
UnixAttribute contains various elements
type UnixDiagMsg ¶
type UnixDiagMsg struct { Family uint8 Type uint8 State uint8 Pad uint8 Ino uint32 Cookie [2]uint32 }
Based on unix_diag_msg
type UnixDiagReq ¶
type UnixDiagReq struct { Family uint8 Protocol uint8 Pad uint16 States uint32 Ino uint32 Show uint32 Cookie [2]uint32 }
Based on unix_diag_req
type UnixDiagRqLen ¶
Based on unix_diag_rqlen
type UnixObject ¶
type UnixObject struct { UnixDiagMsg UnixAttribute }
type UnixOption ¶
UnixOption defines a query to Unix sockets.