Documentation
¶
Index ¶
- Constants
- Variables
- func BuildArpPkt(option uint16, srcMac []byte, srcAddr []byte, dstMac []byte, dstAddr []byte) (pkt []byte, err error)
- func BuildEthFrm(payload []byte, dstMac []byte, srcMac []byte, ethProto uint16) (frm []byte, err error)
- func BuildIcmpPkt(payload []byte, icmpType uint8, icmpId []byte, icmpSeq []byte) (pkt []byte, err error)
- func BuildIpv4Pkt(payload []byte, ipHeadProto uint8, srcAddr []byte, dstAddr []byte) (pkt []byte, err error)
- func BuildTcpAckPkt(srcPort uint16, dstPort uint16, srcAddr []byte, dstAddr []byte, seqNum uint32, ...) (pkt []byte, err error)
- func BuildTcpSynAckPkt(srcPort uint16, dstPort uint16, srcAddr []byte, dstAddr []byte, seqNum uint32, ...) (pkt []byte, err error)
- func BuildTcpSynPkt(srcPort uint16, dstPort uint16, srcAddr []byte, dstAddr []byte, seqNum uint32) (pkt []byte, err error)
- func BuildUdpPkt(payload []byte, srcPort uint16, dstPort uint16, srcAddr []byte, dstAddr []byte) (pkt []byte, err error)
- func GetCheckSum(data []byte) []byte
- func HandleIpv4PktTtl(pktRaw []byte) (pkt []byte, alive bool)
- func IpAddrToU(ipAddr []byte) (ipAddrU uint32)
- func NatChangeDst(pktRaw []byte, ipAddr []byte, port uint16) (pkt []byte)
- func NatChangeSrc(pktRaw []byte, ipAddr []byte, port uint16) (pkt []byte)
- func NatGetSrcDstPort(pkt []byte) (srcPort uint16, dstPort uint16)
- func ParseArpPkt(pkt []byte) (option uint16, srcMac []byte, srcAddr []byte, dstMac []byte, dstAddr []byte, ...)
- func ParseEthFrm(frm []byte) (payload []byte, dstMac []byte, srcMac []byte, ethProto uint16, err error)
- func ParseIcmpPkt(pkt []byte) (payload []byte, icmpType uint8, icmpId []byte, icmpSeq []byte, err error)
- func ParseIpv4Pkt(pkt []byte) (payload []byte, ipHeadProto uint8, srcAddr []byte, dstAddr []byte, err error)
- func ParseUdpPkt(pkt []byte, srcAddr []byte, dstAddr []byte) (payload []byte, srcPort uint16, dstPort uint16, err error)
- func ReCalcIpv4CheckSum(pktRaw []byte) (pkt []byte)
- func ReCalcTcpCheckSum(pktRaw []byte) (pkt []byte)
- func ReCalcUdpCheckSum(pktRaw []byte) (pkt []byte)
- func SetRandIpHeaderId()
- func UToIpAddr(ipAddrU uint32) (ipAddr []byte)
Constants ¶
View Source
const ( ARP_REQUEST uint16 = 0x0001 ARP_REPLY uint16 = 0x0002 ARP_UNKNOWN uint16 = 0xffff )
View Source
const ( IEEE_802_3 uint16 = 0x05dc ETH_PROTO_IPV4 uint16 = 0x0800 ETH_PROTO_ARP uint16 = 0x0806 ETH_PROTO_IPV6 uint16 = 0x86dd ETH_PROTO_UNKNOWN uint16 = 0xffff )
View Source
const ( ICMP_REQUEST uint8 = 0x08 ICMP_REPLY uint8 = 0x00 ICMP_UNKNOWN uint8 = 0xff )
View Source
const ( IPH_PROTO_ICMP uint8 = 0x01 IPH_PROTO_TCP uint8 = 0x06 IPH_PROTO_UDP uint8 = 0x11 IPH_PROTO_UNKNOWN uint8 = 0xff )
Variables ¶
View Source
var ICMP_DEFAULT_PAYLOAD = []byte{
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
}
Functions ¶
func BuildArpPkt ¶
func BuildEthFrm ¶
func BuildIcmpPkt ¶
func BuildIpv4Pkt ¶
func BuildTcpAckPkt ¶
func BuildTcpSynAckPkt ¶
func BuildTcpSynPkt ¶
func BuildUdpPkt ¶
func GetCheckSum ¶
func HandleIpv4PktTtl ¶ added in v1.0.1
func NatChangeDst ¶ added in v1.0.1
func NatChangeSrc ¶ added in v1.0.1
func NatGetSrcDstPort ¶ added in v1.0.1
func ParseArpPkt ¶
func ParseEthFrm ¶
func ParseIcmpPkt ¶
func ParseIpv4Pkt ¶
func ParseUdpPkt ¶
func ReCalcIpv4CheckSum ¶ added in v1.0.1
func ReCalcTcpCheckSum ¶ added in v1.0.1
func ReCalcUdpCheckSum ¶ added in v1.0.1
func SetRandIpHeaderId ¶
func SetRandIpHeaderId()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.