cull fmt package use and prevent aggressive DCE in MWE example with TinyGo

This commit is contained in:
soypat
2026-09-01 09:39:10 -07:00
parent d219daa2c4
commit c97a32f3c1
14 changed files with 197 additions and 97 deletions
+6 -12
View File
@@ -2,8 +2,6 @@ package ipv4
import (
"encoding/binary"
"fmt"
"net/netip"
"github.com/soypat/lneto"
)
@@ -238,14 +236,10 @@ func (ifrm Frame) ValidateExceptCRC(v *lneto.Validator) {
}
func (ifrm Frame) String() string {
dst := netip.AddrFrom4(*ifrm.DestinationAddr())
src := netip.AddrFrom4(*ifrm.SourceAddr())
hl := ifrm.HeaderLength()
tl := int(ifrm.TotalLength())
ttl := ifrm.TTL()
id := ifrm.ID()
proto := ifrm.Protocol()
tos := ifrm.ToS()
return fmt.Sprintf("IP %s SRC=%s DST=%s LEN=%d OPT=%d TTL=%d ID=%d ToS=0x%x", proto.String(), src.String(), dst.String(), tl, tl-hl, ttl, id, tos)
proto := ifrm.Protocol().String()
b := make([]byte, 0, 5+len(proto))
b = append(b, "IP ("...)
b = append(b, proto...)
b = append(b, ')')
return string(b)
}