Simple Binary Transfer Protocol for streaming transports implemented in go. It is meant to be as simple to use as HTTP but slimmer.
Data transfers have the following format
| ------------------------------------------- |
| SBTPvx | NULL | Content-Length | NULL |
| 6 bytes | 1 byte | 8 bytes | 1 bytes |
| ------------------------------------------- |
| Payload |
| Content-Length bytes |
| ------------------------------------------- |
| EOT |
| 1 byte |
| ------------------------------------------- |
SBTPvxis the protocol version spec, where x is the version numberContent-Lengthis a big-endian uint64Payloadis the data to be sent
Examples can be found in examples.
SBTP Packets are a container for a []byte payload. Packets implement the
io.ReaderFrom and io.WriterTo interfaces to
make send/recv over a net.Conn trivial.
The SBTP server is a struct containing convenience methods for starting and stopping an SBTP server given a
net.Listener that implements a SetDeadline method. The server contains a slice
of request handlers that process a request/response pair in order.
The SBTP client contains convenience methods for managing a net.Conn to an SBTP
server. After calling Connect() SBTP packets can be sent and received using the Request() method.