https://github.com/lobaro/slip
Implementation of SLIP (RFC-1055) and slipmux in Go
https://github.com/lobaro/slip
rs232 slip uart
Last synced: 23 days ago
JSON representation
Implementation of SLIP (RFC-1055) and slipmux in Go
- Host: GitHub
- URL: https://github.com/lobaro/slip
- Owner: lobaro
- License: mit
- Created: 2016-12-06T14:11:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-04T16:43:18.000Z (about 8 years ago)
- Last Synced: 2025-03-27T19:21:34.193Z (6 months ago)
- Topics: rs232, slip, uart
- Language: Go
- Homepage: https://tools.ietf.org/html/draft-bormann-t2trg-slipmux-00
- Size: 20.5 KB
- Stars: 20
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slip & slipmux
Implementation of [SLIP (rfc-1055)](https://tools.ietf.org/html/rfc1055) in GoLangIn addition to the basic SLIP reader and writer there is also a [SlipMux](https://tools.ietf.org/html/draft-bormann-t2trg-slipmux-00) implementation, that enables sending different packet types like CoAP and Diagnostic messages over serial line. This is implemented backward compatible to SLIP implementations which support only IP packets.
If needed, further packet types can be implemented by the user of the library.
# Install
```
go get -u github.com/Lobaro/slip
```# Usage (SLIP)
```
import github.com/Lobaro/slip
```Read Packets
```
data := []byte{1, 2, 3, slip.END}
reader := slip.NewReader(bytes.NewReader(data))
packet, isPrefix, err := reader.ReadPacket()// packet == [1, 2, 3]
// isPrefix == false
// err == io.EOF
```Write Packets
```
buf := &bytes.Buffer{}
writer := slip.NewWriter(buf)
err := writer.WritePacket([]byte{1, 2, 3})// buf.Bytes() == [END, 1, 2, 3, END]
```