Files
showbridge-go/internal/framer/framer.go
2025-12-24 18:17:41 -06:00

26 lines
469 B
Go

package framer
type Framer interface {
Decode([]byte) [][]byte
Encode([]byte) []byte
Clear()
Buffer() []byte
}
func GetFramer(framingType string) Framer {
switch framingType {
case "CR":
return NewByteSeparatorFramer([]byte{'\r'})
case "LF":
return NewByteSeparatorFramer([]byte{'\n'})
case "CRLF":
return NewByteSeparatorFramer([]byte{'\r', '\n'})
case "SLIP":
return NewSlipFramer()
case "RAW":
return NewRawFramer()
default:
return nil
}
}