pcapx

package
v1.2.0-sp8 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: AGPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PublicGatewayAddress   net.IP
	PublicPreferredAddress net.IP
	PublicInterface        *net.Interface
)
View Source
var (
	Exports = map[string]interface{}{
		"GetStatistics":      getStatistics,
		"InjectRaw":          InjectRaw,
		"InjectIP":           InjectTCPIP,
		"InjectTCP":          InjectTCPIP,
		"InjectHTTPRequest":  InjectHTTPRequest,
		"InjectChaosTraffic": InjectChaosTraffic,
	}
)

Functions

func CreateTCPHandshakePackets

func CreateTCPHandshakePackets(src, dst string, payload []byte) (
	*TCPIPFrame,
	*TCPIPFrame,
	*TCPIPFrame,
	[]*TCPIPFrame,
	*TCPIPFrame,
	error,
)

func GetPublicLinkLayer

func GetPublicLinkLayer(t layers.EthernetType, toServer bool) (*layers.Ethernet, error)

func GetPublicRoute

func GetPublicRoute() (*net.Interface, net.IP, net.IP, error)

func GetPublicToClientLinkLayerIPv4

func GetPublicToClientLinkLayerIPv4() (*layers.Ethernet, error)

func GetPublicToClientLinkLayerIPv6

func GetPublicToClientLinkLayerIPv6() (*layers.Ethernet, error)

func GetPublicToServerLinkLayerIPv4

func GetPublicToServerLinkLayerIPv4() (*layers.Ethernet, error)

func GetPublicToServerLinkLayerIPv6

func GetPublicToServerLinkLayerIPv6() (*layers.Ethernet, error)

func InjectChaosTraffic

func InjectChaosTraffic(t *chaosmaker.ChaosTraffic, opts ...ConfigOption)

func InjectHTTPRequest

func InjectHTTPRequest(raw []byte, opt ...ConfigOption)

func InjectICMPIP

func InjectICMPIP(raw []byte, opt ...ConfigOption)

func InjectRaw

func InjectRaw(raw []byte, opt ...ConfigOption)

func InjectTCPIP

func InjectTCPIP(raw []byte, opt ...ConfigOption)

func InjectTCPIPInstance

func InjectTCPIPInstance(raw *TCPIPFrame, opt ...ConfigOption)

func InjectTCPPayload

func InjectTCPPayload(payload []byte, opt ...ConfigOption)

func InjectUDPIP

func InjectUDPIP(raw []byte, opt ...ConfigOption)

func ParseICMPIPv4

func ParseICMPIPv4(raw []byte) (*layers.IPv4, *layers.ICMPv4, gopacket.Payload, error)

func ParseLinkLayer

func ParseLinkLayer(raw []byte) (*layers.Ethernet, *layers.IPv4, *layers.TCP, error)

func ParseSrcNDstAddress

func ParseSrcNDstAddress(src, dst string) (net.IP, net.IP, uint16, uint16, error)

func ParseTCPIPv4

func ParseTCPIPv4(raw []byte) (*layers.IPv4, *layers.TCP, gopacket.Payload, error)

func ParseTCPRaw

func ParseTCPRaw(raw []byte) (*layers.IPv4, *layers.TCP, gopacket.Payload, error)

func ParseUDPIPv4

func ParseUDPIPv4(raw []byte) (*layers.IPv4, *layers.UDP, gopacket.Payload, error)

func RegenerateTCPTraffic

func RegenerateTCPTraffic(raw []byte, localIPAddress string, opt ...ConfigOption)

Types

type Config

type Config struct {
	Iface       string
	ToServerSet bool
	ToServer    bool
	IsHttps     bool

	TCPLocalAddress  string
	TCPRemoteAddress string
}

type ConfigOption

type ConfigOption func(config *Config)

func WithIface

func WithIface(iface string) ConfigOption

func WithLocalAddress

func WithLocalAddress(addr string) ConfigOption

func WithRemoteAddress

func WithRemoteAddress(addr string) ConfigOption

func WithToClient

func WithToClient() ConfigOption

func WithToServer

func WithToServer() ConfigOption

type Statistics

type Statistics struct {
	LinkLayerStatistics           map[string]int64
	NetworkLayerStatistics        map[string]int64
	TransportationLayerStatistics map[string]int64
	ICMPStatistics                map[string]int64
}

func GetGlobalStatistics

func GetGlobalStatistics() *Statistics

func NewStatistics

func NewStatistics() *Statistics

func (*Statistics) AddICMPStatistics

func (s *Statistics) AddICMPStatistics(name string)

func (*Statistics) AddLinkLayerStatistics

func (s *Statistics) AddLinkLayerStatistics(name string)

func (*Statistics) AddNetworkLayerStatistics

func (s *Statistics) AddNetworkLayerStatistics(name string)

func (*Statistics) AddTransportationLayerStatistics

func (s *Statistics) AddTransportationLayerStatistics(name string)

type TCPIPFrame

type TCPIPFrame struct {
	ToServer bool
	IP       *layers.IPv4
	TCP      *layers.TCP
}

Jump to

Keyboard shortcuts

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