From 3f9fdff782e9bc6ff5fed5144d8dc23eb0caf2d3 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Fri, 18 Apr 2025 14:49:37 +0200 Subject: [PATCH] feat: serialize data format --- hsp/constants.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hsp/constants.go b/hsp/constants.go index 4b87548..6b3b42e 100644 --- a/hsp/constants.go +++ b/hsp/constants.go @@ -6,6 +6,9 @@ import ( "strings" ) +// DO NOT CHANGE THIS +const HSP_PORT = "998" + const ( H_STATUS = "status" H_DATA_FORMAT = "data-format" @@ -70,3 +73,10 @@ func ParseDataFormat(format string) (*DataFormat, error) { }, nil } +func (df *DataFormat) String() string { + if df.Format == DF_BYTES { + return df.Format + } + return fmt.Sprintf("%s:%s", df.Format, df.Encoding) +} +