tzsp_layer

package module
v0.0.0-...-08bc3e6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

tzsp-layer

TaZmen Sniffer Protocol (TZSP) layer for github.com/google/gopacket. This package implements easy way to extract the final payload or intermediate protocol data from TZSP packet.

About protocol

TZSP is encapsulation protocol for other protocols over UDP. Сommonly used for transferring sniffed packets from routers (e.g. Mikrotik Packet Sniffer) and IDS software.

Install

go get github.com/Yiivgeny/tzsp-layer

Usage

Import this package

import tzsp github.com/Yiivgeny/tzsp-layer

Decode packet data using the package layer

packet := gopacket.NewPacket(buffer, tzsp.LayerTypeTZSP, gopacket.Default)

// Extract data from the final protocol
data := packet.ApplicationLayer().Payload()

// or extract a specific layer (e.g., TCP)
tcpPacket := packet.TransportLayer()
Server example

Full example located in example/server.go and can be launched with go run example/server.go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LayerTypeTZSP = gopacket.RegisterLayerType(1000, gopacket.LayerTypeMetadata{Name: "TZSP", Decoder: gopacket.DecodeFunc(decodeTZSP)})

Functions

This section is empty.

Types

type Protocol

type Protocol uint16
const (
	ProtocolUnknown   Protocol = 0
	ProtocolEthernet  Protocol = 1
	ProtocolTokenRing Protocol = 2
	ProtocolSLIP      Protocol = 3
	ProtocolPPP       Protocol = 4
	ProtocolFDDI      Protocol = 5
	ProtocolRawUO     Protocol = 7
	ProtoIEEE80211    Protocol = 18
)

type TZSP

type TZSP struct {
	layers.BaseLayer

	Version       uint8
	Type          uint8
	EncapProtocol Protocol
	Tags          []Tag
}

func (*TZSP) DecodeFromBytes

func (tzsp *TZSP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*TZSP) LayerType

func (tzsp *TZSP) LayerType() gopacket.LayerType

func (*TZSP) NextLayerType

func (tzsp *TZSP) NextLayerType() gopacket.LayerType

type Tag

type Tag struct {
	Type   TagType
	Length uint8
	Data   []byte
}

type TagType

type TagType uint8
const (
	TagTypePadding TagType = 0x00
	TagTagEnd      TagType = 0x01
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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