mirror of
https://github.com/soypat/lneto.git
synced 2026-08-17 21:24:04 +00:00
Add fuzz tests, rename fuzz tests and fix panic found by fuzzing (#72)
* begin adding better fuzz test * finish adding working fuzzer * implement mutateipv4 * fuzzer finds a panic in ICMP client on receive empty payload * rename fuzz tests to reflect fuzz methodology
This commit is contained in:
@@ -164,6 +164,11 @@ func (h *Handler) Read(b []byte) (int, error) {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// IsOpen returns true if the handler can send/receive data.
|
||||
func (h *Handler) IsOpen() bool {
|
||||
return !h.closeCalled && h.lport > 0
|
||||
}
|
||||
|
||||
// Close closes the connection. Calls to [Handler.Send] and [Handler.Recv] will
|
||||
// return [net.ErrClosed] after Close is called.
|
||||
func (h *Handler) Close() {
|
||||
@@ -212,3 +217,14 @@ func (h *Handler) SizeInput() int {
|
||||
func (h *Handler) SizeOutput() int {
|
||||
return h.txRing.Size()
|
||||
}
|
||||
|
||||
// FreeOutput returns the number of free bytes in the transmit buffer.
|
||||
// This tells the user how many bytes can be written with Write method before write failing.
|
||||
func (h *Handler) FreeOutput() int {
|
||||
return h.txRing.Free()
|
||||
}
|
||||
|
||||
// FreeInput returns the number of free bytes in the receive buffer.
|
||||
func (h *Handler) FreeInput() int {
|
||||
return h.rxRing.Free()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user