testing routine

This commit is contained in:
2025-01-21 22:30:14 +01:00
parent f814e3a1f9
commit 0c9621ef70
3 changed files with 60 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package netproto
import (
"encoding/base64"
"encoding/json"
)
type MainHeader struct {
@@ -121,6 +122,18 @@ func DecodeBase64(input string) (string, error) {
return string(d), nil
}
func ToJSON(input interface{}) (string, error) {
b, err := json.Marshal(input)
if err != nil {
return "", err
}
return string(b), nil
}
func FromJSON(input string, output interface{}) error {
return json.Unmarshal([]byte(input), output)
}
type ExtensionHeader struct {
Type uint8 `json:"type"`
Meta map[string]string `json:"meta"`