mirror of
https://github.com/soypat/lneto.git
synced 2026-08-05 07:27:54 +00:00
80e4c59ae7
* try to include tinygo into CI * fix tinygo issues
33 lines
789 B
Go
33 lines
789 B
Go
//go:build tinygo
|
|
|
|
package internet
|
|
|
|
import "github.com/soypat/lneto"
|
|
|
|
func makecbnode(s lneto.StackNode) cbnode {
|
|
return cbnode{
|
|
_demux: s.Demux,
|
|
_encapsulate: s.Encapsulate,
|
|
}
|
|
}
|
|
|
|
type cbnode struct {
|
|
// Do not access outside of handlers/node logic.
|
|
_demux func([]byte, int) error
|
|
// Do not access outside of handlers/node logic.
|
|
_encapsulate func([]byte, int, int) (int, error)
|
|
}
|
|
|
|
func (s *cbnode) Encapsulate(carrierData []byte, offsetToIP, offsetToFrame int) (int, error) {
|
|
return s._encapsulate(carrierData, offsetToIP, offsetToFrame)
|
|
}
|
|
|
|
func (s *cbnode) Demux(carrierData []byte, frameOffset int) error {
|
|
debugLog("cbnode:pre-demux")
|
|
return s._demux(carrierData, frameOffset)
|
|
}
|
|
|
|
func (s cbnode) IsZeroed() bool {
|
|
return s._demux == nil || s._encapsulate == nil
|
|
}
|