tcpip

package
v0.0.0-...-6aff857 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2018 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ICMP IPProtocol = 0x01
	TCP             = 0x06
	UDP             = 0x11
)

Variables

This section is empty.

Functions

func Checksum

func Checksum(sum uint32, b []byte) (answer [2]byte)

checksum for Internet Protocol family headers

func ConvertIPv4ToUint32

func ConvertIPv4ToUint32(ip net.IP) uint32

func ConvertUint32ToIPv4

func ConvertUint32ToIPv4(v uint32) net.IP

func IsIPv4

func IsIPv4(packet []byte) bool

func IsIPv6

func IsIPv6(packet []byte) bool

func Sum

func Sum(b []byte) uint32

Types

type ICMPPacket

type ICMPPacket []byte

func (ICMPPacket) Checksum

func (p ICMPPacket) Checksum() uint16

func (ICMPPacket) Code

func (p ICMPPacket) Code() byte

func (ICMPPacket) ResetChecksum

func (p ICMPPacket) ResetChecksum()

func (ICMPPacket) SetChecksum

func (p ICMPPacket) SetChecksum(sum [2]byte)

func (ICMPPacket) SetType

func (p ICMPPacket) SetType(v ICMPType)

func (ICMPPacket) Type

func (p ICMPPacket) Type() ICMPType

type ICMPType

type ICMPType byte
const (
	ICMPEcho    ICMPType = 0x0
	ICMPRequest          = 0x8
)

type IPProtocol

type IPProtocol byte

type IPv4Packet

type IPv4Packet []byte

func (IPv4Packet) Checksum

func (p IPv4Packet) Checksum() uint16

func (IPv4Packet) DataLen

func (p IPv4Packet) DataLen() uint16

func (IPv4Packet) DestinationIP

func (p IPv4Packet) DestinationIP() net.IP

func (IPv4Packet) HeaderLen

func (p IPv4Packet) HeaderLen() uint16

func (IPv4Packet) Payload

func (p IPv4Packet) Payload() []byte

func (IPv4Packet) Protocol

func (p IPv4Packet) Protocol() IPProtocol

func (IPv4Packet) PseudoSum

func (p IPv4Packet) PseudoSum() uint32

for tcp checksum

func (IPv4Packet) ResetChecksum

func (p IPv4Packet) ResetChecksum()

func (IPv4Packet) SetChecksum

func (p IPv4Packet) SetChecksum(sum [2]byte)

func (IPv4Packet) SetDestinationIP

func (p IPv4Packet) SetDestinationIP(ip net.IP)

func (IPv4Packet) SetSourceIP

func (p IPv4Packet) SetSourceIP(ip net.IP)

func (IPv4Packet) SourceIP

func (p IPv4Packet) SourceIP() net.IP

func (IPv4Packet) TotalLen

func (p IPv4Packet) TotalLen() uint16

type TCPPacket

type TCPPacket []byte

func (TCPPacket) Checksum

func (p TCPPacket) Checksum() uint16

func (TCPPacket) DestinationPort

func (p TCPPacket) DestinationPort() uint16

func (TCPPacket) ResetChecksum

func (p TCPPacket) ResetChecksum(psum uint32)

func (TCPPacket) SetChecksum

func (p TCPPacket) SetChecksum(sum [2]byte)

func (TCPPacket) SetDestinationPort

func (p TCPPacket) SetDestinationPort(port uint16)

func (TCPPacket) SetSourcePort

func (p TCPPacket) SetSourcePort(port uint16)

func (TCPPacket) SourcePort

func (p TCPPacket) SourcePort() uint16

type UDPPacket

type UDPPacket []byte

func (UDPPacket) Checksum

func (p UDPPacket) Checksum() uint16

func (UDPPacket) DestinationPort

func (p UDPPacket) DestinationPort() uint16

func (UDPPacket) ResetChecksum

func (p UDPPacket) ResetChecksum(psum uint32)

func (UDPPacket) SetChecksum

func (p UDPPacket) SetChecksum(sum [2]byte)

func (UDPPacket) SetDestinationPort

func (p UDPPacket) SetDestinationPort(port uint16)

func (UDPPacket) SetSourcePort

func (p UDPPacket) SetSourcePort(port uint16)

func (UDPPacket) SourcePort

func (p UDPPacket) SourcePort() uint16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL