Skip to content

Commit

Permalink
Add some comments to the Association interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Dec 18, 2024
1 parent 2b3f746 commit 2f2268b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions service/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,20 @@ func (m *natmap) Close() error {
return err
}

// Association represents a UDP association that handles incoming packets
// and forwards them to a target connection.
type Association interface {
// HandlePacket processes a single incoming packet.
//
// pkt contains the raw packet data.
// lazySlice is the LazySlice that holds the pkt buffer, which should be
// released after the packet is processed.
HandlePacket(pkt []byte, lazySlice slicepool.LazySlice)

// Done returns a channel that is closed when the association is closed.
Done() <-chan struct{}

// Close closes the association and releases any associated resources.
Close() error
}

Expand Down

0 comments on commit 2f2268b

Please sign in to comment.