diff options
Diffstat (limited to 'core/data.go')
| -rw-r--r-- | core/data.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/data.go b/core/data.go index b25b853..9783c47 100644 --- a/core/data.go +++ b/core/data.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "fmt" "io" + "strings" "time" ) @@ -29,6 +30,7 @@ type ErrorType uint8 const ( ErrorUnknown ErrorType = 0x00 ErrorAuthFailed = 0x01 + ErrorNotFound = 0x02 ) type Frame struct { @@ -176,3 +178,12 @@ func decodeString(buf io.Reader, ptr *string) error { *ptr = string(strBytes) return nil } + +func ReadAddr(addr string) (string, string, error) { + channel, host, ok := strings.Cut(addr, "@") + if !ok { + return "", "", fmt.Errorf("invalid address") + } + + return channel, host, nil +} |
