nex-go/types.go
RedDuckss 686a59737c Properly send fragmented packets + godoc comments
Server now properly splits the packet payload into multiple fragments if needed.

Server settings now properly get defaults.

Added the basis for compression support, though it doesn't do anything right now.

Removed unused NEX type structs.

And finally, fixed all godoc and other linting issues.
2018-09-26 21:42:48 -04:00

31 lines
566 B
Go

package nex
import (
"bytes"
"strings"
)
// DataHolder represents a generic data holder
type DataHolder struct {
Name string
Length uint32
DataLength uint32
Data []byte
}
// NewStationURL returns a new station URL string
func NewStationURL(protocol string, JSON map[string]string) string {
var URLBuffer bytes.Buffer
URLBuffer.WriteString(protocol + ":/")
for key, value := range JSON {
option := key + "=" + value + ";"
URLBuffer.WriteString(option)
}
URL := URLBuffer.String()
URL = strings.TrimRight(URL, ";")
return URL
}