Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

id.go 305B

123456789101112131415161718192021222324
  1. package conntypes
  2. import (
  3. "crypto/rand"
  4. "encoding/hex"
  5. )
  6. const ConnIDLength = 8
  7. type ConnID [ConnIDLength]byte
  8. func (c ConnID) String() string {
  9. return hex.EncodeToString(c[:])
  10. }
  11. func NewConnID() ConnID {
  12. var id ConnID
  13. if _, err := rand.Read(id[:]); err != nil {
  14. panic(err)
  15. }
  16. return id
  17. }