MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / MarshalBinary

Method MarshalBinary

tlsutil/ccache.go:46–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46func (e *sessionCacheEntry) MarshalBinary() (data []byte, err error) {
47 buf := new(bytes.Buffer)
48 _, _ = buf.Write(uintToVarintBytes(uint(len(e.formatVersion))))
49 _, _ = buf.WriteString(e.formatVersion)
50 _, _ = buf.Write(uintToVarintBytes(uint(len(e.ticket))))
51 _, _ = buf.Write(e.ticket)
52 _, _ = buf.Write(uintToVarintBytes(uint(len(e.state))))
53 _, _ = buf.Write(e.state)
54 return append([]byte(nil), buf.Bytes()...), nil
55}
56
57func (e *sessionCacheEntry) UnmarshalBinary(data []byte) error {
58 r := bytes.NewReader(data)

Callers 1

Calls 2

uintToVarintBytesFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected