Source File
session.go
Belonging Package
github.com/gotd/td/internal/mtproto
package mtproto
import
// Session represents connection state.
type Session struct {
ID int64
Key crypto.AuthKey
Salt int64
}
// Session returns current connection session info.
func ( *Conn) () Session {
.updateSalt()
.sessionMux.RLock()
defer .sessionMux.RUnlock()
return Session{
Key: .authKey,
Salt: .salt,
ID: .sessionID,
}
}
// newSessionID sets session id to random value.
func ( *Conn) () error {
, := crypto.RandInt64(.rand)
if != nil {
return
}
.sessionMux.Lock()
defer .sessionMux.Unlock()
.sessionID =
return nil
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |