Skip to content

lobaro/slip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slip & slipmux

Implementation of SLIP (rfc-1055) in GoLang

In addition to the basic SLIP reader and writer there is also a SlipMux 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]

Releases

No releases published

Packages

No packages published

Languages