chore: Refactor package structure

This commit is contained in:
Adrian Rumpold
2024-01-04 18:49:54 +01:00
parent 13677eaf54
commit 001517eb15
5 changed files with 89 additions and 79 deletions

20
pkg/messages/options.go Normal file
View File

@@ -0,0 +1,20 @@
package messages
type Option struct {
Code OptionCode
Data []byte
}
func (o Option) Size() uint8 {
if len(o.Data) > 0 {
return uint8(o.Data[0])
}
return 0
}
type Options map[OptionCode]Option
func (opts Options) HasOption(code OptionCode) bool {
_, exists := opts[code]
return exists
}