]> git.r.bdr.sh - rbdr/mobius/blob - hotline/util.go
Fix bug that clears account password on permission edit
[rbdr/mobius] / hotline / util.go
1 package hotline
2
3 import (
4 "encoding/binary"
5 "errors"
6 )
7
8 func byteToInt(bytes []byte) (int, error) {
9 switch len(bytes) {
10 case 2:
11 return int(binary.BigEndian.Uint16(bytes)), nil
12 case 4:
13 return int(binary.BigEndian.Uint32(bytes)), nil
14 }
15
16 return 0, errors.New("unknown byte length")
17 }