split out node callback between tinygo and go to avoid heap allocs

This commit is contained in:
Patricio Whittingslow
2026-01-13 10:38:21 -03:00
parent f51cdf74b6
commit 2e6e66e691
6 changed files with 78 additions and 21 deletions
+26
View File
@@ -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
}