nrpe

package module
v0.0.0-...-4ef91b1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NrpeV2MaxPacketDataLength = 1024
	NrpeV2PacketLength        = NrpeV2MaxPacketDataLength + 12
	NrpeV2PacketVersion       = 2

	NrpeV3PacketVersion = 3

	NrpeV4PacketVersion       = 4
	NrpeV4HeaderLength        = 16
	NrpeV4MaxPacketDataLength = 65536

	// id code for a packet containing a query.
	NrpeQueryPacket = 1
	// id code for a packet containing a response.
	NrpeResponsePacket = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

Packet stores nrpe request / response packet.

func BuildPacket

func BuildPacket(version, packetType, statusCode uint16, statusLine []byte) *Packet

BuildPacket creates packet structure.

func BuildPacketV2

func BuildPacketV2(packetType, statusCode uint16, statusLine []byte) *Packet

BuildPacketV2 creates new v2 packet structure.

func BuildPacketV4

func BuildPacketV4(packetType, statusCode uint16, statusLine []byte) *Packet

BuildPacketV4 creates new v4 packet structure.

func NewNrpePacket

func NewNrpePacket() *Packet

func ReadNrpePacket

func ReadNrpePacket(conn io.Reader) (*Packet, error)

Read reads packet from the wire.

func (*Packet) BuildCRC32

func (p *Packet) BuildCRC32() uint32

BuildCRC32 returns the crc32 checksum.

func (*Packet) Data

func (p *Packet) Data() (cmd string, args []string)

Data returns nrpe payload.

func (*Packet) Verify

func (p *Packet) Verify(packetType uint16) error

Verify checks type and the crc32 checksum.

func (*Packet) Version

func (p *Packet) Version() uint16

Version returns nrpe pkg version.

func (*Packet) Write

func (p *Packet) Write(conn io.Writer) error

Write sends the packet content to given connection.

Jump to

Keyboard shortcuts

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