MCPcopy Create free account
hub / github.com/blues/note / wireProcessVersionByteTrace

Function wireProcessVersionByteTrace

lib/wire.go:682–759  ·  view source on GitHub ↗

wireProcessVersionByteTrace processes version byte with optional verbose debugging output

(version byte, trace bool)

Source from the content-addressed store, hash-verified

680
681// wireProcessVersionByteTrace processes version byte with optional verbose debugging output
682func wireProcessVersionByteTrace(version byte, trace bool) (isValid bool, headerLength int) {
683 if trace {
684 fmt.Printf(" wireProcessVersionByte: version=0x%02x (%d)\n", version, version)
685 }
686
687 switch version {
688
689 // 1 byte version == 0
690 // 0 byte protobuf length
691 // 0 byte binary length
692 // 0 bytes protobuf
693 // 0 bytes binary
694 case 0:
695 if trace {
696 fmt.Printf(" Version 0: no header\n")
697 }
698 return true, 0
699
700 // 1 byte version == 1
701 // 1 byte protobuf length
702 // 1 byte binary length
703 // N bytes protobuf
704 // N bytes binary
705 case 1:
706 if trace {
707 fmt.Printf(" Version 1: 2-byte header (1 byte protobuf len, 1 byte binary len)\n")
708 }
709 return true, 2
710
711 // 1 byte version == 2
712 // 1 byte protobuf length
713 // 2 byte binary length
714 // N bytes protobuf
715 // N bytes binary
716 case 2:
717 if trace {
718 fmt.Printf(" Version 2: 3-byte header (1 byte protobuf len, 2 bytes binary len)\n")
719 }
720 return true, 3
721
722 // 1 byte version == 3
723 // 2 byte protobuf length
724 // 2 byte binary length
725 // N bytes protobuf
726 // N bytes binary
727 case 3:
728 if trace {
729 fmt.Printf(" Version 3: 4-byte header (2 bytes protobuf len, 2 bytes binary len)\n")
730 }
731 return true, 4
732
733 // 1 byte version == 4
734 // 4 byte protobuf length
735 // 4 byte binary length
736 // N bytes protobuf
737 // N bytes binary
738 case 4:
739 if trace {

Callers 2

wireProcessVersionByteFunction · 0.85
msgFromWireTraceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected