package mt
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type ServerDHInnerData struct {
Nonce bin .Int128
ServerNonce bin .Int128
G int
DhPrime []byte
GA []byte
ServerTime int
}
const ServerDHInnerDataTypeID = 0xb5890dba
var (
_ bin .Encoder = &ServerDHInnerData {}
_ bin .Decoder = &ServerDHInnerData {}
_ bin .BareEncoder = &ServerDHInnerData {}
_ bin .BareDecoder = &ServerDHInnerData {}
)
func (s *ServerDHInnerData ) Zero () bool {
if s == nil {
return true
}
if !(s .Nonce == bin .Int128 {}) {
return false
}
if !(s .ServerNonce == bin .Int128 {}) {
return false
}
if !(s .G == 0 ) {
return false
}
if !(s .DhPrime == nil ) {
return false
}
if !(s .GA == nil ) {
return false
}
if !(s .ServerTime == 0 ) {
return false
}
return true
}
func (s *ServerDHInnerData ) String () string {
if s == nil {
return "ServerDHInnerData(nil)"
}
type Alias ServerDHInnerData
return fmt .Sprintf ("ServerDHInnerData%+v" , Alias (*s ))
}
func (*ServerDHInnerData ) TypeID () uint32 {
return ServerDHInnerDataTypeID
}
func (*ServerDHInnerData ) TypeName () string {
return "server_DH_inner_data"
}
func (s *ServerDHInnerData ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "server_DH_inner_data" ,
ID : ServerDHInnerDataTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "G" ,
SchemaName : "g" ,
},
{
Name : "DhPrime" ,
SchemaName : "dh_prime" ,
},
{
Name : "GA" ,
SchemaName : "g_a" ,
},
{
Name : "ServerTime" ,
SchemaName : "server_time" ,
},
}
return typ
}
func (s *ServerDHInnerData ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode server_DH_inner_data#b5890dba as nil" )
}
b .PutID (ServerDHInnerDataTypeID )
return s .EncodeBare (b )
}
func (s *ServerDHInnerData ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode server_DH_inner_data#b5890dba as nil" )
}
b .PutInt128 (s .Nonce )
b .PutInt128 (s .ServerNonce )
b .PutInt (s .G )
b .PutBytes (s .DhPrime )
b .PutBytes (s .GA )
b .PutInt (s .ServerTime )
return nil
}
func (s *ServerDHInnerData ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode server_DH_inner_data#b5890dba to nil" )
}
if err := b .ConsumeID (ServerDHInnerDataTypeID ); err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ServerDHInnerData ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode server_DH_inner_data#b5890dba to nil" )
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: field nonce: %w" , err )
}
s .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: field server_nonce: %w" , err )
}
s .ServerNonce = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: field g: %w" , err )
}
s .G = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: field dh_prime: %w" , err )
}
s .DhPrime = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: field g_a: %w" , err )
}
s .GA = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_inner_data#b5890dba: field server_time: %w" , err )
}
s .ServerTime = value
}
return nil
}
func (s *ServerDHInnerData ) GetNonce () (value bin .Int128 ) {
if s == nil {
return
}
return s .Nonce
}
func (s *ServerDHInnerData ) GetServerNonce () (value bin .Int128 ) {
if s == nil {
return
}
return s .ServerNonce
}
func (s *ServerDHInnerData ) GetG () (value int ) {
if s == nil {
return
}
return s .G
}
func (s *ServerDHInnerData ) GetDhPrime () (value []byte ) {
if s == nil {
return
}
return s .DhPrime
}
func (s *ServerDHInnerData ) GetGA () (value []byte ) {
if s == nil {
return
}
return s .GA
}
func (s *ServerDHInnerData ) GetServerTime () (value int ) {
if s == nil {
return
}
return s .ServerTime
}
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 .