Documentation ¶
Index ¶
- Constants
- Variables
- func NewInetDiagRequest() *nl.NetlinkRequest
- type InetDiagMsg
- type InetDiagReqV2
- type InetDiagSockId
- func (id *InetDiagSockId) DstIP() net.IP
- func (id *InetDiagSockId) DstIPv4() net.IP
- func (id *InetDiagSockId) DstIPv6() net.IP
- func (id *InetDiagSockId) DstPort() int
- func (id *InetDiagSockId) SrcIP() net.IP
- func (id *InetDiagSockId) SrcIPv4() net.IP
- func (id *InetDiagSockId) SrcIPv6() net.IP
- func (id *InetDiagSockId) SrcPort() int
- func (id *InetDiagSockId) String() string
Constants ¶
View Source
const ( TCP_ESTABLISHED = iota TCP_SYN_SENT TCP_SYN_RECV TCP_FIN_WAIT1 TCP_FIN_WAIT2 TCP_TIME_WAIT TCP_CLOSE TCP_CLOSE_WAIT TCP_LAST_ACK TCP_LISTEN TCP_CLOSING )
netinet/tcp.h
View Source
const (
SOCK_DIAG_BY_FAMILY = 20 // linux/sock_diag.h
)
View Source
const (
SizeofInetDiagReqV2 = 0x38
)
View Source
const (
TCP_ALL = 0xFFF
)
Variables ¶
View Source
var DiagFamilyMap = map[uint8]string{ syscall.AF_INET: "tcp", syscall.AF_INET6: "tcp6", }
View Source
var TcpStatesMap = map[uint8]string{ TCP_ESTABLISHED: "established", TCP_SYN_SENT: "syn_sent", TCP_SYN_RECV: "syn_recv", TCP_FIN_WAIT1: "fin_wait1", TCP_FIN_WAIT2: "fin_wait2", TCP_TIME_WAIT: "time_wait", TCP_CLOSE: "close", TCP_CLOSE_WAIT: "close_wait", TCP_LAST_ACK: "last_ack", TCP_LISTEN: "listen", TCP_CLOSING: "closing", }
Functions ¶
func NewInetDiagRequest ¶
func NewInetDiagRequest() *nl.NetlinkRequest
Types ¶
type InetDiagMsg ¶
type InetDiagMsg struct { IDiagFamily uint8 IDiagState uint8 IDiagTimer uint8 IDiagRetrans uint8 Id InetDiagSockId IDiagExpires uint32 IDiagRqueue uint32 IDiagWqueue uint32 IDiagUid uint32 IDiagInode uint32 }
func ParseInetDiagMsg ¶
func ParseInetDiagMsg(data []byte) *InetDiagMsg
func (*InetDiagMsg) String ¶
func (msg *InetDiagMsg) String() string
type InetDiagReqV2 ¶
type InetDiagReqV2 struct { SDiagFamily uint8 SDiagProtocol uint8 IDiagExt uint8 Pad uint8 IDiagStates uint32 Id InetDiagSockId }
func NewInetDiagReqV2 ¶
func NewInetDiagReqV2(family, protocol uint8, states uint32) *InetDiagReqV2
func (*InetDiagReqV2) Len ¶
func (req *InetDiagReqV2) Len() int
func (*InetDiagReqV2) Serialize ¶
func (req *InetDiagReqV2) Serialize() []byte
type InetDiagSockId ¶
type InetDiagSockId struct { IDiagSPort be16 IDiagDPort be16 IDiagSrc [4]be32 IDiagDst [4]be32 IDiagIf uint32 IDiagCookie [2]uint32 }
linux/inet_diag.h
func (*InetDiagSockId) DstIP ¶
func (id *InetDiagSockId) DstIP() net.IP
func (*InetDiagSockId) DstIPv4 ¶
func (id *InetDiagSockId) DstIPv4() net.IP
func (*InetDiagSockId) DstIPv6 ¶
func (id *InetDiagSockId) DstIPv6() net.IP
func (*InetDiagSockId) DstPort ¶
func (id *InetDiagSockId) DstPort() int
func (*InetDiagSockId) SrcIP ¶
func (id *InetDiagSockId) SrcIP() net.IP
func (*InetDiagSockId) SrcIPv4 ¶
func (id *InetDiagSockId) SrcIPv4() net.IP
func (*InetDiagSockId) SrcIPv6 ¶
func (id *InetDiagSockId) SrcIPv6() net.IP
func (*InetDiagSockId) SrcPort ¶
func (id *InetDiagSockId) SrcPort() int
func (*InetDiagSockId) String ¶
func (id *InetDiagSockId) String() string
Click to show internal directories.
Click to hide internal directories.