mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-16 18:37:51 +01:00
24 lines
633 B
Go
24 lines
633 B
Go
package packet
|
|
|
|
// Structure of packets and functions for writing/reading them
|
|
|
|
// ShutdownPacket is a UDT packet notifying the peer of connection shutdown
|
|
type ShutdownPacket struct {
|
|
ctrlHeader
|
|
}
|
|
|
|
// WriteTo writes this packet to the provided buffer, returning the length of the packet
|
|
func (p *ShutdownPacket) WriteTo(buf []byte) (uint, error) {
|
|
return p.writeHdrTo(buf, ptShutdown, 0)
|
|
}
|
|
|
|
func (p *ShutdownPacket) readFrom(data []byte) (err error) {
|
|
_, err = p.readHdrFrom(data)
|
|
return
|
|
}
|
|
|
|
// PacketType returns the packetType associated with this packet
|
|
func (p *ShutdownPacket) PacketType() PacketType {
|
|
return ptShutdown
|
|
}
|