Documentation ¶
Overview ¶
Package packet provides access to ipv6 packet handling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MTUByteReader ¶
MTUByteReader extends io.Reader by allowing to query the MTU size.
type MTUReader ¶
type MTUReader struct {
// contains filtered or unexported fields
}
MTUReader reads IP packets over a non streamed (one IP packets is put into one read) MTU restricted connection. Consecutive packet reads use the same buffer.
func NewMTUReader ¶
func NewMTUReader(reader MTUByteReader) *MTUReader
NewMTUReader creates a mew MTUReader with the given MTUByteReader as its source.
func (*MTUReader) ReadPacket ¶
ReadPacket reads an IP packet from the stream. When receiving a packet that is larger then the last queried MTU size it is dropped, the buffer is resized to the current MTU size and a new read is performed.
type Packet ¶
Packet is a ipv6.Header and a slice of the whole marshalled packet.
type ReadWriteCloser ¶
type ReadWriteCloser struct { io.ReadWriteCloser Reader }
ReadWriteCloser provides the functionality of Reader, allows writing ip packets and forwards functionality of io.ReadWriteCloser.
func NewReadWriteCloser ¶
func NewReadWriteCloser(sub io.ReadWriteCloser, reader Reader) *ReadWriteCloser
NewReadWriteCloser creates a new ReadWriteCloser with sub as the underlying io.ReadWriteCloser and reader as Reader implementation.
func (*ReadWriteCloser) WritePacket ¶
func (r *ReadWriteCloser) WritePacket(p *Packet) error
WritePacket writes the marshalled form of Packet over the stream.
type StreamReader ¶
type StreamReader struct {
// contains filtered or unexported fields
}
StreamReader reads ip packets from a stream (not a tun).
func NewStreamReader ¶
func NewStreamReader(reader io.Reader) *StreamReader
NewStreamReader creates a new NewStreamReader with the unterlying reader.
func (*StreamReader) ReadPacket ¶
func (n *StreamReader) ReadPacket() (*Packet, error)
ReadPacket reads an IP packet from the stream.