mirror of
https://github.com/soypat/lneto.git
synced 2026-08-20 14:39:02 +00:00
split out node callback between tinygo and go to avoid heap allocs
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//go:build !tinygo
|
||||
|
||||
package internet
|
||||
|
||||
func makecbnode(s StackNode) cbnode {
|
||||
return cbnode{
|
||||
_s: s,
|
||||
}
|
||||
}
|
||||
|
||||
type cbnode struct {
|
||||
// Do not access outside of handlers/node logic.
|
||||
_s StackNode
|
||||
}
|
||||
|
||||
func (s cbnode) Encapsulate(carrierData []byte, offsetToIP, offsetToFrame int) (int, error) {
|
||||
return s._s.Encapsulate(carrierData, offsetToIP, offsetToFrame)
|
||||
}
|
||||
|
||||
func (s cbnode) Demux(carrierData []byte, frameOffset int) error {
|
||||
return s._s.Demux(carrierData, frameOffset)
|
||||
}
|
||||
|
||||
func (s cbnode) IsZeroed() bool {
|
||||
return s._s == nil
|
||||
}
|
||||
Reference in New Issue
Block a user