Skip to content

Repository files navigation

lpstream

Note

This is purely for internal use! Please don't depend on this library in your own code, we don't make any compatibility/API stability guarantees!

What

Length-prefixed framing for QUIC & TCP streams, compatible with the TypeScript implementation used in the SDK. Uses protobuf-style varint encoding of length prefix markers.

Usage

Add module:

go get github.com/hardpointlabs/framer

Layer it on top of your io.Reader / io.Writer:

import (
    // ...
    "github.com/hardpointlabs/lpstream"
)

conn, _ := net.DialTimeout("tcp", "test-server:8124", 10*time.Second)
defer conn.Close()

encoder := lpstream.NewEncoder(conn)
decoder := lpstream.NewDecoder(conn)

// or use the codec type if you have a bidirectional stream
codec := lpstream.NewFrameCodec(conn)

encoder.WriteFrame([]byte("Hello, stream!"))

msg := decoder.ReadFrame()
// e.t.c...

About

Length-prefixed framing for QUIC/TCP streams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages