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 ServerDHParamsFail struct {
Nonce bin .Int128
ServerNonce bin .Int128
NewNonceHash bin .Int128
}
const ServerDHParamsFailTypeID = 0x79cb045d
func (s ServerDHParamsFail ) construct () ServerDHParamsClass { return &s }
var (
_ bin .Encoder = &ServerDHParamsFail {}
_ bin .Decoder = &ServerDHParamsFail {}
_ bin .BareEncoder = &ServerDHParamsFail {}
_ bin .BareDecoder = &ServerDHParamsFail {}
_ ServerDHParamsClass = &ServerDHParamsFail {}
)
func (s *ServerDHParamsFail ) Zero () bool {
if s == nil {
return true
}
if !(s .Nonce == bin .Int128 {}) {
return false
}
if !(s .ServerNonce == bin .Int128 {}) {
return false
}
if !(s .NewNonceHash == bin .Int128 {}) {
return false
}
return true
}
func (s *ServerDHParamsFail ) String () string {
if s == nil {
return "ServerDHParamsFail(nil)"
}
type Alias ServerDHParamsFail
return fmt .Sprintf ("ServerDHParamsFail%+v" , Alias (*s ))
}
func (*ServerDHParamsFail ) TypeID () uint32 {
return ServerDHParamsFailTypeID
}
func (*ServerDHParamsFail ) TypeName () string {
return "server_DH_params_fail"
}
func (s *ServerDHParamsFail ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "server_DH_params_fail" ,
ID : ServerDHParamsFailTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "NewNonceHash" ,
SchemaName : "new_nonce_hash" ,
},
}
return typ
}
func (s *ServerDHParamsFail ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode server_DH_params_fail#79cb045d as nil" )
}
b .PutID (ServerDHParamsFailTypeID )
return s .EncodeBare (b )
}
func (s *ServerDHParamsFail ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode server_DH_params_fail#79cb045d as nil" )
}
b .PutInt128 (s .Nonce )
b .PutInt128 (s .ServerNonce )
b .PutInt128 (s .NewNonceHash )
return nil
}
func (s *ServerDHParamsFail ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode server_DH_params_fail#79cb045d to nil" )
}
if err := b .ConsumeID (ServerDHParamsFailTypeID ); err != nil {
return fmt .Errorf ("unable to decode server_DH_params_fail#79cb045d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ServerDHParamsFail ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode server_DH_params_fail#79cb045d to nil" )
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_params_fail#79cb045d: field nonce: %w" , err )
}
s .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_params_fail#79cb045d: field server_nonce: %w" , err )
}
s .ServerNonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_params_fail#79cb045d: field new_nonce_hash: %w" , err )
}
s .NewNonceHash = value
}
return nil
}
func (s *ServerDHParamsFail ) GetNonce () (value bin .Int128 ) {
if s == nil {
return
}
return s .Nonce
}
func (s *ServerDHParamsFail ) GetServerNonce () (value bin .Int128 ) {
if s == nil {
return
}
return s .ServerNonce
}
func (s *ServerDHParamsFail ) GetNewNonceHash () (value bin .Int128 ) {
if s == nil {
return
}
return s .NewNonceHash
}
type ServerDHParamsOk struct {
Nonce bin .Int128
ServerNonce bin .Int128
EncryptedAnswer []byte
}
const ServerDHParamsOkTypeID = 0xd0e8075c
func (s ServerDHParamsOk ) construct () ServerDHParamsClass { return &s }
var (
_ bin .Encoder = &ServerDHParamsOk {}
_ bin .Decoder = &ServerDHParamsOk {}
_ bin .BareEncoder = &ServerDHParamsOk {}
_ bin .BareDecoder = &ServerDHParamsOk {}
_ ServerDHParamsClass = &ServerDHParamsOk {}
)
func (s *ServerDHParamsOk ) Zero () bool {
if s == nil {
return true
}
if !(s .Nonce == bin .Int128 {}) {
return false
}
if !(s .ServerNonce == bin .Int128 {}) {
return false
}
if !(s .EncryptedAnswer == nil ) {
return false
}
return true
}
func (s *ServerDHParamsOk ) String () string {
if s == nil {
return "ServerDHParamsOk(nil)"
}
type Alias ServerDHParamsOk
return fmt .Sprintf ("ServerDHParamsOk%+v" , Alias (*s ))
}
func (*ServerDHParamsOk ) TypeID () uint32 {
return ServerDHParamsOkTypeID
}
func (*ServerDHParamsOk ) TypeName () string {
return "server_DH_params_ok"
}
func (s *ServerDHParamsOk ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "server_DH_params_ok" ,
ID : ServerDHParamsOkTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Nonce" ,
SchemaName : "nonce" ,
},
{
Name : "ServerNonce" ,
SchemaName : "server_nonce" ,
},
{
Name : "EncryptedAnswer" ,
SchemaName : "encrypted_answer" ,
},
}
return typ
}
func (s *ServerDHParamsOk ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode server_DH_params_ok#d0e8075c as nil" )
}
b .PutID (ServerDHParamsOkTypeID )
return s .EncodeBare (b )
}
func (s *ServerDHParamsOk ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode server_DH_params_ok#d0e8075c as nil" )
}
b .PutInt128 (s .Nonce )
b .PutInt128 (s .ServerNonce )
b .PutBytes (s .EncryptedAnswer )
return nil
}
func (s *ServerDHParamsOk ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode server_DH_params_ok#d0e8075c to nil" )
}
if err := b .ConsumeID (ServerDHParamsOkTypeID ); err != nil {
return fmt .Errorf ("unable to decode server_DH_params_ok#d0e8075c: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ServerDHParamsOk ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode server_DH_params_ok#d0e8075c to nil" )
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_params_ok#d0e8075c: field nonce: %w" , err )
}
s .Nonce = value
}
{
value , err := b .Int128 ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_params_ok#d0e8075c: field server_nonce: %w" , err )
}
s .ServerNonce = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode server_DH_params_ok#d0e8075c: field encrypted_answer: %w" , err )
}
s .EncryptedAnswer = value
}
return nil
}
func (s *ServerDHParamsOk ) GetNonce () (value bin .Int128 ) {
if s == nil {
return
}
return s .Nonce
}
func (s *ServerDHParamsOk ) GetServerNonce () (value bin .Int128 ) {
if s == nil {
return
}
return s .ServerNonce
}
func (s *ServerDHParamsOk ) GetEncryptedAnswer () (value []byte ) {
if s == nil {
return
}
return s .EncryptedAnswer
}
const ServerDHParamsClassName = "Server_DH_Params"
type ServerDHParamsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () ServerDHParamsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetNonce () (value bin .Int128 )
GetServerNonce () (value bin .Int128 )
}
func DecodeServerDHParams (buf *bin .Buffer ) (ServerDHParamsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case ServerDHParamsFailTypeID :
v := ServerDHParamsFail {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ServerDHParamsClass: %w" , err )
}
return &v , nil
case ServerDHParamsOkTypeID :
v := ServerDHParamsOk {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ServerDHParamsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode ServerDHParamsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type ServerDHParamsBox struct {
Server_DH_Params ServerDHParamsClass
}
func (b *ServerDHParamsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode ServerDHParamsBox to nil" )
}
v , err := DecodeServerDHParams (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .Server_DH_Params = v
return nil
}
func (b *ServerDHParamsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .Server_DH_Params == nil {
return fmt .Errorf ("unable to encode ServerDHParamsClass as nil" )
}
return b .Server_DH_Params .Encode (buf )
}
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 .