mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 14:04:02 +03:00
Add telegram api
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package conntypes
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
const ConnIDLength = 8
|
||||
|
||||
type ConnID [ConnIDLength]byte
|
||||
|
||||
func (c ConnID) String() string {
|
||||
return hex.EncodeToString(c[:])
|
||||
}
|
||||
|
||||
func NewConnID() ConnID {
|
||||
var id ConnID
|
||||
|
||||
if _, err := rand.Read(id[:]); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return id
|
||||
}
|
||||
Reference in New Issue
Block a user