diff --git a/.env_empty b/.env_empty index 7e1ab712..946c6abf 100644 --- a/.env_empty +++ b/.env_empty @@ -37,4 +37,16 @@ WHATSAPP_PHONE_SEND_TEST= CHATGPT_API_KEY= CHATGPT_NAME= CHATGPT_START_TEXT= -CHATGPT_END_TEXT= \ No newline at end of file +CHATGPT_END_TEXT= + +EMAIL_SMTP_SERVER="" +EMAIL_POP3_SERVER="" +EMAIL_IMAP_SERVER="" +EMAIL_SMTP_PORT="" +EMAIL_POP3_PORT="" +EMAIL_IMAP_PORT="" +EMAIL_LOGIN= +EMAIL_PASSWORD= +EMAIL_SEND_TO_TEST= +EMAIL_AUTHENTICATION="" #AuthNone, AuthLogin, AuthPlain, AuthCRAMMD5 +EMAIL_ENCRYPTION="" #EncryptionNone, EncryptionSSL, EncryptionSSLTLS, EncryptionSTARTTLS, EncryptionTLS diff --git a/Makefile b/Makefile index 973fb385..2934dcb5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SERVICEURL=gitlab.aescorp.ru/dsp_dev/claim/nikitin -SERVICEURL2=gitlab.aescorp.ru/dsp_dev/claim/nikitin +SERVICEURL2=github.com/manyakrus/starter FILEMAIN=./internal/v0/app/main.go FILEAPP=./bin/app_race diff --git a/chatgpt_connect/chatgpt_connect.go b/chatgpt_connect/chatgpt_connect.go index 6ca6cdbe..b10bbd67 100644 --- a/chatgpt_connect/chatgpt_connect.go +++ b/chatgpt_connect/chatgpt_connect.go @@ -14,7 +14,7 @@ import ( "github.com/manyakrus/starter/contextmain" "github.com/manyakrus/starter/stopapp" - gogpt "github.com/sashabaranov/go-gpt3" + gogpt "github.com/sashabaranov/go-openai" ) // Conn - соединение к CHAT GPT @@ -181,7 +181,7 @@ func SendMessage(Text string, user string) (string, error) { defer cancel() req := gogpt.CompletionRequest{ - Model: gogpt.GPT3TextDavinci003, //надо gogpt.GPT3TextDavinci003 + Model: gogpt.GPT4, //надо gogpt.GPT3TextDavinci003 MaxTokens: 2048, Prompt: Text, User: user, diff --git a/email/email.go b/email/email.go new file mode 100644 index 00000000..80affe6c --- /dev/null +++ b/email/email.go @@ -0,0 +1,357 @@ +// модуль для отправки email сообщений + +package email + +//License: + +import ( + "context" + "errors" + "fmt" + "github.com/joho/godotenv" + "github.com/manyakrus/starter/micro" + "os" + "strconv" + "strings" + "sync" + "time" + + "github.com/manyakrus/starter/contextmain" + "github.com/manyakrus/starter/logger" + //"github.com/manyakrus/starter/micro" + "github.com/manyakrus/starter/stopapp" + + mail "github.com/xhit/go-simple-mail/v2" + // "gopkg.in/gomail.v2" +) + +// log - глобальный логгер приложения +var log = logger.GetLog() + +// lastSendTime - время последней отправки сообщения и мьютекс +var lastSendTime = lastSendTimeMutex{} + +// Conn - клиент соединения Email +var Conn *mail.SMTPClient + +// MaxSendMessageCountIn1Second - максимальное количество сообщений в 1 секунду +var MaxSendMessageCountIn1Second float32 = 33 //Валера сказал 33 оптимально было при испытании + +// lastSendTimeMutex - структура хранения времени последней отправки и мьютекс +type lastSendTimeMutex struct { + time time.Time + sync.Mutex +} + +// Settings хранит все нужные переменные окружения +var Settings SettingsINI + +// SettingsINI - структура для хранения всех нужных переменных окружения +type SettingsINI struct { + EMAIL_SMTP_SERVER string + EMAIL_POP3_SERVER string + EMAIL_SMTP_PORT string + EMAIL_POP3_PORT string + EMAIL_LOGIN string + EMAIL_PASSWORD string + EMAIL_SEND_TO_TEST string + EMAIL_AUTHENTICATION string + EMAIL_ENCRYPTION string +} + +//type Attachment struct { +// Filename string +// File []byte +//} + +// SendMessage - отправка сообщения Email, без вложений +func SendMessage(email_send_to string, text string, subject string) error { + var err error + + MassAttachments := make([]mail.File, 0) + err = SendEmail(email_send_to, text, subject, MassAttachments) + return err +} + +// SendEmail - отправка сообщения Email +func SendEmail(email_send_to string, text string, subject string, MassAttachments []mail.File) error { + var err error + + if email_send_to == "" { + text1 := "email_send_to is empty !" + log.Errorln(text1) + err = errors.New(text1) + return err + } + + if text == "" { + text1 := "text is empty !" + log.Errorln(text1) + err = errors.New(text1) + return err + } + + if Conn == nil { + err = Connect_err() + if err != nil { + log.Error("Connect_err() error: ", err) + return err + } + } + + log.Debug("email_send_to: ", email_send_to, " text: ", text) + + to := string(email_send_to) + msg := text + + strFrom := Settings.EMAIL_LOGIN + MessageEmail := mail.NewMSG() + MessageEmail.SetFrom(strFrom) + //MessageEmail.SetSender(strFrom) + MessageEmail.SetSubject(subject) + MessageEmail.SetBody(mail.TextHTML, msg) + + //емайлы кому, через запятую + MassTo := make([]string, 0) + MassTo = strings.Split(to, ",") + for _, v := range MassTo { + MessageEmail.AddTo(v) + } + + //вложения + for _, v := range MassAttachments { + MessageEmail.Attach(&v) + } + + //отправка + ctxMain := contextmain.GetContext() + ctx, cancel := context.WithTimeout(ctxMain, 60*time.Second) + defer cancel() + + fn := func() error { + err = MessageEmail.Send(Conn) + //if err != nil { + // err1 := fmt.Errorf("Send() error: %w", err) + // return err1 + //} + return err + } + err = micro.GoGo(ctx, fn) + + return err +} + +// Connect - подключение клиента Email +func Connect() { + err := Connect_err() + if err != nil { + log.Panicln("Connect() error: ", err) + } else { + log.Info("Email connected: ", Settings.EMAIL_LOGIN) + } + +} + +// Connect_err - подключение клиента EMail +func Connect_err() error { + var err error + + if Settings.EMAIL_LOGIN == "" { + LoadEnv() + } + + Encryption := FindEncryption_FromString(Settings.EMAIL_ENCRYPTION) + Authentication := FindAuthentication_FromString(Settings.EMAIL_AUTHENTICATION) + + SMTPClient := mail.NewSMTPClient() + SMTPClient.Host = Settings.EMAIL_SMTP_SERVER + SMTPClient.Port, _ = strconv.Atoi(Settings.EMAIL_SMTP_PORT) + SMTPClient.Username = Settings.EMAIL_LOGIN + SMTPClient.Password = Settings.EMAIL_PASSWORD + SMTPClient.Encryption = Encryption + SMTPClient.Authentication = Authentication + SMTPClient.KeepAlive = true + SMTPClient.SendTimeout = 60 * time.Second + //Conn, err = SMTPClient.Connect() + + fn := func() error { + Conn, err = SMTPClient.Connect() + if err != nil { + err1 := fmt.Errorf("Send() error: %w", err) + return err1 + } + return err + } + + ctxMain := contextmain.GetContext() + ctx, cancel := context.WithTimeout(ctxMain, 60*time.Second) + defer cancel() + err = micro.GoGo(ctx, fn) + + return err +} + +// CloseConnection_err - остановка работы клиента Email и возврат ошибки +func CloseConnection_err() error { + var err error + + if Conn == nil { + return err + } + + err = Conn.Close() + if err != nil { + text1 := "smtp.Close() error: " + err.Error() + err1 := errors.New(text1) + log.Error(text1) + return err1 + } + + return err +} + +// CloseConnection - остановка работы клиента Email +func CloseConnection() { + err := CloseConnection_err() + if err != nil { + log.Panic("Email CloseConnection() error: ", err) + } else { + log.Info("Email connection closed") + } + +} + +// WaitStop - ожидает отмену глобального контекста или сигнала завершения приложения +func WaitStop() { + + select { + //case <-stopapp.SignalInterrupt: + // log.Warn("Interrupt clean shutdown.") + // contextmain.CancelContext() + case <-contextmain.GetContext().Done(): + log.Warn("Context app is canceled.") + } + + // + stopapp.WaitTotalMessagesSendingNow("email") + + // + CloseConnection() + stopapp.GetWaitGroup_Main().Done() +} + +// StartDB - делает соединение с БД, отключение и др. +func Start() { + LoadEnv() + Connect() + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + +} + +// LoadEnv - загружает переменные окружения в структуру из файла или из переменных окружения +func LoadEnv() { + + dir := micro.ProgramDir() + filename := dir + ".env" + LoadEnv_FromFile(filename) +} + +// LoadEnv_FromFile загружает переменные окружения в структуру из файла или из переменных окружения +func LoadEnv_FromFile(filename string) { + //var err error + //err := godotenv.Load(Filename_Settings) + //if err != nil { + // log.Fatal("Error loading " + Filename_Settings + " file, error: " + err.Error()) + //} + + err := godotenv.Load(filename) + if err != nil { + log.Debug("Error parse .env file error: " + err.Error()) + } else { + log.Info("load .env from file: ", filename) + } + + Settings = SettingsINI{} + Settings.EMAIL_SMTP_SERVER = os.Getenv("EMAIL_SMTP_SERVER") + Settings.EMAIL_POP3_SERVER = os.Getenv("EMAIL_POP3_SERVER") + Settings.EMAIL_SMTP_PORT = os.Getenv("EMAIL_SMTP_PORT") + Settings.EMAIL_LOGIN = os.Getenv("EMAIL_LOGIN") + Settings.EMAIL_PASSWORD = os.Getenv("EMAIL_PASSWORD") + Settings.EMAIL_SEND_TO_TEST = os.Getenv("EMAIL_SEND_TO_TEST") + //Settings.EMAIL_SUBJECT = os.Getenv("EMAIL_SUBJECT") + Settings.EMAIL_AUTHENTICATION = os.Getenv("EMAIL_AUTHENTICATION") + Settings.EMAIL_ENCRYPTION = os.Getenv("EMAIL_ENCRYPTION") + + if Settings.EMAIL_SMTP_SERVER == "" { + log.Warn("Need fill EMAIL_SMTP_SERVER ! in file ", filename) + } + + if Settings.EMAIL_POP3_SERVER == "" { + log.Warn("Need fill EMAIL_POP3_SERVER ! in file ", filename) + } + + if Settings.EMAIL_SMTP_PORT == "" { + log.Panicln("Need fill EMAIL_SMTP_PORT ! in file ", filename) + } + + if Settings.EMAIL_LOGIN == "" { + log.Panicln("Need fill EMAIL_LOGIN ! in file ", filename) + } + + if Settings.EMAIL_PASSWORD == "" { + log.Panicln("Need fill EMAIL_PASSWORD ! in file ", filename) + } + + if Settings.EMAIL_SEND_TO_TEST == "" && micro.IsTestApp() == true { + log.Info("Need fill EMAIL_SEND_TO_TEST ! in file ", filename) + } + + //if Settings.EMAIL_SUBJECT == "" { + // log.Panicln("Need fill EMAIL_SUBJECT ! in file ", filename) + //} + + if Settings.EMAIL_AUTHENTICATION == "" { + log.Warn("Need fill EMAIL_AUTHENTICATION ! in file ", filename) + } + + if Settings.EMAIL_ENCRYPTION == "" { + log.Warn("Need fill EMAIL_ENCRYPTION ! in file ", filename) + } + +} + +// FindEncryption_FromString - находит Encryption из строки +func FindEncryption_FromString(s string) mail.Encryption { + Otvet := mail.EncryptionNone + + switch s { + case "EncryptionSSL": + Otvet = mail.EncryptionSSL + case "EncryptionSSLTLS": + Otvet = mail.EncryptionSSLTLS + case "EncryptionSTARTTLS": + Otvet = mail.EncryptionSTARTTLS + case "EncryptionTLS": + Otvet = mail.EncryptionTLS + } + + return Otvet +} + +// FindAuthentication_FromString - находит AuthType из строки +func FindAuthentication_FromString(s string) mail.AuthType { + Otvet := mail.AuthNone + + switch s { + case "AuthLogin": + Otvet = mail.AuthLogin + case "AuthPlain": + Otvet = mail.AuthPlain + case "AuthCRAMMD5": + Otvet = mail.AuthCRAMMD5 + } + + return Otvet +} diff --git a/email/email_test.go b/email/email_test.go new file mode 100644 index 00000000..460610ce --- /dev/null +++ b/email/email_test.go @@ -0,0 +1,47 @@ +package email + +import ( + mail "github.com/xhit/go-simple-mail/v2" + "github.com/manyakrus/starter/config" + "testing" +) + +func TestSendMessage(t *testing.T) { + config.LoadEnv() + Connect() + EMAIL_SEND_TO_TEST := Settings.EMAIL_SEND_TO_TEST + text := "TEST ТЕСТ utf8 русский язык" + + err := SendMessage(EMAIL_SEND_TO_TEST, text, "Test") + if err != nil { + log.Info("email_test.TestSendMessage() error: ", err) + } + + CloseConnection() +} + +func TestSendEmail(t *testing.T) { + config.LoadEnv() + Connect() + EMAIL_SEND_TO_TEST := Settings.EMAIL_SEND_TO_TEST + //EMAIL_SEND_TO_TEST = EMAIL_SEND_TO_TEST + ",noreply@note.atomsbt.ru" + //EMAIL_SEND_TO_TEST = "z2007@list.ru" + text := "TEST ТЕСТ utf8 русский язык" + Attachment1 := mail.File{} + Attachment1.Name = "test.txt" + Attachment1.Data = []byte(text) + MassAttachment := make([]mail.File, 0) + MassAttachment = append(MassAttachment, Attachment1) + + err := SendEmail(EMAIL_SEND_TO_TEST, text, "Test", MassAttachment) + if err != nil { + log.Info("email_test.TestSendEmail() error: ", err) + } + + CloseConnection() +} + +func TestConnect(t *testing.T) { + Connect() + CloseConnection() +} diff --git a/email_imap/email_imap.go b/email_imap/email_imap.go new file mode 100644 index 00000000..0fc5f030 --- /dev/null +++ b/email_imap/email_imap.go @@ -0,0 +1,569 @@ +package email_imap + +import ( + //"bytes" + "context" + "errors" + "fmt" + "github.com/emersion/go-imap" + imapModule "github.com/emersion/go-imap/client" + "github.com/emersion/go-message" + mail "github.com/emersion/go-message/mail" + "github.com/joho/godotenv" + simplemail "github.com/xhit/go-simple-mail/v2" + "github.com/manyakrus/starter/contextmain" + "github.com/manyakrus/starter/email" + "github.com/manyakrus/starter/log" + "github.com/manyakrus/starter/micro" + "github.com/manyakrus/starter/stopapp" + "io" + "io/ioutil" + "os" + "strings" + "time" +) + +var Conn *imapModule.Client +var MailInbox *imap.MailboxStatus // папка inbox + +// Settings хранит все нужные переменные окружения +var Settings SettingsINI + +var FOLDER_NAME_INBOX = `INBOX` +var ErrEmptyInbox = fmt.Errorf("empty inbox") + +// SettingsINI - структура для хранения всех нужных переменных окружения +type SettingsINI struct { + EMAIL_IMAP_SERVER string + EMAIL_IMAP_PORT string + EMAIL_LOGIN string + EMAIL_PASSWORD string + EMAIL_SEND_TO_TEST string + //EMAIL_SUBJECT string + EMAIL_AUTHENTICATION string + EMAIL_ENCRYPTION string +} + +type Attachment struct { + Filename string + Data []byte +} + +// Connect - подключение клиента Email +func Connect() { + err := Connect_err() + if err != nil { + log.Panicln("Connect() error: ", err) + } else { + log.Info("Email connected: ", Settings.EMAIL_LOGIN) + } + +} + +// Connect_err - Однократно Устанавливает соединение по требованию +func Connect_err() error { + var err error + + if Settings.EMAIL_LOGIN == "" { + LoadEnv() + } + + strFrom := Settings.EMAIL_LOGIN + strPass := Settings.EMAIL_PASSWORD + strHost := Settings.EMAIL_IMAP_SERVER + + //log.Debugf("Connecting to server %s", strHost) + + //подключение к серверу + fn := func() error { + Conn, err = imapModule.Dial(strHost + ":" + Settings.EMAIL_IMAP_PORT) + if err != nil { + err1 := fmt.Errorf("Send() error: %w", err) + return err1 + } + return err + } + + ctxMain := contextmain.GetContext() + ctx, cancel := context.WithTimeout(ctxMain, 60*time.Second) + defer cancel() + err = micro.GoGo(ctx, fn) + + //Conn, err := imapModule.Dial(strHost + ":" + strconv.Itoa(Settings.EMAIL_SMTP_PORT)) + if err != nil { + return err + } + + // Login + fn = func() error { + err = Conn.Login(strFrom, strPass) + if err != nil { + err1 := fmt.Errorf("Send() error: %w", err) + return err1 + } + return err + } + + ctx, cancel2 := context.WithTimeout(ctxMain, 60*time.Second) + defer cancel2() + err = micro.GoGo(ctx, fn) + + //err = Conn.Login(strFrom, strPass) + if err != nil { + return err + } + log.Infof("Logged in %s", strFrom) + + MailInbox = SelectInbox() + + return nil +} + +// SelectInbox - возвращает емайл папку Inbox +func SelectInbox() *imap.MailboxStatus { + var MailInbox *imap.MailboxStatus + MailInbox = SelectFolder(FOLDER_NAME_INBOX) + + return MailInbox +} + +// SelectInbox - возвращает емайл папку Inbox +func SelectFolder(FolderName string) *imap.MailboxStatus { + var MailInbox *imap.MailboxStatus + + if Conn == nil { + log.Errorf("mailconn.SelectFolder() error conn = nil") + return MailInbox + } + + // Select INBOX + var err error + + fn := func() error { + MailInbox, err = Conn.Select(FolderName, false) + if err != nil { + err1 := fmt.Errorf("Send() error: %w", err) + return err1 + } + return err + } + + ctxMain := contextmain.GetContext() + ctx, cancel := context.WithTimeout(ctxMain, 60*time.Second) + defer cancel() + err = micro.GoGo(ctx, fn) + + //MailInbox, err = Conn.Select(FolderName, false) + if err != nil { + log.Error("mailconn.SelectFolder() Select(", FolderName, ") error: %s", err) + panic(err) + } + if MailInbox == nil { + log.Error("mailconn.SelectFolder() Select(", FolderName, ") MailInbox=nil, error: %s", err) + panic(err) + } + + return MailInbox +} + +// ReplaceMessage -- перемещает сообщение в другую папку +func ReplaceMessage(msg *imap.Message, FolderName string) error { + if msg == nil { + return fmt.Errorf("ReplaceMessage(): msg==nil") + } + + SeqSet := FindSeqSet(msg.Uid) + + var err error + //ctxMain := contextmain.GetContext() + //Ctx1, CancelFunc1 := context.WithTimeout(ctxMain, time.Second*30) + //defer CancelFunc1() + + err = Conn.UidMove(SeqSet, FolderName) + + //select { + //case <-Ctx1.Done(): + // Text1 := "mailconn.MsgNext() Fetch() error: TimeOut" + // err = errors.New(Text1) + // return err + //case err = <-Chan1: + //} + ////err := mc.conn.UidMove(SeqSet, FolderName) + + return err +} + +// FindSeqSet -- находит SeqSet по номеру сообщения +func FindSeqSet(Id uint32) *imap.SeqSet { + + SeqSet := new(imap.SeqSet) + SeqSet.AddNum(Id) + + return SeqSet +} + +// FindFolderName - возвращает имя папки imap +func FindFolderName(MainFolderName, SubFolderName string) string { + Otvet := MainFolderName + + if SubFolderName != "" { + Otvet = MainFolderName + `/` + SubFolderName + } + + return Otvet +} + +// ForwardMessage -- перенаправляет емайл +func ForwardMessage(msg *imap.Message, email_send_to string) error { + //BodyText := msg.Body + //BodyText = "Обращение поступило от: " + msg.Envelope.From.MailboxName + "\n\r
" + + // "----------------------------------------------------------\n\r

" + + // BodyText + + var err error + //ctxMain := contextmain.GetContext() + //Ctx1, CancelFunc1 := context.WithTimeout(ctxMain, time.Second*30) + //defer CancelFunc1() + + Body, Attachments, err := ReadBody(msg) + + MassAttachments := make([]simplemail.File, 0) + for _, v := range Attachments { + Attachment1 := simplemail.File{} + Attachment1.Name = v.Filename + Attachment1.Data = v.Data + MassAttachments = append(MassAttachments, Attachment1) + } + + err = email.SendEmail(email_send_to, Body, msg.Envelope.Subject, MassAttachments) + + //select { + //case <-Ctx1.Done(): + // Text1 := "mailconn.MsgNext() Fetch() error: TimeOut" + // err = errors.New(Text1) + // return err + //case err = <-Chan1: + //} + + return err +} + +// WaitStop - ожидает отмену глобального контекста или сигнала завершения приложения +func WaitStop() { + + select { + //case <-stopapp.SignalInterrupt: + // log.Warn("Interrupt clean shutdown.") + // contextmain.CancelContext() + case <-contextmain.GetContext().Done(): + log.Warn("Context app is canceled.") + } + + // + stopapp.WaitTotalMessagesSendingNow("email") + + // + CloseConnection() + stopapp.GetWaitGroup_Main().Done() +} + +// StartDB - делает соединение с БД, отключение и др. +func Start() { + LoadEnv() + Connect_err() + + stopapp.GetWaitGroup_Main().Add(1) + go WaitStop() + +} + +// LoadEnv - загружает переменные окружения в структуру из файла или из переменных окружения +func LoadEnv() { + + dir := micro.ProgramDir() + filename := dir + ".env" + LoadEnv_FromFile(filename) +} + +// LoadEnv_FromFile загружает переменные окружения в структуру из файла или из переменных окружения +func LoadEnv_FromFile(filename string) { + //var err error + //err := godotenv.Load(Filename_Settings) + //if err != nil { + // log.Fatal("Error loading " + Filename_Settings + " file, error: " + err.Error()) + //} + + err := godotenv.Load(filename) + if err != nil { + log.Debug("Error parse .env file error: " + err.Error()) + } else { + log.Info("load .env from file: ", filename) + } + + Settings = SettingsINI{} + Settings.EMAIL_IMAP_SERVER = os.Getenv("EMAIL_IMAP_SERVER") + Settings.EMAIL_IMAP_PORT = os.Getenv("EMAIL_IMAP_PORT") + Settings.EMAIL_LOGIN = os.Getenv("EMAIL_LOGIN") + Settings.EMAIL_PASSWORD = os.Getenv("EMAIL_PASSWORD") + Settings.EMAIL_SEND_TO_TEST = os.Getenv("EMAIL_SEND_TO_TEST") + //Settings.EMAIL_SUBJECT = os.Getenv("EMAIL_SUBJECT") + Settings.EMAIL_AUTHENTICATION = os.Getenv("EMAIL_AUTHENTICATION") + Settings.EMAIL_ENCRYPTION = os.Getenv("EMAIL_ENCRYPTION") + + if Settings.EMAIL_IMAP_SERVER == "" { + log.Panicln("Need fill EMAIL_SMTP_SERVER ! in file ", filename) + } + + if Settings.EMAIL_IMAP_PORT == "" { + log.Panicln("Need fill EMAIL_SMTP_PORT ! in file ", filename) + } + + if Settings.EMAIL_LOGIN == "" { + log.Panicln("Need fill EMAIL_LOGIN ! in file ", filename) + } + + if Settings.EMAIL_PASSWORD == "" { + log.Panicln("Need fill EMAIL_PASSWORD ! in file ", filename) + } + + if Settings.EMAIL_SEND_TO_TEST == "" && micro.IsTestApp() == true { + log.Info("Need fill EMAIL_SEND_TO_TEST ! in file ", filename) + } + + //if Settings.EMAIL_SUBJECT == "" { + // log.Panicln("Need fill EMAIL_SUBJECT ! in file ", filename) + //} + + if Settings.EMAIL_AUTHENTICATION == "" { + log.Warn("Need fill EMAIL_AUTHENTICATION ! in file ", filename) + } + + if Settings.EMAIL_ENCRYPTION == "" { + log.Warn("Need fill EMAIL_ENCRYPTION ! in file ", filename) + } + +} + +// CloseConnection - остановка работы клиента Email +func CloseConnection() { + err := CloseConnection_err() + if err != nil { + log.Panic("Email imap CloseConnection() error: ", err) + } else { + log.Info("Email imap connection closed") + } + +} + +// CloseConnection_err -- закрывает соединение с почтовым сервером +func CloseConnection_err() error { + var err error + + fn := func() error { + err := Conn.Logout() + if err != nil { + err1 := fmt.Errorf("Send() error: %w", err) + return err1 + } + return err + } + + ctxMain := contextmain.GetContext() + ctx, cancel := context.WithTimeout(ctxMain, 60*time.Second) + defer cancel() + err = micro.GoGo(ctx, fn) + + //err := Conn.Logout() + if err != nil { + log.Printf("MailConn.Logout(): err=\t%v", err) + } + + Conn = nil + + return err +} + +// Stat - возвращает количество сообщений и ИД первого непрочитанного +func Stat() (count, id int) { + // Select INBOX + MailInbox := SelectInbox() + count = int(MailInbox.Messages) + id = int(MailInbox.UnseenSeqNum) + + return count, id +} + +// Безопасно читает тело сообщения +func ReadBody(Msg *imap.Message) (BodyText string, Attachments []Attachment, err error) { + + Attachments = make([]Attachment, 0) + + chErr := make(chan string, 2) + if Msg == nil { + //chErr <- "MsgEmail.readBody().fnRead(): сообщение не присвоена в структуре" + sError := "MsgEmail.readBody(): Msg == nil" + err = fmt.Errorf(sError) + chErr <- sError + return + } + var section imap.BodySectionName + l := Msg.GetBody(§ion) + if l == nil { + sError := "MsgEmail.readBody(): GetBody() = nil" + err = fmt.Errorf(sError) + chErr <- sError + return + //log.Fatal("Server didn't returned message body") + } + + //sBody := l.(*bytes.Buffer).String() + + // Create a new mail reader + mr, err := mail.CreateReader(l) + if err != nil { + sError := fmt.Sprintf("MsgEmail.readBody(): CreateReader() error: %v", err) + err = fmt.Errorf(sError) + chErr <- sError + return + //log.Fatal(err) + } + + //buf := make([]byte, 0) + //n, err := mr.Read(buf) + + // Process each message's part + //sBody := "" + BodyText = "" + for { + p, err := mr.NextPart() + if err == io.EOF { + break + } + if message.IsUnknownCharset(err) { + continue + } + if err != nil { + sError := fmt.Sprintf("MsgEmail.readBody(): NextPart() error: %v", err) + err = fmt.Errorf(sError) + chErr <- sError + if strings.Contains(err.Error(), "EOF") { + break + } + } + + if p == nil { + continue + } + + switch p.Header.(type) { + case *mail.InlineHeader: + // This is the message's text (can be plain-text or HTML) + b, err := ioutil.ReadAll(p.Body) + if err != nil { + sError := fmt.Sprintf("MsgEmail.readBody(): ReadAll() error: %v", err) + err = fmt.Errorf(sError) + chErr <- sError + } + //sBody = sBody + string(b) + BodyText = string(b) + break + + case *mail.AttachmentHeader: + h := p.Header.(*mail.AttachmentHeader) + // This is an attachment + filename, _ := h.Filename() + //log.Println("Got attachment: %v", filename) + var Data []byte + Data, err := ioutil.ReadAll(p.Body) + if err != nil { + sError := fmt.Sprintf("MsgEmail.readBody(): ReadAll() error: %v", err) + err = fmt.Errorf(sError) + chErr <- sError + } + + if filename != "" { + Attachment1 := Attachment{} + Attachment1.Filename = filename + Attachment1.Data = Data + Attachments = append(Attachments, Attachment1) + } + + } + } + + //sf.StrBody_ = sBody + + //body_, err := io.ReadAll(sf.Msg.GetBody(§ion)) + //if err != nil { + // chErr <- fmt.Sprintf("MsgEmail.readBody().fnRead(): при чтении тела письма, err=\t%v", err) + //} + //sf.StrBody_ = html.UnescapeString(string(body_)) + //if err = sf.getEmail(); err != nil { + // chErr <- fmt.Sprintf("MsgEmail.readBody().fnRead(): при получении адресата письма, err=\t%v", err) + //} + + return +} + +// Безопасно получает тему сообщения +func ReadHeader(msg *imap.Message) mail.Header { + var Header mail.Header + + // Get the whole message body + var section imap.BodySectionName + section = imap.BodySectionName{} + //items := []imap.FetchItem{section.FetchItem()} + + r := msg.GetBody(§ion) + if r == nil { + log.Fatal("Server didn't returned message body") + } + + // Create a new mail reader + mr, err := mail.CreateReader(r) + if err != nil { + log.Fatal(err) + } + + Header = mr.Header + + return Header +} + +// ReadMessage -- возвращает пиьмо с сервера, с номером по порядку=id +func ReadMessage(id int) (*imap.Message, error) { + var err error + Otvet := &imap.Message{} + + messages := make(chan *imap.Message, 1) + nextNum := uint32(id) + seqset := new(imap.SeqSet) + seqset.AddNum(nextNum) + var section imap.BodySectionName + items := []imap.FetchItem{imap.FetchBody, imap.FetchUid, imap.FetchEnvelope, imap.FetchBodyStructure, section.FetchItem()} + err = Conn.Fetch(seqset, items, messages) + if err != nil { + return Otvet, err + } + + TimeOutSeconds := 60 + duration := time.Duration(TimeOutSeconds) * time.Second + Ctx1, CancelFunc1 := context.WithTimeout(contextmain.GetContext(), duration) + defer CancelFunc1() + select { + case <-Ctx1.Done(): + Text1 := fmt.Sprint("mailconn.MsgNext() Fetch() error: TimeOut ", TimeOutSeconds, " seconds") + err = errors.New(Text1) + return Otvet, err + case Otvet = <-messages: + } + + if Otvet == nil { + text1 := fmt.Sprint("mailconn.MsgNext() No email with id: ", nextNum) + err := errors.New(text1) + //chRes_ <- text1 + return Otvet, err + } + + return Otvet, err +} diff --git a/email_imap/email_imap_test.go b/email_imap/email_imap_test.go new file mode 100644 index 00000000..7dba9cae --- /dev/null +++ b/email_imap/email_imap_test.go @@ -0,0 +1,46 @@ +package email_imap + +import ( + "testing" +) + +func TestConnect(t *testing.T) { + Connect() + defer CloseConnection() +} + +func TestSelectInbox(t *testing.T) { + Connect() + defer CloseConnection() + + SelectInbox() +} + +func TestReplaceMessage(t *testing.T) { + //Connect() + //defer CloseConnection() + // + //SelectInbox() + //ReplaceMessage(msg, FOLDER_NAME_INBOX) +} + +func TestReadMessage(t *testing.T) { + Connect() + defer CloseConnection() + + SelectInbox() + //SelectFolder("Архив") + size, _ := Stat() + if size <= 0 { + t.Log("size: 0") + return + } + + msg, err := ReadMessage(size) + if err != nil { + t.Error("emal_imap_test.TestReadMessage() error: ", err) + } else { + t.Log("message: ", msg) + } + +} diff --git a/go.mod b/go.mod index 2d84ba3d..8ff262dd 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,11 @@ module github.com/manyakrus/starter go 1.18 require ( - github.com/ManyakRus/logrus v0.0.0-20230425135901-49786dc30ad1 + github.com/ManyakRus/logrus v0.0.0-20230426064230-515895169d22 github.com/camunda/zeebe/clients/go/v8 v8.1.8 github.com/denisenkom/go-mssqldb v0.12.3 + github.com/emersion/go-imap v1.2.1 + github.com/emersion/go-message v0.16.0 github.com/gofiber/fiber/v2 v2.42.0 github.com/golang-module/carbon/v2 v2.2.3 github.com/jackc/pgx/v4 v4.17.2 @@ -15,10 +17,11 @@ require ( github.com/mattn/go-sqlite3 v1.14.16 github.com/mdp/qrterminal/v3 v3.0.0 github.com/nats-io/nats.go v1.16.0 - github.com/sashabaranov/go-gpt3 v1.3.1 + github.com/sashabaranov/go-openai v1.9.1 github.com/segmentio/kafka-go v0.4.39 + github.com/xhit/go-simple-mail/v2 v2.13.0 gitlab.aescorp.ru/dsp_dev/claim/common/object_model v0.0.108 - go.mau.fi/whatsmeow v0.0.0-20230226124255-e5c8f3c95d78 + go.mau.fi/whatsmeow v0.0.0-20230427180258-7f679583b39b golang.org/x/exp v0.0.0-20230418202329-0354be287a23 gorm.io/driver/postgres v1.4.8 gorm.io/driver/sqlserver v1.4.2 @@ -30,7 +33,10 @@ require ( github.com/andybalholm/brotli v1.0.4 // indirect github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 // indirect + github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 // indirect github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect + github.com/go-test/deep v1.1.0 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -65,21 +71,22 @@ require ( github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d // indirect github.com/stretchr/testify v1.8.1 // indirect github.com/tinylib/msgp v1.1.6 // indirect + github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.44.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect go.mau.fi/libsignal v0.1.0 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.6.0 // indirect + golang.org/x/crypto v0.8.0 // indirect + golang.org/x/net v0.9.0 // indirect golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/text v0.9.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f // indirect google.golang.org/grpc v1.49.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/qr v0.2.0 // indirect diff --git a/go.sum b/go.sum index 7a564431..e419dec9 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLC github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ManyakRus/logrus v0.0.0-20230425135901-49786dc30ad1 h1:DHDHcELzYHjddChELUD//dbGrhSIJcRVOMU2HsQOSOg= -github.com/ManyakRus/logrus v0.0.0-20230425135901-49786dc30ad1/go.mod h1:KbfWJjL1T+JHs/0tdcuqW6CKUakBEQ7oG9u5xpEfbTE= +github.com/ManyakRus/logrus v0.0.0-20230426064230-515895169d22 h1:DrHNlqXfwvCpCqn4MfRn4NBtezqWL5GLor3jC7QFPj0= +github.com/ManyakRus/logrus v0.0.0-20230426064230-515895169d22/go.mod h1:KbfWJjL1T+JHs/0tdcuqW6CKUakBEQ7oG9u5xpEfbTE= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= @@ -78,6 +78,15 @@ github.com/denisenkom/go-mssqldb v0.12.3 h1:pBSGx9Tq67pBOTLmxNuirNTeB8Vjmf886Kx+ github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/emersion/go-imap v1.2.1 h1:+s9ZjMEjOB8NzZMVTM3cCenz2JrQIGGo5j1df19WjTA= +github.com/emersion/go-imap v1.2.1/go.mod h1:Qlx1FSx2FTxjnjWpIlVNEuX+ylerZQNFE5NsmKFSejY= +github.com/emersion/go-message v0.15.0/go.mod h1:wQUEfE+38+7EW8p8aZ96ptg6bAb1iwdgej19uXASlE4= +github.com/emersion/go-message v0.16.0 h1:uZLz8ClLv3V5fSFF/fFdW9jXjrZkXIpE1Fn8fKx7pO4= +github.com/emersion/go-message v0.16.0/go.mod h1:pDJDgf/xeUIF+eicT6B/hPX/ZbEorKkUMPOxrPVG2eQ= +github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 h1:OJyUGMJTzHTd1XQp98QTaHernxMYzRaOasRir9hUlFQ= +github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= +github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwoTQyw0fIM5xv1HF+Y+3ZijDR839WMulgxCcUY= +github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -95,6 +104,8 @@ github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRi github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= +github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/gofiber/fiber/v2 v2.42.0 h1:Fnp7ybWvS+sjNQsFvkhf4G8OhXswvB6Vee8hM/LyS+8= github.com/gofiber/fiber/v2 v2.42.0/go.mod h1:3+SGNjqMh5VQH5Vz2Wdi43zTIV16ktlFd3x3R6O1Zlc= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= @@ -323,8 +334,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/sashabaranov/go-gpt3 v1.3.1 h1:ACQOAVX5CAV5rHt0oJOBMKo9BNcqVnmxEdjVxcjVAzw= -github.com/sashabaranov/go-gpt3 v1.3.1/go.mod h1:BIZdbwdzxZbCrcKGMGH6u2eyGe1xFuX9Anmh3tCP8lQ= +github.com/sashabaranov/go-openai v1.9.1 h1:3N52HkJKo9Zlo/oe1AVv5ZkCOny0ra58/ACvAxkN3MM= +github.com/sashabaranov/go-openai v1.9.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 h1:rmMl4fXJhKMNWl+K+r/fq4FbbKI+Ia2m9hYBLm2h4G4= github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8= @@ -355,6 +366,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tinylib/msgp v1.1.6 h1:i+SbKraHhnrf9M5MYmvQhFnbLhAXSDWF8WWsuyRdocw= github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= +github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 h1:PM5hJF7HVfNWmCjMdEfbuOBNXSVF2cMFGgQTPdKCbwM= +github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208/go.mod h1:BzWtXXrXzZUvMacR0oF/fbDDgUPO8L36tDMmRAf14ns= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.44.0 h1:R+gLUhldIsfg1HokMuQjdQ5bh9nuXHPIfvkYUu9eR5Q= @@ -369,6 +382,8 @@ github.com/xdg/scram v1.0.5 h1:TuS0RFmt5Is5qm9Tm2SoD89OPqe4IRiFtyFY4iwWXsw= github.com/xdg/scram v1.0.5/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.3 h1:cmL5Enob4W83ti/ZHuZLuKD/xqJfus4fVPwE+/BDm+4= github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= +github.com/xhit/go-simple-mail/v2 v2.13.0 h1:OANWU9jHZrVfBkNkvLf8Ww0fexwpQVF/v/5f96fFTLI= +github.com/xhit/go-simple-mail/v2 v2.13.0/go.mod h1:b7P5ygho6SYE+VIqpxA6QkYfv4teeyG4MKqB3utRu98= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -379,8 +394,8 @@ gitlab.aescorp.ru/dsp_dev/claim/common/object_model v0.0.108 h1:ZtBQuNckYPeoheh0 gitlab.aescorp.ru/dsp_dev/claim/common/object_model v0.0.108/go.mod h1:GipQ/BQkeb4EgKMMXyZtfnydEqSooOxQCxCqhbnp5/k= go.mau.fi/libsignal v0.1.0 h1:vAKI/nJ5tMhdzke4cTK1fb0idJzz1JuEIpmjprueC+c= go.mau.fi/libsignal v0.1.0/go.mod h1:R8ovrTezxtUNzCQE5PH30StOQWWeBskBsWE55vMfY9I= -go.mau.fi/whatsmeow v0.0.0-20230226124255-e5c8f3c95d78 h1:HXq3VXJhSL/S6kZkrCYMUhCELinVrfpPhDFpklZvHnA= -go.mau.fi/whatsmeow v0.0.0-20230226124255-e5c8f3c95d78/go.mod h1:zoTtv1CupGEyTew7TOwnBmTbHB4pVad2OzjTf5CVwa0= +go.mau.fi/whatsmeow v0.0.0-20230427180258-7f679583b39b h1:VSSc37LfKMt7HYeu9NibbSRwELFN5wc/hreGyY+z+o4= +go.mau.fi/whatsmeow v0.0.0-20230427180258-7f679583b39b/go.mod h1:+ObGpFE6cbbY4hKc1FmQH9MVfqaemmlXGXSnwDvCOyE= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -417,8 +432,9 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -489,8 +505,9 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220706163947-c90051bbdb60/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -557,8 +574,9 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -572,8 +590,9 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -718,8 +737,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/log/logger.go b/log/logger.go index 616ffdfb..a12aae75 100644 --- a/log/logger.go +++ b/log/logger.go @@ -3,87 +3,20 @@ package log import ( - "os" - "path" - "runtime" - "strconv" - "sync" - + "github.com/manyakrus/starter/logger" //"github.com/google/logger" //"github.com/sirupsen/logrus" logrus "github.com/ManyakRus/logrus" - - "github.com/manyakrus/starter/micro" ) -// log - глобальный логгер приложения -var log *logrus.Logger - -// onceLog - гарантирует единственное создание логгера -var onceLog sync.Once - // GetLog - возвращает глобальный логгер приложения // и создаёт логгер если ещё не создан func GetLog() *logrus.Logger { - onceLog.Do(func() { - log = logrus.New() - log.SetReportCaller(true) - - Formatter := new(logrus.TextFormatter) - Formatter.TimestampFormat = "2006-01-02 15:04:05.000" - Formatter.FullTimestamp = true - Formatter.CallerPrettyfier = CallerPrettyfier - log.SetFormatter(Formatter) - - LOG_LEVEL := os.Getenv("LOG_LEVEL") - SetLevel(LOG_LEVEL) - - //LOG_FILE := "log.txt" - //file, err := os.OpenFile(LOG_FILE, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0755) - //if err != nil { - // log.Fatal(err) - //} - ////defer file.Close() - // - //mw := io.MultiWriter(os.Stderr, file) - //logrus.SetOutput(mw) - - //log.SetOutput(os.Stdout) - //log.SetOutput(file) - - }) - - return log -} - -// CallerPrettyfier - форматирует имя файла и номер строки кода -func CallerPrettyfier(frame *runtime.Frame) (function string, file string) { - fileName := " " + path.Base(frame.File) + ":" + strconv.Itoa(frame.Line) + "\t" - FunctionName := frame.Function - FunctionName = micro.LastWord(FunctionName) - FunctionName = FunctionName + "()" + "\t" - return FunctionName, fileName + return logger.GetLog() } // SetLevel - изменяет уровень логирования func SetLevel(LOG_LEVEL string) { - if log == nil { - GetLog() - } - - if LOG_LEVEL == "" { - LOG_LEVEL = "info" - } - level, err := logrus.ParseLevel(LOG_LEVEL) - if err != nil { - log.Error("logrus.ParseLevel() error: ", err) - } - - if level == log.Level { - return - } - - log.SetLevel(level) - log.Debug("new level: ", LOG_LEVEL) + logger.SetLevel(LOG_LEVEL) } diff --git a/log/logger_proxy.go b/log/logger_proxy.go index 60e40a96..662555f2 100644 --- a/log/logger_proxy.go +++ b/log/logger_proxy.go @@ -4,6 +4,7 @@ package log import ( "context" "github.com/ManyakRus/logrus" + "github.com/manyakrus/starter/logger" "io" "time" ) @@ -13,249 +14,204 @@ import ( // this new returned entry. // If you want multiple fields, use `WithFields`. func WithField(key string, value interface{}) *logrus.Entry { - return log.WithField(key, value) + return logger.GetLog().WithField(key, value) } // Adds a struct of fields to the log entry. All it does is call `WithField` for // each `Field`. func WithFields(fields logrus.Fields) *logrus.Entry { - GetLog() - return log.WithFields(fields) + return GetLog().WithFields(fields) } // Add an error as single field to the log entry. All it does is call // `WithError` for the given `error`. func WithError(err error) *logrus.Entry { - GetLog() - return log.WithError(err) + return GetLog().WithError(err) } // Add a context to the log entry. func WithContext(ctx context.Context) *logrus.Entry { - GetLog() - return log.WithContext(ctx) + return GetLog().WithContext(ctx) } // Overrides the time of the log entry. func WithTime(t time.Time) *logrus.Entry { - GetLog() - return WithTime(t) + + return GetLog().WithTime(t) } func Logf(level logrus.Level, format string, args ...interface{}) { - GetLog() - log.Logf(level, format, args...) + GetLog().Logf(level, format, args...) } func Tracef(format string, args ...interface{}) { - GetLog() - log.Tracef(format, args...) + GetLog().Tracef(format, args...) } func Debugf(format string, args ...interface{}) { - GetLog() - log.Debugf(format, args...) + GetLog().Debugf(format, args...) } func Infof(format string, args ...interface{}) { - GetLog() - log.Infof(format, args...) + GetLog().Infof(format, args...) } func Printf(format string, args ...interface{}) { - GetLog() - log.Printf(format, args...) + GetLog().Printf(format, args...) } func Warnf(format string, args ...interface{}) { - GetLog() - log.Warnf(format, args...) + GetLog().Warnf(format, args...) } func Warningf(format string, args ...interface{}) { - GetLog() - log.Warningf(format, args...) + GetLog().Warningf(format, args...) } func Errorf(format string, args ...interface{}) { - GetLog() - log.Errorf(format, args...) + GetLog().Errorf(format, args...) } func Fatalf(format string, args ...interface{}) { - GetLog() - log.Fatalf(format, args...) + GetLog().Fatalf(format, args...) } func Panicf(format string, args ...interface{}) { - GetLog() - log.Panicf(format, args...) + GetLog().Panicf(format, args...) } // Log will log a message at the level given as parameter. // Warning: using Log at Panic or Fatal level will not respectively Panic nor Exit. // For this behaviour Logger.Panic or Logger.Fatal should be used instead. func Log(level logrus.Level, args ...interface{}) { - GetLog() - log.Log(level, args...) + GetLog().Log(level, args...) } func LogFn(level logrus.Level, fn logrus.LogFunction) { - GetLog() - log.LogFn(level, fn) + GetLog().LogFn(level, fn) } func Trace(args ...interface{}) { - GetLog() - log.Trace(args...) + GetLog().Trace(args...) } func Debug(args ...interface{}) { - GetLog() - log.Debug(args...) + GetLog().Debug(args...) } func Info(args ...interface{}) { - GetLog() - log.Info(args...) + GetLog().Info(args...) } func Print(args ...interface{}) { - GetLog() - log.Print(args...) + GetLog().Print(args...) } func Warn(args ...interface{}) { - GetLog() - log.Warn(args...) + GetLog().Warn(args...) } func Warning(args ...interface{}) { - GetLog() - log.Warning(args...) + GetLog().Warning(args...) } func Error(args ...interface{}) { - GetLog() - log.Error(args...) + GetLog().Error(args...) } func Fatal(args ...interface{}) { - GetLog() - log.Fatal(args...) + GetLog().Fatal(args...) } func Panic(args ...interface{}) { - GetLog() - log.Panic(args...) + GetLog().Panic(args...) } func TraceFn(fn logrus.LogFunction) { - GetLog() - log.TraceFn(fn) + GetLog().TraceFn(fn) } func DebugFn(fn logrus.LogFunction) { - GetLog() - log.DebugFn(fn) + GetLog().DebugFn(fn) } func InfoFn(fn logrus.LogFunction) { - GetLog() - log.InfoFn(fn) + GetLog().InfoFn(fn) } func PrintFn(fn logrus.LogFunction) { - GetLog() - log.PrintFn(fn) + GetLog().PrintFn(fn) } func WarnFn(fn logrus.LogFunction) { - GetLog() - log.WarnFn(fn) + GetLog().WarnFn(fn) } func WarningFn(fn logrus.LogFunction) { - GetLog() - log.WarningFn(fn) + GetLog().WarningFn(fn) } func ErrorFn(fn logrus.LogFunction) { - GetLog() - log.ErrorFn(fn) + GetLog().ErrorFn(fn) } func FatalFn(fn logrus.LogFunction) { - GetLog() - log.FatalFn(fn) + GetLog().FatalFn(fn) } func PanicFn(fn logrus.LogFunction) { - GetLog() - log.PanicFn(fn) + GetLog().PanicFn(fn) } func Logln(level logrus.Level, args ...interface{}) { - GetLog() - log.Logln(level, args...) + GetLog().Logln(level, args...) } func Traceln(args ...interface{}) { - GetLog() - log.Traceln(args...) + GetLog().Traceln(args...) } func Debugln(args ...interface{}) { - GetLog() - log.Debugln(args...) + GetLog().Debugln(args...) } func Infoln(args ...interface{}) { - GetLog() - log.Infoln(args...) + GetLog().Infoln(args...) } func Println(args ...interface{}) { - GetLog() - log.Println(args...) + GetLog().Println(args...) } func Warnln(args ...interface{}) { - GetLog() - log.Warnln(args...) + GetLog().Warnln(args...) } func Warningln(args ...interface{}) { - GetLog() - log.Warningln(args...) + GetLog().Warningln(args...) } func Errorln(args ...interface{}) { - GetLog() - log.Errorln(args...) + GetLog().Errorln(args...) } func Fatalln(args ...interface{}) { - GetLog() - log.Fatalln(args...) + GetLog().Fatalln(args...) } func Panicln(args ...interface{}) { - GetLog() - log.Panicln(args...) + GetLog().Panicln(args...) } func Exit(code int) { - GetLog() - log.Exit(code) + GetLog().Exit(code) } //When file is opened with appending mode, it's safe to //write concurrently to a file (within 4k message on Linux). //In these cases user can choose to disable the lock. func SetNoLock() { - GetLog() - log.SetNoLock() + GetLog().SetNoLock() } //// SetLevel sets the logger level. @@ -264,37 +220,31 @@ func SetNoLock() { // GetLevel returns the logger level. func GetLevel() logrus.Level { - GetLog() - return log.GetLevel() + return GetLog().GetLevel() } // AddHook adds a hook to the logger hooks. func AddHook(hook logrus.Hook) { - GetLog() - log.AddHook(hook) + GetLog().AddHook(hook) } // IsLevelEnabled checks if the log level of the logger is greater than the level param func IsLevelEnabled(level logrus.Level) bool { - GetLog() - return log.IsLevelEnabled(level) + return GetLog().IsLevelEnabled(level) } // SetFormatter sets the logger formatter. func SetFormatter(formatter logrus.Formatter) { - GetLog() - log.SetFormatter(formatter) + GetLog().SetFormatter(formatter) } // SetOutput sets the logger output. func SetOutput(output io.Writer) { - GetLog() - log.SetOutput(output) + GetLog().SetOutput(output) } func SetReportCaller(reportCaller bool) { - GetLog() - log.SetReportCaller(reportCaller) + GetLog().SetReportCaller(reportCaller) } // ReplaceHooks replaces the logger hooks and returns the old ones @@ -305,6 +255,5 @@ func ReplaceHooks(hooks logrus.LevelHooks) logrus.LevelHooks { // SetBufferPool sets the logger buffer pool. func SetBufferPool(pool logrus.BufferPool) { - GetLog() - log.SetBufferPool(pool) + GetLog().SetBufferPool(pool) } diff --git a/micro/microfunctions.go b/micro/microfunctions.go index 522004a3..69e40f98 100644 --- a/micro/microfunctions.go +++ b/micro/microfunctions.go @@ -3,6 +3,7 @@ package micro import ( + "context" "errors" "fmt" "runtime" @@ -320,3 +321,30 @@ func MinInt64(x, y int64) int64 { } return x } + +// GoGo - запускает функцию в отдельном потоке +func GoGo(ctx context.Context, fn func() error) error { + var err error + chanErr := make(chan error) + + go gogo_chan(fn, chanErr) + + select { + case <-ctx.Done(): + Text1 := "error: TimeOut" + err = errors.New(Text1) + return err + case err = <-chanErr: + //print("err: ", err) + break + } + + return err +} + +// gogo_chan - запускает функцию и возвращает ошибку в поток +// только совместно с GoGo() +func gogo_chan(fn func() error, chanErr chan error) { + err := fn() + chanErr <- err +} diff --git a/micro/microfunctions_test.go b/micro/microfunctions_test.go index 032d3cc7..af9d13a6 100644 --- a/micro/microfunctions_test.go +++ b/micro/microfunctions_test.go @@ -1,7 +1,10 @@ package micro import ( + "context" "errors" + "fmt" + "github.com/manyakrus/starter/contextmain" "os" "testing" "time" @@ -211,3 +214,18 @@ func TestMinInt64(t *testing.T) { t.Error("microfunctions_test.TestMin() error: Otvet != 1") } } + +func TestGoGo(t *testing.T) { + fn := func() error { + Pause(2000) + err := fmt.Errorf("test error") + return err + } + + ctxMain := contextmain.GetContext() + ctx, cancel := context.WithTimeout(ctxMain, 1*time.Second) + defer cancel() + + err := GoGo(ctx, fn) + t.Log("Err:", err) +} diff --git a/mssql_connect/mssql_connect.go b/mssql_connect/mssql_connect.go index c55325e1..b547106b 100644 --- a/mssql_connect/mssql_connect.go +++ b/mssql_connect/mssql_connect.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "github.com/jmoiron/sqlx" - "github.com/manyakrus/starter/logger" "net/url" "os" "sync" @@ -15,6 +14,7 @@ import ( _ "github.com/denisenkom/go-mssqldb" "github.com/manyakrus/starter/contextmain" + "github.com/manyakrus/starter/logger" "github.com/manyakrus/starter/micro" "github.com/manyakrus/starter/stopapp" ) diff --git a/vendor/github.com/ManyakRus/logrus/entry.go b/vendor/github.com/ManyakRus/logrus/entry.go index 9724cf38..5fa9dc29 100644 --- a/vendor/github.com/ManyakRus/logrus/entry.go +++ b/vendor/github.com/ManyakRus/logrus/entry.go @@ -203,7 +203,7 @@ func getCaller() *runtime.Frame { pkg := getPackageName(f.Function) // If the caller isn't part of this package, we're done - if pkg != logrusPackage && (f.File[len(f.File)-15-1:] != "/logger_proxy.go") { //sanek + if pkg != logrusPackage && (f.File[len(f.File)-15:] != "logger_proxy.go") { //sanek return &f //nolint:scopelint } } diff --git a/vendor/github.com/emersion/go-imap/.build.yml b/vendor/github.com/emersion/go-imap/.build.yml new file mode 100644 index 00000000..26179175 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/.build.yml @@ -0,0 +1,17 @@ +image: alpine/edge +packages: + - go +sources: + - https://github.com/emersion/go-imap +artifacts: + - coverage.html +tasks: + - build: | + cd go-imap + go build -race -v ./... + - test: | + cd go-imap + go test -coverprofile=coverage.txt -covermode=atomic ./... + - coverage: | + cd go-imap + go tool cover -html=coverage.txt -o ~/coverage.html diff --git a/vendor/github.com/emersion/go-imap/.gitignore b/vendor/github.com/emersion/go-imap/.gitignore new file mode 100644 index 00000000..59506a25 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/.gitignore @@ -0,0 +1,28 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +/client.go +/server.go +coverage.txt diff --git a/vendor/github.com/emersion/go-imap/LICENSE b/vendor/github.com/emersion/go-imap/LICENSE new file mode 100644 index 00000000..f55742dd --- /dev/null +++ b/vendor/github.com/emersion/go-imap/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2013 The Go-IMAP Authors +Copyright (c) 2016 emersion +Copyright (c) 2016 Proton Technologies AG + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/emersion/go-imap/README.md b/vendor/github.com/emersion/go-imap/README.md new file mode 100644 index 00000000..199ab3b0 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/README.md @@ -0,0 +1,178 @@ +# go-imap + +[![godocs.io](https://godocs.io/github.com/emersion/go-imap?status.svg)](https://godocs.io/github.com/emersion/go-imap) +[![builds.sr.ht status](https://builds.sr.ht/~emersion/go-imap/commits/master.svg)](https://builds.sr.ht/~emersion/go-imap/commits/master?) + +An [IMAP4rev1](https://tools.ietf.org/html/rfc3501) library written in Go. It +can be used to build a client and/or a server. + +## Usage + +### Client [![godocs.io](https://godocs.io/github.com/emersion/go-imap/client?status.svg)](https://godocs.io/github.com/emersion/go-imap/client) + +```go +package main + +import ( + "log" + + "github.com/emersion/go-imap/client" + "github.com/emersion/go-imap" +) + +func main() { + log.Println("Connecting to server...") + + // Connect to server + c, err := client.DialTLS("mail.example.org:993", nil) + if err != nil { + log.Fatal(err) + } + log.Println("Connected") + + // Don't forget to logout + defer c.Logout() + + // Login + if err := c.Login("username", "password"); err != nil { + log.Fatal(err) + } + log.Println("Logged in") + + // List mailboxes + mailboxes := make(chan *imap.MailboxInfo, 10) + done := make(chan error, 1) + go func () { + done <- c.List("", "*", mailboxes) + }() + + log.Println("Mailboxes:") + for m := range mailboxes { + log.Println("* " + m.Name) + } + + if err := <-done; err != nil { + log.Fatal(err) + } + + // Select INBOX + mbox, err := c.Select("INBOX", false) + if err != nil { + log.Fatal(err) + } + log.Println("Flags for INBOX:", mbox.Flags) + + // Get the last 4 messages + from := uint32(1) + to := mbox.Messages + if mbox.Messages > 3 { + // We're using unsigned integers here, only subtract if the result is > 0 + from = mbox.Messages - 3 + } + seqset := new(imap.SeqSet) + seqset.AddRange(from, to) + + messages := make(chan *imap.Message, 10) + done = make(chan error, 1) + go func() { + done <- c.Fetch(seqset, []imap.FetchItem{imap.FetchEnvelope}, messages) + }() + + log.Println("Last 4 messages:") + for msg := range messages { + log.Println("* " + msg.Envelope.Subject) + } + + if err := <-done; err != nil { + log.Fatal(err) + } + + log.Println("Done!") +} +``` + +### Server [![godocs.io](https://godocs.io/github.com/emersion/go-imap/server?status.svg)](https://godocs.io/github.com/emersion/go-imap/server) + +```go +package main + +import ( + "log" + + "github.com/emersion/go-imap/server" + "github.com/emersion/go-imap/backend/memory" +) + +func main() { + // Create a memory backend + be := memory.New() + + // Create a new server + s := server.New(be) + s.Addr = ":1143" + // Since we will use this server for testing only, we can allow plain text + // authentication over unencrypted connections + s.AllowInsecureAuth = true + + log.Println("Starting IMAP server at localhost:1143") + if err := s.ListenAndServe(); err != nil { + log.Fatal(err) + } +} +``` + +You can now use `telnet localhost 1143` to manually connect to the server. + +## Extensions + +Support for several IMAP extensions is included in go-imap itself. This +includes: + +* [APPENDLIMIT](https://tools.ietf.org/html/rfc7889) +* [CHILDREN](https://tools.ietf.org/html/rfc3348) +* [ENABLE](https://tools.ietf.org/html/rfc5161) +* [IDLE](https://tools.ietf.org/html/rfc2177) +* [IMPORTANT](https://tools.ietf.org/html/rfc8457) +* [LITERAL+](https://tools.ietf.org/html/rfc7888) +* [MOVE](https://tools.ietf.org/html/rfc6851) +* [SASL-IR](https://tools.ietf.org/html/rfc4959) +* [SPECIAL-USE](https://tools.ietf.org/html/rfc6154) +* [UNSELECT](https://tools.ietf.org/html/rfc3691) + +Support for other extensions is provided via separate packages. See below. + +## Extending go-imap + +### Extensions + +Commands defined in IMAP extensions are available in other packages. See [the +wiki](https://github.com/emersion/go-imap/wiki/Using-extensions#using-client-extensions) +to learn how to use them. + +* [COMPRESS](https://github.com/emersion/go-imap-compress) +* [ID](https://github.com/ProtonMail/go-imap-id) +* [METADATA](https://github.com/emersion/go-imap-metadata) +* [NAMESPACE](https://github.com/foxcpp/go-imap-namespace) +* [QUOTA](https://github.com/emersion/go-imap-quota) +* [SORT and THREAD](https://github.com/emersion/go-imap-sortthread) +* [UIDPLUS](https://github.com/emersion/go-imap-uidplus) + +### Server backends + +* [Memory](https://github.com/emersion/go-imap/tree/master/backend/memory) (for testing) +* [Multi](https://github.com/emersion/go-imap-multi) +* [PGP](https://github.com/emersion/go-imap-pgp) +* [Proxy](https://github.com/emersion/go-imap-proxy) +* [Notmuch](https://github.com/stbenjam/go-imap-notmuch) - Experimental gateway for [Notmuch](https://notmuchmail.org/) + +### Related projects + +* [go-message](https://github.com/emersion/go-message) - parsing and formatting MIME and mail messages +* [go-msgauth](https://github.com/emersion/go-msgauth) - handle DKIM, DMARC and Authentication-Results +* [go-pgpmail](https://github.com/emersion/go-pgpmail) - decrypting and encrypting mails with OpenPGP +* [go-sasl](https://github.com/emersion/go-sasl) - sending and receiving SASL authentications +* [go-smtp](https://github.com/emersion/go-smtp) - building SMTP clients and servers + +## License + +MIT diff --git a/vendor/github.com/emersion/go-imap/client/client.go b/vendor/github.com/emersion/go-imap/client/client.go new file mode 100644 index 00000000..8b6fc841 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/client/client.go @@ -0,0 +1,689 @@ +// Package client provides an IMAP client. +// +// It is not safe to use the same Client from multiple goroutines. In general, +// the IMAP protocol doesn't make it possible to send multiple independent +// IMAP commands on the same connection. +package client + +import ( + "crypto/tls" + "fmt" + "io" + "log" + "net" + "os" + "sync" + "time" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/commands" + "github.com/emersion/go-imap/responses" +) + +// errClosed is used when a connection is closed while waiting for a command +// response. +var errClosed = fmt.Errorf("imap: connection closed") + +// errUnregisterHandler is returned by a response handler to unregister itself. +var errUnregisterHandler = fmt.Errorf("imap: unregister handler") + +// Update is an unilateral server update. +type Update interface { + update() +} + +// StatusUpdate is delivered when a status update is received. +type StatusUpdate struct { + Status *imap.StatusResp +} + +func (u *StatusUpdate) update() {} + +// MailboxUpdate is delivered when a mailbox status changes. +type MailboxUpdate struct { + Mailbox *imap.MailboxStatus +} + +func (u *MailboxUpdate) update() {} + +// ExpungeUpdate is delivered when a message is deleted. +type ExpungeUpdate struct { + SeqNum uint32 +} + +func (u *ExpungeUpdate) update() {} + +// MessageUpdate is delivered when a message attribute changes. +type MessageUpdate struct { + Message *imap.Message +} + +func (u *MessageUpdate) update() {} + +// Client is an IMAP client. +type Client struct { + conn *imap.Conn + isTLS bool + serverName string + + loggedOut chan struct{} + continues chan<- bool + upgrading bool + + handlers []responses.Handler + handlersLocker sync.Mutex + + // The current connection state. + state imap.ConnState + // The selected mailbox, if there is one. + mailbox *imap.MailboxStatus + // The cached server capabilities. + caps map[string]bool + // state, mailbox and caps may be accessed in different goroutines. Protect + // access. + locker sync.Mutex + + // A channel to which unilateral updates from the server will be sent. An + // update can be one of: *StatusUpdate, *MailboxUpdate, *MessageUpdate, + // *ExpungeUpdate. Note that blocking this channel blocks the whole client, + // so it's recommended to use a separate goroutine and a buffered channel to + // prevent deadlocks. + Updates chan<- Update + + // ErrorLog specifies an optional logger for errors accepting connections and + // unexpected behavior from handlers. By default, logging goes to os.Stderr + // via the log package's standard logger. The logger must be safe to use + // simultaneously from multiple goroutines. + ErrorLog imap.Logger + + // Timeout specifies a maximum amount of time to wait on a command. + // + // A Timeout of zero means no timeout. This is the default. + Timeout time.Duration +} + +func (c *Client) registerHandler(h responses.Handler) { + if h == nil { + return + } + + c.handlersLocker.Lock() + c.handlers = append(c.handlers, h) + c.handlersLocker.Unlock() +} + +func (c *Client) handle(resp imap.Resp) error { + c.handlersLocker.Lock() + for i := len(c.handlers) - 1; i >= 0; i-- { + if err := c.handlers[i].Handle(resp); err != responses.ErrUnhandled { + if err == errUnregisterHandler { + c.handlers = append(c.handlers[:i], c.handlers[i+1:]...) + err = nil + } + c.handlersLocker.Unlock() + return err + } + } + c.handlersLocker.Unlock() + return responses.ErrUnhandled +} + +func (c *Client) reader() { + defer close(c.loggedOut) + // Loop while connected. + for { + connected, err := c.readOnce() + if err != nil { + c.ErrorLog.Println("error reading response:", err) + } + if !connected { + return + } + } +} + +func (c *Client) readOnce() (bool, error) { + if c.State() == imap.LogoutState { + return false, nil + } + + resp, err := imap.ReadResp(c.conn.Reader) + if err == io.EOF || c.State() == imap.LogoutState { + return false, nil + } else if err != nil { + if imap.IsParseError(err) { + return true, err + } else { + return false, err + } + } + + if err := c.handle(resp); err != nil && err != responses.ErrUnhandled { + c.ErrorLog.Println("cannot handle response ", resp, err) + } + return true, nil +} + +func (c *Client) writeReply(reply []byte) error { + if _, err := c.conn.Writer.Write(reply); err != nil { + return err + } + // Flush reply + return c.conn.Writer.Flush() +} + +type handleResult struct { + status *imap.StatusResp + err error +} + +func (c *Client) execute(cmdr imap.Commander, h responses.Handler) (*imap.StatusResp, error) { + cmd := cmdr.Command() + cmd.Tag = generateTag() + + var replies <-chan []byte + if replier, ok := h.(responses.Replier); ok { + replies = replier.Replies() + } + + if c.Timeout > 0 { + err := c.conn.SetDeadline(time.Now().Add(c.Timeout)) + if err != nil { + return nil, err + } + } else { + // It's possible the client had a timeout set from a previous command, but no + // longer does. Ensure we respect that. The zero time means no deadline. + if err := c.conn.SetDeadline(time.Time{}); err != nil { + return nil, err + } + } + + // Check if we are upgrading. + upgrading := c.upgrading + + // Add handler before sending command, to be sure to get the response in time + // (in tests, the response is sent right after our command is received, so + // sometimes the response was received before the setup of this handler) + doneHandle := make(chan handleResult, 1) + unregister := make(chan struct{}) + c.registerHandler(responses.HandlerFunc(func(resp imap.Resp) error { + select { + case <-unregister: + // If an error occured while sending the command, abort + return errUnregisterHandler + default: + } + + if s, ok := resp.(*imap.StatusResp); ok && s.Tag == cmd.Tag { + // This is the command's status response, we're done + doneHandle <- handleResult{s, nil} + // Special handling of connection upgrading. + if upgrading { + c.upgrading = false + // Wait for upgrade to finish. + c.conn.Wait() + } + // Cancel any pending literal write + select { + case c.continues <- false: + default: + } + return errUnregisterHandler + } + + if h != nil { + // Pass the response to the response handler + if err := h.Handle(resp); err != nil && err != responses.ErrUnhandled { + // If the response handler returns an error, abort + doneHandle <- handleResult{nil, err} + return errUnregisterHandler + } else { + return err + } + } + return responses.ErrUnhandled + })) + + // Send the command to the server + if err := cmd.WriteTo(c.conn.Writer); err != nil { + // Error while sending the command + close(unregister) + + if err, ok := err.(imap.LiteralLengthErr); ok { + // Expected > Actual + // The server is waiting for us to write + // more bytes, we don't have them. Run. + // Expected < Actual + // We are about to send a potentially truncated message, we don't + // want this (ths terminating CRLF is not sent at this point). + c.conn.Close() + return nil, err + } + + return nil, err + } + // Flush writer if we are upgrading + if upgrading { + if err := c.conn.Writer.Flush(); err != nil { + // Error while sending the command + close(unregister) + return nil, err + } + } + + for { + select { + case reply := <-replies: + // Response handler needs to send a reply (Used for AUTHENTICATE) + if err := c.writeReply(reply); err != nil { + close(unregister) + return nil, err + } + case <-c.loggedOut: + // If the connection is closed (such as from an I/O error), ensure we + // realize this and don't block waiting on a response that will never + // come. loggedOut is a channel that closes when the reader goroutine + // ends. + close(unregister) + return nil, errClosed + case result := <-doneHandle: + return result.status, result.err + } + } +} + +// State returns the current connection state. +func (c *Client) State() imap.ConnState { + c.locker.Lock() + state := c.state + c.locker.Unlock() + return state +} + +// Mailbox returns the selected mailbox. It returns nil if there isn't one. +func (c *Client) Mailbox() *imap.MailboxStatus { + // c.Mailbox fields are not supposed to change, so we can return the pointer. + c.locker.Lock() + mbox := c.mailbox + c.locker.Unlock() + return mbox +} + +// SetState sets this connection's internal state. +// +// This function should not be called directly, it must only be used by +// libraries implementing extensions of the IMAP protocol. +func (c *Client) SetState(state imap.ConnState, mailbox *imap.MailboxStatus) { + c.locker.Lock() + c.state = state + c.mailbox = mailbox + c.locker.Unlock() +} + +// Execute executes a generic command. cmdr is a value that can be converted to +// a raw command and h is a response handler. The function returns when the +// command has completed or failed, in this case err is nil. A non-nil err value +// indicates a network error. +// +// This function should not be called directly, it must only be used by +// libraries implementing extensions of the IMAP protocol. +func (c *Client) Execute(cmdr imap.Commander, h responses.Handler) (*imap.StatusResp, error) { + return c.execute(cmdr, h) +} + +func (c *Client) handleContinuationReqs() { + c.registerHandler(responses.HandlerFunc(func(resp imap.Resp) error { + if _, ok := resp.(*imap.ContinuationReq); ok { + go func() { + c.continues <- true + }() + return nil + } + return responses.ErrUnhandled + })) +} + +func (c *Client) gotStatusCaps(args []interface{}) { + c.locker.Lock() + + c.caps = make(map[string]bool) + for _, cap := range args { + if cap, ok := cap.(string); ok { + c.caps[cap] = true + } + } + + c.locker.Unlock() +} + +// The server can send unilateral data. This function handles it. +func (c *Client) handleUnilateral() { + c.registerHandler(responses.HandlerFunc(func(resp imap.Resp) error { + switch resp := resp.(type) { + case *imap.StatusResp: + if resp.Tag != "*" { + return responses.ErrUnhandled + } + + switch resp.Type { + case imap.StatusRespOk, imap.StatusRespNo, imap.StatusRespBad: + if c.Updates != nil { + c.Updates <- &StatusUpdate{resp} + } + case imap.StatusRespBye: + c.locker.Lock() + c.state = imap.LogoutState + c.mailbox = nil + c.locker.Unlock() + + c.conn.Close() + + if c.Updates != nil { + c.Updates <- &StatusUpdate{resp} + } + default: + return responses.ErrUnhandled + } + case *imap.DataResp: + name, fields, ok := imap.ParseNamedResp(resp) + if !ok { + return responses.ErrUnhandled + } + + switch name { + case "CAPABILITY": + c.gotStatusCaps(fields) + case "EXISTS": + if c.Mailbox() == nil { + break + } + + if messages, err := imap.ParseNumber(fields[0]); err == nil { + c.locker.Lock() + c.mailbox.Messages = messages + c.locker.Unlock() + + c.mailbox.ItemsLocker.Lock() + c.mailbox.Items[imap.StatusMessages] = nil + c.mailbox.ItemsLocker.Unlock() + } + + if c.Updates != nil { + c.Updates <- &MailboxUpdate{c.Mailbox()} + } + case "RECENT": + if c.Mailbox() == nil { + break + } + + if recent, err := imap.ParseNumber(fields[0]); err == nil { + c.locker.Lock() + c.mailbox.Recent = recent + c.locker.Unlock() + + c.mailbox.ItemsLocker.Lock() + c.mailbox.Items[imap.StatusRecent] = nil + c.mailbox.ItemsLocker.Unlock() + } + + if c.Updates != nil { + c.Updates <- &MailboxUpdate{c.Mailbox()} + } + case "EXPUNGE": + seqNum, _ := imap.ParseNumber(fields[0]) + + if c.Updates != nil { + c.Updates <- &ExpungeUpdate{seqNum} + } + case "FETCH": + seqNum, _ := imap.ParseNumber(fields[0]) + fields, _ := fields[1].([]interface{}) + + msg := &imap.Message{SeqNum: seqNum} + if err := msg.Parse(fields); err != nil { + break + } + + if c.Updates != nil { + c.Updates <- &MessageUpdate{msg} + } + default: + return responses.ErrUnhandled + } + default: + return responses.ErrUnhandled + } + return nil + })) +} + +func (c *Client) handleGreetAndStartReading() error { + var greetErr error + gotGreet := false + + c.registerHandler(responses.HandlerFunc(func(resp imap.Resp) error { + status, ok := resp.(*imap.StatusResp) + if !ok { + greetErr = fmt.Errorf("invalid greeting received from server: not a status response") + return errUnregisterHandler + } + + c.locker.Lock() + switch status.Type { + case imap.StatusRespPreauth: + c.state = imap.AuthenticatedState + case imap.StatusRespBye: + c.state = imap.LogoutState + case imap.StatusRespOk: + c.state = imap.NotAuthenticatedState + default: + c.state = imap.LogoutState + c.locker.Unlock() + greetErr = fmt.Errorf("invalid greeting received from server: %v", status.Type) + return errUnregisterHandler + } + c.locker.Unlock() + + if status.Code == imap.CodeCapability { + c.gotStatusCaps(status.Arguments) + } + + gotGreet = true + return errUnregisterHandler + })) + + // call `readOnce` until we get the greeting or an error + for !gotGreet { + connected, err := c.readOnce() + // Check for read errors + if err != nil { + // return read errors + return err + } + // Check for invalid greet + if greetErr != nil { + // return read errors + return greetErr + } + // Check if connection was closed. + if !connected { + // connection closed. + return io.EOF + } + } + + // We got the greeting, now start the reader goroutine. + go c.reader() + + return nil +} + +// Upgrade a connection, e.g. wrap an unencrypted connection with an encrypted +// tunnel. +// +// This function should not be called directly, it must only be used by +// libraries implementing extensions of the IMAP protocol. +func (c *Client) Upgrade(upgrader imap.ConnUpgrader) error { + return c.conn.Upgrade(upgrader) +} + +// Writer returns the imap.Writer for this client's connection. +// +// This function should not be called directly, it must only be used by +// libraries implementing extensions of the IMAP protocol. +func (c *Client) Writer() *imap.Writer { + return c.conn.Writer +} + +// IsTLS checks if this client's connection has TLS enabled. +func (c *Client) IsTLS() bool { + return c.isTLS +} + +// LoggedOut returns a channel which is closed when the connection to the server +// is closed. +func (c *Client) LoggedOut() <-chan struct{} { + return c.loggedOut +} + +// SetDebug defines an io.Writer to which all network activity will be logged. +// If nil is provided, network activity will not be logged. +func (c *Client) SetDebug(w io.Writer) { + // Need to send a command to unblock the reader goroutine. + cmd := new(commands.Noop) + err := c.Upgrade(func(conn net.Conn) (net.Conn, error) { + // Flag connection as in upgrading + c.upgrading = true + if status, err := c.execute(cmd, nil); err != nil { + return nil, err + } else if err := status.Err(); err != nil { + return nil, err + } + + // Wait for reader to block. + c.conn.WaitReady() + + c.conn.SetDebug(w) + return conn, nil + }) + if err != nil { + log.Println("SetDebug:", err) + } + +} + +// New creates a new client from an existing connection. +func New(conn net.Conn) (*Client, error) { + continues := make(chan bool) + w := imap.NewClientWriter(nil, continues) + r := imap.NewReader(nil) + + c := &Client{ + conn: imap.NewConn(conn, r, w), + loggedOut: make(chan struct{}), + continues: continues, + state: imap.ConnectingState, + ErrorLog: log.New(os.Stderr, "imap/client: ", log.LstdFlags), + } + + c.handleContinuationReqs() + c.handleUnilateral() + if err := c.handleGreetAndStartReading(); err != nil { + return c, err + } + + plusOk, _ := c.Support("LITERAL+") + minusOk, _ := c.Support("LITERAL-") + // We don't use non-sync literal if it is bigger than 4096 bytes, so + // LITERAL- is fine too. + c.conn.AllowAsyncLiterals = plusOk || minusOk + + return c, nil +} + +// Dial connects to an IMAP server using an unencrypted connection. +func Dial(addr string) (*Client, error) { + return DialWithDialer(new(net.Dialer), addr) +} + +type Dialer interface { + // Dial connects to the given address. + Dial(network, addr string) (net.Conn, error) +} + +// DialWithDialer connects to an IMAP server using an unencrypted connection +// using dialer.Dial. +// +// Among other uses, this allows to apply a dial timeout. +func DialWithDialer(dialer Dialer, addr string) (*Client, error) { + conn, err := dialer.Dial("tcp", addr) + if err != nil { + return nil, err + } + + // We don't return to the caller until we try to receive a greeting. As such, + // there is no way to set the client's Timeout for that action. As a + // workaround, if the dialer has a timeout set, use that for the connection's + // deadline. + if netDialer, ok := dialer.(*net.Dialer); ok && netDialer.Timeout > 0 { + err := conn.SetDeadline(time.Now().Add(netDialer.Timeout)) + if err != nil { + return nil, err + } + } + + c, err := New(conn) + if err != nil { + return nil, err + } + + c.serverName, _, _ = net.SplitHostPort(addr) + return c, nil +} + +// DialTLS connects to an IMAP server using an encrypted connection. +func DialTLS(addr string, tlsConfig *tls.Config) (*Client, error) { + return DialWithDialerTLS(new(net.Dialer), addr, tlsConfig) +} + +// DialWithDialerTLS connects to an IMAP server using an encrypted connection +// using dialer.Dial. +// +// Among other uses, this allows to apply a dial timeout. +func DialWithDialerTLS(dialer Dialer, addr string, tlsConfig *tls.Config) (*Client, error) { + conn, err := dialer.Dial("tcp", addr) + if err != nil { + return nil, err + } + + serverName, _, _ := net.SplitHostPort(addr) + if tlsConfig == nil { + tlsConfig = &tls.Config{} + } + if tlsConfig.ServerName == "" { + tlsConfig = tlsConfig.Clone() + tlsConfig.ServerName = serverName + } + tlsConn := tls.Client(conn, tlsConfig) + + // We don't return to the caller until we try to receive a greeting. As such, + // there is no way to set the client's Timeout for that action. As a + // workaround, if the dialer has a timeout set, use that for the connection's + // deadline. + if netDialer, ok := dialer.(*net.Dialer); ok && netDialer.Timeout > 0 { + err := tlsConn.SetDeadline(time.Now().Add(netDialer.Timeout)) + if err != nil { + return nil, err + } + } + + c, err := New(tlsConn) + if err != nil { + return nil, err + } + + c.isTLS = true + c.serverName = serverName + return c, nil +} diff --git a/vendor/github.com/emersion/go-imap/client/cmd_any.go b/vendor/github.com/emersion/go-imap/client/cmd_any.go new file mode 100644 index 00000000..cb0d38a1 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/client/cmd_any.go @@ -0,0 +1,88 @@ +package client + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/commands" +) + +// ErrAlreadyLoggedOut is returned if Logout is called when the client is +// already logged out. +var ErrAlreadyLoggedOut = errors.New("Already logged out") + +// Capability requests a listing of capabilities that the server supports. +// Capabilities are often returned by the server with the greeting or with the +// STARTTLS and LOGIN responses, so usually explicitly requesting capabilities +// isn't needed. +// +// Most of the time, Support should be used instead. +func (c *Client) Capability() (map[string]bool, error) { + cmd := &commands.Capability{} + + if status, err := c.execute(cmd, nil); err != nil { + return nil, err + } else if err := status.Err(); err != nil { + return nil, err + } + + c.locker.Lock() + caps := c.caps + c.locker.Unlock() + return caps, nil +} + +// Support checks if cap is a capability supported by the server. If the server +// hasn't sent its capabilities yet, Support requests them. +func (c *Client) Support(cap string) (bool, error) { + c.locker.Lock() + ok := c.caps != nil + c.locker.Unlock() + + // If capabilities are not cached, request them + if !ok { + if _, err := c.Capability(); err != nil { + return false, err + } + } + + c.locker.Lock() + supported := c.caps[cap] + c.locker.Unlock() + + return supported, nil +} + +// Noop always succeeds and does nothing. +// +// It can be used as a periodic poll for new messages or message status updates +// during a period of inactivity. It can also be used to reset any inactivity +// autologout timer on the server. +func (c *Client) Noop() error { + cmd := new(commands.Noop) + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Logout gracefully closes the connection. +func (c *Client) Logout() error { + if c.State() == imap.LogoutState { + return ErrAlreadyLoggedOut + } + + cmd := new(commands.Logout) + + if status, err := c.execute(cmd, nil); err == errClosed { + // Server closed connection, that's what we want anyway + return nil + } else if err != nil { + return err + } else if status != nil { + return status.Err() + } + return nil +} diff --git a/vendor/github.com/emersion/go-imap/client/cmd_auth.go b/vendor/github.com/emersion/go-imap/client/cmd_auth.go new file mode 100644 index 00000000..a280017a --- /dev/null +++ b/vendor/github.com/emersion/go-imap/client/cmd_auth.go @@ -0,0 +1,380 @@ +package client + +import ( + "errors" + "time" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/commands" + "github.com/emersion/go-imap/responses" +) + +// ErrNotLoggedIn is returned if a function that requires the client to be +// logged in is called then the client isn't. +var ErrNotLoggedIn = errors.New("Not logged in") + +func (c *Client) ensureAuthenticated() error { + state := c.State() + if state != imap.AuthenticatedState && state != imap.SelectedState { + return ErrNotLoggedIn + } + return nil +} + +// Select selects a mailbox so that messages in the mailbox can be accessed. Any +// currently selected mailbox is deselected before attempting the new selection. +// Even if the readOnly parameter is set to false, the server can decide to open +// the mailbox in read-only mode. +func (c *Client) Select(name string, readOnly bool) (*imap.MailboxStatus, error) { + if err := c.ensureAuthenticated(); err != nil { + return nil, err + } + + cmd := &commands.Select{ + Mailbox: name, + ReadOnly: readOnly, + } + + mbox := &imap.MailboxStatus{Name: name, Items: make(map[imap.StatusItem]interface{})} + res := &responses.Select{ + Mailbox: mbox, + } + c.locker.Lock() + c.mailbox = mbox + c.locker.Unlock() + + status, err := c.execute(cmd, res) + if err != nil { + c.locker.Lock() + c.mailbox = nil + c.locker.Unlock() + return nil, err + } + if err := status.Err(); err != nil { + c.locker.Lock() + c.mailbox = nil + c.locker.Unlock() + return nil, err + } + + c.locker.Lock() + mbox.ReadOnly = (status.Code == imap.CodeReadOnly) + c.state = imap.SelectedState + c.locker.Unlock() + return mbox, nil +} + +// Create creates a mailbox with the given name. +func (c *Client) Create(name string) error { + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.Create{ + Mailbox: name, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Delete permanently removes the mailbox with the given name. +func (c *Client) Delete(name string) error { + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.Delete{ + Mailbox: name, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Rename changes the name of a mailbox. +func (c *Client) Rename(existingName, newName string) error { + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.Rename{ + Existing: existingName, + New: newName, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Subscribe adds the specified mailbox name to the server's set of "active" or +// "subscribed" mailboxes. +func (c *Client) Subscribe(name string) error { + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.Subscribe{ + Mailbox: name, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Unsubscribe removes the specified mailbox name from the server's set of +// "active" or "subscribed" mailboxes. +func (c *Client) Unsubscribe(name string) error { + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.Unsubscribe{ + Mailbox: name, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// List returns a subset of names from the complete set of all names available +// to the client. +// +// An empty name argument is a special request to return the hierarchy delimiter +// and the root name of the name given in the reference. The character "*" is a +// wildcard, and matches zero or more characters at this position. The +// character "%" is similar to "*", but it does not match a hierarchy delimiter. +func (c *Client) List(ref, name string, ch chan *imap.MailboxInfo) error { + defer close(ch) + + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.List{ + Reference: ref, + Mailbox: name, + } + res := &responses.List{Mailboxes: ch} + + status, err := c.execute(cmd, res) + if err != nil { + return err + } + return status.Err() +} + +// Lsub returns a subset of names from the set of names that the user has +// declared as being "active" or "subscribed". +func (c *Client) Lsub(ref, name string, ch chan *imap.MailboxInfo) error { + defer close(ch) + + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.List{ + Reference: ref, + Mailbox: name, + Subscribed: true, + } + res := &responses.List{ + Mailboxes: ch, + Subscribed: true, + } + + status, err := c.execute(cmd, res) + if err != nil { + return err + } + return status.Err() +} + +// Status requests the status of the indicated mailbox. It does not change the +// currently selected mailbox, nor does it affect the state of any messages in +// the queried mailbox. +// +// See RFC 3501 section 6.3.10 for a list of items that can be requested. +func (c *Client) Status(name string, items []imap.StatusItem) (*imap.MailboxStatus, error) { + if err := c.ensureAuthenticated(); err != nil { + return nil, err + } + + cmd := &commands.Status{ + Mailbox: name, + Items: items, + } + res := &responses.Status{ + Mailbox: new(imap.MailboxStatus), + } + + status, err := c.execute(cmd, res) + if err != nil { + return nil, err + } + return res.Mailbox, status.Err() +} + +// Append appends the literal argument as a new message to the end of the +// specified destination mailbox. This argument SHOULD be in the format of an +// RFC 2822 message. flags and date are optional arguments and can be set to +// nil and the empty struct. +func (c *Client) Append(mbox string, flags []string, date time.Time, msg imap.Literal) error { + if err := c.ensureAuthenticated(); err != nil { + return err + } + + cmd := &commands.Append{ + Mailbox: mbox, + Flags: flags, + Date: date, + Message: msg, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Enable requests the server to enable the named extensions. The extensions +// which were successfully enabled are returned. +// +// See RFC 5161 section 3.1. +func (c *Client) Enable(caps []string) ([]string, error) { + if ok, err := c.Support("ENABLE"); !ok || err != nil { + return nil, ErrExtensionUnsupported + } + + // ENABLE is invalid if a mailbox has been selected. + if c.State() != imap.AuthenticatedState { + return nil, ErrNotLoggedIn + } + + cmd := &commands.Enable{Caps: caps} + res := &responses.Enabled{} + + if status, err := c.Execute(cmd, res); err != nil { + return nil, err + } else { + return res.Caps, status.Err() + } +} + +func (c *Client) idle(stop <-chan struct{}) error { + cmd := &commands.Idle{} + + res := &responses.Idle{ + Stop: stop, + RepliesCh: make(chan []byte, 10), + } + + if status, err := c.Execute(cmd, res); err != nil { + return err + } else { + return status.Err() + } +} + +// IdleOptions holds options for Client.Idle. +type IdleOptions struct { + // LogoutTimeout is used to avoid being logged out by the server when + // idling. Each LogoutTimeout, the IDLE command is restarted. If set to + // zero, a default is used. If negative, this behavior is disabled. + LogoutTimeout time.Duration + // Poll interval when the server doesn't support IDLE. If zero, a default + // is used. If negative, polling is always disabled. + PollInterval time.Duration +} + +// Idle indicates to the server that the client is ready to receive unsolicited +// mailbox update messages. When the client wants to send commands again, it +// must first close stop. +// +// If the server doesn't support IDLE, go-imap falls back to polling. +func (c *Client) Idle(stop <-chan struct{}, opts *IdleOptions) error { + if ok, err := c.Support("IDLE"); err != nil { + return err + } else if !ok { + return c.idleFallback(stop, opts) + } + + logoutTimeout := 25 * time.Minute + if opts != nil { + if opts.LogoutTimeout > 0 { + logoutTimeout = opts.LogoutTimeout + } else if opts.LogoutTimeout < 0 { + return c.idle(stop) + } + } + + t := time.NewTicker(logoutTimeout) + defer t.Stop() + + for { + stopOrRestart := make(chan struct{}) + done := make(chan error, 1) + go func() { + done <- c.idle(stopOrRestart) + }() + + select { + case <-t.C: + close(stopOrRestart) + if err := <-done; err != nil { + return err + } + case <-stop: + close(stopOrRestart) + return <-done + case err := <-done: + close(stopOrRestart) + if err != nil { + return err + } + } + } +} + +func (c *Client) idleFallback(stop <-chan struct{}, opts *IdleOptions) error { + pollInterval := time.Minute + if opts != nil { + if opts.PollInterval > 0 { + pollInterval = opts.PollInterval + } else if opts.PollInterval < 0 { + return ErrExtensionUnsupported + } + } + + t := time.NewTicker(pollInterval) + defer t.Stop() + + for { + select { + case <-t.C: + if err := c.Noop(); err != nil { + return err + } + case <-stop: + return nil + case <-c.LoggedOut(): + return errors.New("disconnected while idling") + } + } +} diff --git a/vendor/github.com/emersion/go-imap/client/cmd_noauth.go b/vendor/github.com/emersion/go-imap/client/cmd_noauth.go new file mode 100644 index 00000000..f9b34d3e --- /dev/null +++ b/vendor/github.com/emersion/go-imap/client/cmd_noauth.go @@ -0,0 +1,174 @@ +package client + +import ( + "crypto/tls" + "errors" + "net" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/commands" + "github.com/emersion/go-imap/responses" + "github.com/emersion/go-sasl" +) + +var ( + // ErrAlreadyLoggedIn is returned if Login or Authenticate is called when the + // client is already logged in. + ErrAlreadyLoggedIn = errors.New("Already logged in") + // ErrTLSAlreadyEnabled is returned if StartTLS is called when TLS is already + // enabled. + ErrTLSAlreadyEnabled = errors.New("TLS is already enabled") + // ErrLoginDisabled is returned if Login or Authenticate is called when the + // server has disabled authentication. Most of the time, calling enabling TLS + // solves the problem. + ErrLoginDisabled = errors.New("Login is disabled in current state") +) + +// SupportStartTLS checks if the server supports STARTTLS. +func (c *Client) SupportStartTLS() (bool, error) { + return c.Support("STARTTLS") +} + +// StartTLS starts TLS negotiation. +func (c *Client) StartTLS(tlsConfig *tls.Config) error { + if c.isTLS { + return ErrTLSAlreadyEnabled + } + + if tlsConfig == nil { + tlsConfig = new(tls.Config) + } + if tlsConfig.ServerName == "" { + tlsConfig = tlsConfig.Clone() + tlsConfig.ServerName = c.serverName + } + + cmd := new(commands.StartTLS) + + err := c.Upgrade(func(conn net.Conn) (net.Conn, error) { + // Flag connection as in upgrading + c.upgrading = true + if status, err := c.execute(cmd, nil); err != nil { + return nil, err + } else if err := status.Err(); err != nil { + return nil, err + } + + // Wait for reader to block. + c.conn.WaitReady() + tlsConn := tls.Client(conn, tlsConfig) + if err := tlsConn.Handshake(); err != nil { + return nil, err + } + + // Capabilities change when TLS is enabled + c.locker.Lock() + c.caps = nil + c.locker.Unlock() + + return tlsConn, nil + }) + if err != nil { + return err + } + + c.isTLS = true + return nil +} + +// SupportAuth checks if the server supports a given authentication mechanism. +func (c *Client) SupportAuth(mech string) (bool, error) { + return c.Support("AUTH=" + mech) +} + +// Authenticate indicates a SASL authentication mechanism to the server. If the +// server supports the requested authentication mechanism, it performs an +// authentication protocol exchange to authenticate and identify the client. +func (c *Client) Authenticate(auth sasl.Client) error { + if c.State() != imap.NotAuthenticatedState { + return ErrAlreadyLoggedIn + } + + mech, ir, err := auth.Start() + if err != nil { + return err + } + + cmd := &commands.Authenticate{ + Mechanism: mech, + } + + irOk, err := c.Support("SASL-IR") + if err != nil { + return err + } + if irOk { + cmd.InitialResponse = ir + } + + res := &responses.Authenticate{ + Mechanism: auth, + InitialResponse: ir, + RepliesCh: make(chan []byte, 10), + } + if irOk { + res.InitialResponse = nil + } + + status, err := c.execute(cmd, res) + if err != nil { + return err + } + if err = status.Err(); err != nil { + return err + } + + c.locker.Lock() + c.state = imap.AuthenticatedState + c.caps = nil // Capabilities change when user is logged in + c.locker.Unlock() + + if status.Code == "CAPABILITY" { + c.gotStatusCaps(status.Arguments) + } + + return nil +} + +// Login identifies the client to the server and carries the plaintext password +// authenticating this user. +func (c *Client) Login(username, password string) error { + if state := c.State(); state == imap.AuthenticatedState || state == imap.SelectedState { + return ErrAlreadyLoggedIn + } + + c.locker.Lock() + loginDisabled := c.caps != nil && c.caps["LOGINDISABLED"] + c.locker.Unlock() + if loginDisabled { + return ErrLoginDisabled + } + + cmd := &commands.Login{ + Username: username, + Password: password, + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + if err = status.Err(); err != nil { + return err + } + + c.locker.Lock() + c.state = imap.AuthenticatedState + c.caps = nil // Capabilities change when user is logged in + c.locker.Unlock() + + if status.Code == "CAPABILITY" { + c.gotStatusCaps(status.Arguments) + } + return nil +} diff --git a/vendor/github.com/emersion/go-imap/client/cmd_selected.go b/vendor/github.com/emersion/go-imap/client/cmd_selected.go new file mode 100644 index 00000000..0fb71ad9 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/client/cmd_selected.go @@ -0,0 +1,367 @@ +package client + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/commands" + "github.com/emersion/go-imap/responses" +) + +var ( + // ErrNoMailboxSelected is returned if a command that requires a mailbox to be + // selected is called when there isn't. + ErrNoMailboxSelected = errors.New("No mailbox selected") + + // ErrExtensionUnsupported is returned if a command uses a extension that + // is not supported by the server. + ErrExtensionUnsupported = errors.New("The required extension is not supported by the server") +) + +// Check requests a checkpoint of the currently selected mailbox. A checkpoint +// refers to any implementation-dependent housekeeping associated with the +// mailbox that is not normally executed as part of each command. +func (c *Client) Check() error { + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + cmd := new(commands.Check) + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + + return status.Err() +} + +// Close permanently removes all messages that have the \Deleted flag set from +// the currently selected mailbox, and returns to the authenticated state from +// the selected state. +func (c *Client) Close() error { + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + cmd := new(commands.Close) + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } else if err := status.Err(); err != nil { + return err + } + + c.locker.Lock() + c.state = imap.AuthenticatedState + c.mailbox = nil + c.locker.Unlock() + return nil +} + +// Terminate closes the tcp connection +func (c *Client) Terminate() error { + return c.conn.Close() +} + +// Expunge permanently removes all messages that have the \Deleted flag set from +// the currently selected mailbox. If ch is not nil, sends sequence IDs of each +// deleted message to this channel. +func (c *Client) Expunge(ch chan uint32) error { + if ch != nil { + defer close(ch) + } + + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + cmd := new(commands.Expunge) + + var h responses.Handler + if ch != nil { + h = &responses.Expunge{SeqNums: ch} + } + + status, err := c.execute(cmd, h) + if err != nil { + return err + } + return status.Err() +} + +func (c *Client) executeSearch(uid bool, criteria *imap.SearchCriteria, charset string) (ids []uint32, status *imap.StatusResp, err error) { + if c.State() != imap.SelectedState { + err = ErrNoMailboxSelected + return + } + + var cmd imap.Commander = &commands.Search{ + Charset: charset, + Criteria: criteria, + } + if uid { + cmd = &commands.Uid{Cmd: cmd} + } + + res := new(responses.Search) + + status, err = c.execute(cmd, res) + if err != nil { + return + } + + err, ids = status.Err(), res.Ids + return +} + +func (c *Client) search(uid bool, criteria *imap.SearchCriteria) (ids []uint32, err error) { + ids, status, err := c.executeSearch(uid, criteria, "UTF-8") + if status != nil && status.Code == imap.CodeBadCharset { + // Some servers don't support UTF-8 + ids, _, err = c.executeSearch(uid, criteria, "US-ASCII") + } + return +} + +// Search searches the mailbox for messages that match the given searching +// criteria. Searching criteria consist of one or more search keys. The response +// contains a list of message sequence IDs corresponding to those messages that +// match the searching criteria. When multiple keys are specified, the result is +// the intersection (AND function) of all the messages that match those keys. +// Criteria must be UTF-8 encoded. See RFC 3501 section 6.4.4 for a list of +// searching criteria. When no criteria has been set, all messages in the mailbox +// will be searched using ALL criteria. +func (c *Client) Search(criteria *imap.SearchCriteria) (seqNums []uint32, err error) { + return c.search(false, criteria) +} + +// UidSearch is identical to Search, but UIDs are returned instead of message +// sequence numbers. +func (c *Client) UidSearch(criteria *imap.SearchCriteria) (uids []uint32, err error) { + return c.search(true, criteria) +} + +func (c *Client) fetch(uid bool, seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { + defer close(ch) + + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + var cmd imap.Commander = &commands.Fetch{ + SeqSet: seqset, + Items: items, + } + if uid { + cmd = &commands.Uid{Cmd: cmd} + } + + res := &responses.Fetch{Messages: ch, SeqSet: seqset, Uid: uid} + + status, err := c.execute(cmd, res) + if err != nil { + return err + } + return status.Err() +} + +// Fetch retrieves data associated with a message in the mailbox. See RFC 3501 +// section 6.4.5 for a list of items that can be requested. +func (c *Client) Fetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { + return c.fetch(false, seqset, items, ch) +} + +// UidFetch is identical to Fetch, but seqset is interpreted as containing +// unique identifiers instead of message sequence numbers. +func (c *Client) UidFetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { + return c.fetch(true, seqset, items, ch) +} + +func (c *Client) store(uid bool, seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { + if ch != nil { + defer close(ch) + } + + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + // TODO: this could break extensions (this only works when item is FLAGS) + if fields, ok := value.([]interface{}); ok { + for i, field := range fields { + if s, ok := field.(string); ok { + fields[i] = imap.RawString(s) + } + } + } + + // If ch is nil, the updated values are data which will be lost, so don't + // retrieve it. + if ch == nil { + op, _, err := imap.ParseFlagsOp(item) + if err == nil { + item = imap.FormatFlagsOp(op, true) + } + } + + var cmd imap.Commander = &commands.Store{ + SeqSet: seqset, + Item: item, + Value: value, + } + if uid { + cmd = &commands.Uid{Cmd: cmd} + } + + var h responses.Handler + if ch != nil { + h = &responses.Fetch{Messages: ch, SeqSet: seqset, Uid: uid} + } + + status, err := c.execute(cmd, h) + if err != nil { + return err + } + return status.Err() +} + +// Store alters data associated with a message in the mailbox. If ch is not nil, +// the updated value of the data will be sent to this channel. See RFC 3501 +// section 6.4.6 for a list of items that can be updated. +func (c *Client) Store(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { + return c.store(false, seqset, item, value, ch) +} + +// UidStore is identical to Store, but seqset is interpreted as containing +// unique identifiers instead of message sequence numbers. +func (c *Client) UidStore(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { + return c.store(true, seqset, item, value, ch) +} + +func (c *Client) copy(uid bool, seqset *imap.SeqSet, dest string) error { + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + var cmd imap.Commander = &commands.Copy{ + SeqSet: seqset, + Mailbox: dest, + } + if uid { + cmd = &commands.Uid{Cmd: cmd} + } + + status, err := c.execute(cmd, nil) + if err != nil { + return err + } + return status.Err() +} + +// Copy copies the specified message(s) to the end of the specified destination +// mailbox. +func (c *Client) Copy(seqset *imap.SeqSet, dest string) error { + return c.copy(false, seqset, dest) +} + +// UidCopy is identical to Copy, but seqset is interpreted as containing unique +// identifiers instead of message sequence numbers. +func (c *Client) UidCopy(seqset *imap.SeqSet, dest string) error { + return c.copy(true, seqset, dest) +} + +func (c *Client) move(uid bool, seqset *imap.SeqSet, dest string) error { + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + if ok, err := c.Support("MOVE"); err != nil { + return err + } else if !ok { + return c.moveFallback(uid, seqset, dest) + } + + var cmd imap.Commander = &commands.Move{ + SeqSet: seqset, + Mailbox: dest, + } + if uid { + cmd = &commands.Uid{Cmd: cmd} + } + + if status, err := c.Execute(cmd, nil); err != nil { + return err + } else { + return status.Err() + } +} + +// moveFallback uses COPY, STORE and EXPUNGE for servers which don't support +// MOVE. +func (c *Client) moveFallback(uid bool, seqset *imap.SeqSet, dest string) error { + item := imap.FormatFlagsOp(imap.AddFlags, true) + flags := []interface{}{imap.DeletedFlag} + if uid { + if err := c.UidCopy(seqset, dest); err != nil { + return err + } + + if err := c.UidStore(seqset, item, flags, nil); err != nil { + return err + } + } else { + if err := c.Copy(seqset, dest); err != nil { + return err + } + + if err := c.Store(seqset, item, flags, nil); err != nil { + return err + } + } + + return c.Expunge(nil) +} + +// Move moves the specified message(s) to the end of the specified destination +// mailbox. +// +// If the server doesn't support the MOVE extension defined in RFC 6851, +// go-imap will fallback to copy, store and expunge. +func (c *Client) Move(seqset *imap.SeqSet, dest string) error { + return c.move(false, seqset, dest) +} + +// UidMove is identical to Move, but seqset is interpreted as containing unique +// identifiers instead of message sequence numbers. +func (c *Client) UidMove(seqset *imap.SeqSet, dest string) error { + return c.move(true, seqset, dest) +} + +// Unselect frees server's resources associated with the selected mailbox and +// returns the server to the authenticated state. This command performs the same +// actions as Close, except that no messages are permanently removed from the +// currently selected mailbox. +// +// If client does not support the UNSELECT extension, ErrExtensionUnsupported +// is returned. +func (c *Client) Unselect() error { + if ok, err := c.Support("UNSELECT"); !ok || err != nil { + return ErrExtensionUnsupported + } + + if c.State() != imap.SelectedState { + return ErrNoMailboxSelected + } + + cmd := &commands.Unselect{} + if status, err := c.Execute(cmd, nil); err != nil { + return err + } else if err := status.Err(); err != nil { + return err + } + + c.SetState(imap.AuthenticatedState, nil) + return nil +} diff --git a/vendor/github.com/emersion/go-imap/client/tag.go b/vendor/github.com/emersion/go-imap/client/tag.go new file mode 100644 index 00000000..01526ab9 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/client/tag.go @@ -0,0 +1,24 @@ +package client + +import ( + "crypto/rand" + "encoding/base64" +) + +func randomString(n int) (string, error) { + b := make([]byte, n) + _, err := rand.Read(b) + if err != nil { + return "", err + } + + return base64.RawURLEncoding.EncodeToString(b), nil +} + +func generateTag() string { + tag, err := randomString(4) + if err != nil { + panic(err) + } + return tag +} diff --git a/vendor/github.com/emersion/go-imap/command.go b/vendor/github.com/emersion/go-imap/command.go new file mode 100644 index 00000000..dac26965 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/command.go @@ -0,0 +1,57 @@ +package imap + +import ( + "errors" + "strings" +) + +// A value that can be converted to a command. +type Commander interface { + Command() *Command +} + +// A command. +type Command struct { + // The command tag. It acts as a unique identifier for this command. If empty, + // the command is untagged. + Tag string + // The command name. + Name string + // The command arguments. + Arguments []interface{} +} + +// Implements the Commander interface. +func (cmd *Command) Command() *Command { + return cmd +} + +func (cmd *Command) WriteTo(w *Writer) error { + tag := cmd.Tag + if tag == "" { + tag = "*" + } + + fields := []interface{}{RawString(tag), RawString(cmd.Name)} + fields = append(fields, cmd.Arguments...) + return w.writeLine(fields...) +} + +// Parse a command from fields. +func (cmd *Command) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("imap: cannot parse command: no enough fields") + } + + var ok bool + if cmd.Tag, ok = fields[0].(string); !ok { + return errors.New("imap: cannot parse command: invalid tag") + } + if cmd.Name, ok = fields[1].(string); !ok { + return errors.New("imap: cannot parse command: invalid name") + } + cmd.Name = strings.ToUpper(cmd.Name) // Command names are case-insensitive + + cmd.Arguments = fields[2:] + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/append.go b/vendor/github.com/emersion/go-imap/commands/append.go new file mode 100644 index 00000000..d70b584e --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/append.go @@ -0,0 +1,93 @@ +package commands + +import ( + "errors" + "time" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Append is an APPEND command, as defined in RFC 3501 section 6.3.11. +type Append struct { + Mailbox string + Flags []string + Date time.Time + Message imap.Literal +} + +func (cmd *Append) Command() *imap.Command { + var args []interface{} + + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + args = append(args, imap.FormatMailboxName(mailbox)) + + if cmd.Flags != nil { + flags := make([]interface{}, len(cmd.Flags)) + for i, flag := range cmd.Flags { + flags[i] = imap.RawString(flag) + } + args = append(args, flags) + } + + if !cmd.Date.IsZero() { + args = append(args, cmd.Date) + } + + args = append(args, cmd.Message) + + return &imap.Command{ + Name: "APPEND", + Arguments: args, + } +} + +func (cmd *Append) Parse(fields []interface{}) (err error) { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + // Parse mailbox name + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if mailbox, err = utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + // Parse message literal + litIndex := len(fields) - 1 + var ok bool + if cmd.Message, ok = fields[litIndex].(imap.Literal); !ok { + return errors.New("Message must be a literal") + } + + // Remaining fields a optional + fields = fields[1:litIndex] + if len(fields) > 0 { + // Parse flags list + if flags, ok := fields[0].([]interface{}); ok { + if cmd.Flags, err = imap.ParseStringList(flags); err != nil { + return err + } + + for i, flag := range cmd.Flags { + cmd.Flags[i] = imap.CanonicalFlag(flag) + } + + fields = fields[1:] + } + + // Parse date + if len(fields) > 0 { + if date, ok := fields[0].(string); !ok { + return errors.New("Date must be a string") + } else if cmd.Date, err = time.Parse(imap.DateTimeLayout, date); err != nil { + return err + } + } + } + + return +} diff --git a/vendor/github.com/emersion/go-imap/commands/authenticate.go b/vendor/github.com/emersion/go-imap/commands/authenticate.go new file mode 100644 index 00000000..b66f21f3 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/authenticate.go @@ -0,0 +1,124 @@ +package commands + +import ( + "bufio" + "encoding/base64" + "errors" + "io" + "strings" + + "github.com/emersion/go-imap" + "github.com/emersion/go-sasl" +) + +// AuthenticateConn is a connection that supports IMAP authentication. +type AuthenticateConn interface { + io.Reader + + // WriteResp writes an IMAP response to this connection. + WriteResp(res imap.WriterTo) error +} + +// Authenticate is an AUTHENTICATE command, as defined in RFC 3501 section +// 6.2.2. +type Authenticate struct { + Mechanism string + InitialResponse []byte +} + +func (cmd *Authenticate) Command() *imap.Command { + args := []interface{}{imap.RawString(cmd.Mechanism)} + if cmd.InitialResponse != nil { + var encodedResponse string + if len(cmd.InitialResponse) == 0 { + // Empty initial response should be encoded as "=", not empty + // string. + encodedResponse = "=" + } else { + encodedResponse = base64.StdEncoding.EncodeToString(cmd.InitialResponse) + } + + args = append(args, imap.RawString(encodedResponse)) + } + return &imap.Command{ + Name: "AUTHENTICATE", + Arguments: args, + } +} + +func (cmd *Authenticate) Parse(fields []interface{}) error { + if len(fields) < 1 { + return errors.New("Not enough arguments") + } + + var ok bool + if cmd.Mechanism, ok = fields[0].(string); !ok { + return errors.New("Mechanism must be a string") + } + cmd.Mechanism = strings.ToUpper(cmd.Mechanism) + + if len(fields) != 2 { + return nil + } + + encodedResponse, ok := fields[1].(string) + if !ok { + return errors.New("Initial response must be a string") + } + if encodedResponse == "=" { + cmd.InitialResponse = []byte{} + return nil + } + + var err error + cmd.InitialResponse, err = base64.StdEncoding.DecodeString(encodedResponse) + if err != nil { + return err + } + + return nil +} + +func (cmd *Authenticate) Handle(mechanisms map[string]sasl.Server, conn AuthenticateConn) error { + sasl, ok := mechanisms[cmd.Mechanism] + if !ok { + return errors.New("Unsupported mechanism") + } + + scanner := bufio.NewScanner(conn) + + response := cmd.InitialResponse + for { + challenge, done, err := sasl.Next(response) + if err != nil || done { + return err + } + + encoded := base64.StdEncoding.EncodeToString(challenge) + cont := &imap.ContinuationReq{Info: encoded} + if err := conn.WriteResp(cont); err != nil { + return err + } + + if !scanner.Scan() { + if err := scanner.Err(); err != nil { + return err + } + return errors.New("unexpected EOF") + } + + encoded = scanner.Text() + if encoded != "" { + if encoded == "*" { + return &imap.ErrStatusResp{Resp: &imap.StatusResp{ + Type: imap.StatusRespBad, + Info: "negotiation cancelled", + }} + } + response, err = base64.StdEncoding.DecodeString(encoded) + if err != nil { + return err + } + } + } +} diff --git a/vendor/github.com/emersion/go-imap/commands/capability.go b/vendor/github.com/emersion/go-imap/commands/capability.go new file mode 100644 index 00000000..3359c0ab --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/capability.go @@ -0,0 +1,18 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// Capability is a CAPABILITY command, as defined in RFC 3501 section 6.1.1. +type Capability struct{} + +func (c *Capability) Command() *imap.Command { + return &imap.Command{ + Name: "CAPABILITY", + } +} + +func (c *Capability) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/check.go b/vendor/github.com/emersion/go-imap/commands/check.go new file mode 100644 index 00000000..b90df7c7 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/check.go @@ -0,0 +1,18 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// Check is a CHECK command, as defined in RFC 3501 section 6.4.1. +type Check struct{} + +func (cmd *Check) Command() *imap.Command { + return &imap.Command{ + Name: "CHECK", + } +} + +func (cmd *Check) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/close.go b/vendor/github.com/emersion/go-imap/commands/close.go new file mode 100644 index 00000000..cc606586 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/close.go @@ -0,0 +1,18 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// Close is a CLOSE command, as defined in RFC 3501 section 6.4.2. +type Close struct{} + +func (cmd *Close) Command() *imap.Command { + return &imap.Command{ + Name: "CLOSE", + } +} + +func (cmd *Close) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/commands.go b/vendor/github.com/emersion/go-imap/commands/commands.go new file mode 100644 index 00000000..a62b2485 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/commands.go @@ -0,0 +1,2 @@ +// Package commands implements IMAP commands defined in RFC 3501. +package commands diff --git a/vendor/github.com/emersion/go-imap/commands/copy.go b/vendor/github.com/emersion/go-imap/commands/copy.go new file mode 100644 index 00000000..5258f35c --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/copy.go @@ -0,0 +1,47 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Copy is a COPY command, as defined in RFC 3501 section 6.4.7. +type Copy struct { + SeqSet *imap.SeqSet + Mailbox string +} + +func (cmd *Copy) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: "COPY", + Arguments: []interface{}{cmd.SeqSet, imap.FormatMailboxName(mailbox)}, + } +} + +func (cmd *Copy) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + if seqSet, ok := fields[0].(string); !ok { + return errors.New("Invalid sequence set") + } else if seqSet, err := imap.ParseSeqSet(seqSet); err != nil { + return err + } else { + cmd.SeqSet = seqSet + } + + if mailbox, err := imap.ParseString(fields[1]); err != nil { + return err + } else if mailbox, err := utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/create.go b/vendor/github.com/emersion/go-imap/commands/create.go new file mode 100644 index 00000000..a1e6fe22 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/create.go @@ -0,0 +1,38 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Create is a CREATE command, as defined in RFC 3501 section 6.3.3. +type Create struct { + Mailbox string +} + +func (cmd *Create) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: "CREATE", + Arguments: []interface{}{mailbox}, + } +} + +func (cmd *Create) Parse(fields []interface{}) error { + if len(fields) < 1 { + return errors.New("No enough arguments") + } + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if mailbox, err := utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/delete.go b/vendor/github.com/emersion/go-imap/commands/delete.go new file mode 100644 index 00000000..60f4da8a --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/delete.go @@ -0,0 +1,38 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Delete is a DELETE command, as defined in RFC 3501 section 6.3.3. +type Delete struct { + Mailbox string +} + +func (cmd *Delete) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: "DELETE", + Arguments: []interface{}{imap.FormatMailboxName(mailbox)}, + } +} + +func (cmd *Delete) Parse(fields []interface{}) error { + if len(fields) < 1 { + return errors.New("No enough arguments") + } + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if mailbox, err := utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/enable.go b/vendor/github.com/emersion/go-imap/commands/enable.go new file mode 100644 index 00000000..980195ee --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/enable.go @@ -0,0 +1,23 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// An ENABLE command, defined in RFC 5161 section 3.1. +type Enable struct { + Caps []string +} + +func (cmd *Enable) Command() *imap.Command { + return &imap.Command{ + Name: "ENABLE", + Arguments: imap.FormatStringList(cmd.Caps), + } +} + +func (cmd *Enable) Parse(fields []interface{}) error { + var err error + cmd.Caps, err = imap.ParseStringList(fields) + return err +} diff --git a/vendor/github.com/emersion/go-imap/commands/expunge.go b/vendor/github.com/emersion/go-imap/commands/expunge.go new file mode 100644 index 00000000..af550a4d --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/expunge.go @@ -0,0 +1,16 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// Expunge is an EXPUNGE command, as defined in RFC 3501 section 6.4.3. +type Expunge struct{} + +func (cmd *Expunge) Command() *imap.Command { + return &imap.Command{Name: "EXPUNGE"} +} + +func (cmd *Expunge) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/fetch.go b/vendor/github.com/emersion/go-imap/commands/fetch.go new file mode 100644 index 00000000..4eb3ab93 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/fetch.go @@ -0,0 +1,63 @@ +package commands + +import ( + "errors" + "strings" + + "github.com/emersion/go-imap" +) + +// Fetch is a FETCH command, as defined in RFC 3501 section 6.4.5. +type Fetch struct { + SeqSet *imap.SeqSet + Items []imap.FetchItem +} + +func (cmd *Fetch) Command() *imap.Command { + // Handle FETCH macros separately as they should not be serialized within parentheses + if len(cmd.Items) == 1 && (cmd.Items[0] == imap.FetchAll || cmd.Items[0] == imap.FetchFast || cmd.Items[0] == imap.FetchFull) { + return &imap.Command{ + Name: "FETCH", + Arguments: []interface{}{cmd.SeqSet, imap.RawString(cmd.Items[0])}, + } + } else { + items := make([]interface{}, len(cmd.Items)) + for i, item := range cmd.Items { + items[i] = imap.RawString(item) + } + + return &imap.Command{ + Name: "FETCH", + Arguments: []interface{}{cmd.SeqSet, items}, + } + } +} + +func (cmd *Fetch) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + var err error + if seqset, ok := fields[0].(string); !ok { + return errors.New("Sequence set must be an atom") + } else if cmd.SeqSet, err = imap.ParseSeqSet(seqset); err != nil { + return err + } + + switch items := fields[1].(type) { + case string: // A macro or a single item + cmd.Items = imap.FetchItem(strings.ToUpper(items)).Expand() + case []interface{}: // A list of items + cmd.Items = make([]imap.FetchItem, 0, len(items)) + for _, v := range items { + itemStr, _ := v.(string) + item := imap.FetchItem(strings.ToUpper(itemStr)) + cmd.Items = append(cmd.Items, item.Expand()...) + } + default: + return errors.New("Items must be either a string or a list") + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/idle.go b/vendor/github.com/emersion/go-imap/commands/idle.go new file mode 100644 index 00000000..4d9669fe --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/idle.go @@ -0,0 +1,17 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// An IDLE command. +// Se RFC 2177 section 3. +type Idle struct{} + +func (cmd *Idle) Command() *imap.Command { + return &imap.Command{Name: "IDLE"} +} + +func (cmd *Idle) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/list.go b/vendor/github.com/emersion/go-imap/commands/list.go new file mode 100644 index 00000000..52686e9e --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/list.go @@ -0,0 +1,60 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// List is a LIST command, as defined in RFC 3501 section 6.3.8. If Subscribed +// is set to true, LSUB will be used instead. +type List struct { + Reference string + Mailbox string + + Subscribed bool +} + +func (cmd *List) Command() *imap.Command { + name := "LIST" + if cmd.Subscribed { + name = "LSUB" + } + + enc := utf7.Encoding.NewEncoder() + ref, _ := enc.String(cmd.Reference) + mailbox, _ := enc.String(cmd.Mailbox) + + return &imap.Command{ + Name: name, + Arguments: []interface{}{ref, mailbox}, + } +} + +func (cmd *List) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + dec := utf7.Encoding.NewDecoder() + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if mailbox, err := dec.String(mailbox); err != nil { + return err + } else { + // TODO: canonical mailbox path + cmd.Reference = imap.CanonicalMailboxName(mailbox) + } + + if mailbox, err := imap.ParseString(fields[1]); err != nil { + return err + } else if mailbox, err := dec.String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/login.go b/vendor/github.com/emersion/go-imap/commands/login.go new file mode 100644 index 00000000..d0af0b50 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/login.go @@ -0,0 +1,36 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" +) + +// Login is a LOGIN command, as defined in RFC 3501 section 6.2.2. +type Login struct { + Username string + Password string +} + +func (cmd *Login) Command() *imap.Command { + return &imap.Command{ + Name: "LOGIN", + Arguments: []interface{}{cmd.Username, cmd.Password}, + } +} + +func (cmd *Login) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("Not enough arguments") + } + + var err error + if cmd.Username, err = imap.ParseString(fields[0]); err != nil { + return err + } + if cmd.Password, err = imap.ParseString(fields[1]); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/logout.go b/vendor/github.com/emersion/go-imap/commands/logout.go new file mode 100644 index 00000000..e8267195 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/logout.go @@ -0,0 +1,18 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// Logout is a LOGOUT command, as defined in RFC 3501 section 6.1.3. +type Logout struct{} + +func (c *Logout) Command() *imap.Command { + return &imap.Command{ + Name: "LOGOUT", + } +} + +func (c *Logout) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/move.go b/vendor/github.com/emersion/go-imap/commands/move.go new file mode 100644 index 00000000..613a8706 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/move.go @@ -0,0 +1,48 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// A MOVE command. +// See RFC 6851 section 3.1. +type Move struct { + SeqSet *imap.SeqSet + Mailbox string +} + +func (cmd *Move) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: "MOVE", + Arguments: []interface{}{cmd.SeqSet, mailbox}, + } +} + +func (cmd *Move) Parse(fields []interface{}) (err error) { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + seqset, ok := fields[0].(string) + if !ok { + return errors.New("Invalid sequence set") + } + if cmd.SeqSet, err = imap.ParseSeqSet(seqset); err != nil { + return err + } + + mailbox, ok := fields[1].(string) + if !ok { + return errors.New("Mailbox name must be a string") + } + if cmd.Mailbox, err = utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } + + return +} diff --git a/vendor/github.com/emersion/go-imap/commands/noop.go b/vendor/github.com/emersion/go-imap/commands/noop.go new file mode 100644 index 00000000..da6a1c2e --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/noop.go @@ -0,0 +1,18 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// Noop is a NOOP command, as defined in RFC 3501 section 6.1.2. +type Noop struct{} + +func (c *Noop) Command() *imap.Command { + return &imap.Command{ + Name: "NOOP", + } +} + +func (c *Noop) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/rename.go b/vendor/github.com/emersion/go-imap/commands/rename.go new file mode 100644 index 00000000..37a5fa7f --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/rename.go @@ -0,0 +1,51 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Rename is a RENAME command, as defined in RFC 3501 section 6.3.5. +type Rename struct { + Existing string + New string +} + +func (cmd *Rename) Command() *imap.Command { + enc := utf7.Encoding.NewEncoder() + existingName, _ := enc.String(cmd.Existing) + newName, _ := enc.String(cmd.New) + + return &imap.Command{ + Name: "RENAME", + Arguments: []interface{}{imap.FormatMailboxName(existingName), imap.FormatMailboxName(newName)}, + } +} + +func (cmd *Rename) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + dec := utf7.Encoding.NewDecoder() + + if existingName, err := imap.ParseString(fields[0]); err != nil { + return err + } else if existingName, err := dec.String(existingName); err != nil { + return err + } else { + cmd.Existing = imap.CanonicalMailboxName(existingName) + } + + if newName, err := imap.ParseString(fields[1]); err != nil { + return err + } else if newName, err := dec.String(newName); err != nil { + return err + } else { + cmd.New = imap.CanonicalMailboxName(newName) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/search.go b/vendor/github.com/emersion/go-imap/commands/search.go new file mode 100644 index 00000000..72f026c6 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/search.go @@ -0,0 +1,57 @@ +package commands + +import ( + "errors" + "io" + "strings" + + "github.com/emersion/go-imap" +) + +// Search is a SEARCH command, as defined in RFC 3501 section 6.4.4. +type Search struct { + Charset string + Criteria *imap.SearchCriteria +} + +func (cmd *Search) Command() *imap.Command { + var args []interface{} + if cmd.Charset != "" { + args = append(args, imap.RawString("CHARSET"), imap.RawString(cmd.Charset)) + } + args = append(args, cmd.Criteria.Format()...) + + return &imap.Command{ + Name: "SEARCH", + Arguments: args, + } +} + +func (cmd *Search) Parse(fields []interface{}) error { + if len(fields) == 0 { + return errors.New("Missing search criteria") + } + + // Parse charset + if f, ok := fields[0].(string); ok && strings.EqualFold(f, "CHARSET") { + if len(fields) < 2 { + return errors.New("Missing CHARSET value") + } + if cmd.Charset, ok = fields[1].(string); !ok { + return errors.New("Charset must be a string") + } + fields = fields[2:] + } + + var charsetReader func(io.Reader) io.Reader + charset := strings.ToLower(cmd.Charset) + if charset != "utf-8" && charset != "us-ascii" && charset != "" { + charsetReader = func(r io.Reader) io.Reader { + r, _ = imap.CharsetReader(charset, r) + return r + } + } + + cmd.Criteria = new(imap.SearchCriteria) + return cmd.Criteria.ParseWithCharset(fields, charsetReader) +} diff --git a/vendor/github.com/emersion/go-imap/commands/select.go b/vendor/github.com/emersion/go-imap/commands/select.go new file mode 100644 index 00000000..e881effe --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/select.go @@ -0,0 +1,45 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Select is a SELECT command, as defined in RFC 3501 section 6.3.1. If ReadOnly +// is set to true, the EXAMINE command will be used instead. +type Select struct { + Mailbox string + ReadOnly bool +} + +func (cmd *Select) Command() *imap.Command { + name := "SELECT" + if cmd.ReadOnly { + name = "EXAMINE" + } + + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: name, + Arguments: []interface{}{imap.FormatMailboxName(mailbox)}, + } +} + +func (cmd *Select) Parse(fields []interface{}) error { + if len(fields) < 1 { + return errors.New("No enough arguments") + } + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if mailbox, err := utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/starttls.go b/vendor/github.com/emersion/go-imap/commands/starttls.go new file mode 100644 index 00000000..d900e5eb --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/starttls.go @@ -0,0 +1,18 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// StartTLS is a STARTTLS command, as defined in RFC 3501 section 6.2.1. +type StartTLS struct{} + +func (cmd *StartTLS) Command() *imap.Command { + return &imap.Command{ + Name: "STARTTLS", + } +} + +func (cmd *StartTLS) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/status.go b/vendor/github.com/emersion/go-imap/commands/status.go new file mode 100644 index 00000000..672dce5c --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/status.go @@ -0,0 +1,58 @@ +package commands + +import ( + "errors" + "strings" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Status is a STATUS command, as defined in RFC 3501 section 6.3.10. +type Status struct { + Mailbox string + Items []imap.StatusItem +} + +func (cmd *Status) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + items := make([]interface{}, len(cmd.Items)) + for i, item := range cmd.Items { + items[i] = imap.RawString(item) + } + + return &imap.Command{ + Name: "STATUS", + Arguments: []interface{}{imap.FormatMailboxName(mailbox), items}, + } +} + +func (cmd *Status) Parse(fields []interface{}) error { + if len(fields) < 2 { + return errors.New("No enough arguments") + } + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if mailbox, err := utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } else { + cmd.Mailbox = imap.CanonicalMailboxName(mailbox) + } + + items, ok := fields[1].([]interface{}) + if !ok { + return errors.New("STATUS command parameter is not a list") + } + cmd.Items = make([]imap.StatusItem, len(items)) + for i, f := range items { + if s, ok := f.(string); !ok { + return errors.New("Got a non-string field in a STATUS command parameter") + } else { + cmd.Items[i] = imap.StatusItem(strings.ToUpper(s)) + } + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/store.go b/vendor/github.com/emersion/go-imap/commands/store.go new file mode 100644 index 00000000..aeee3e62 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/store.go @@ -0,0 +1,50 @@ +package commands + +import ( + "errors" + "strings" + + "github.com/emersion/go-imap" +) + +// Store is a STORE command, as defined in RFC 3501 section 6.4.6. +type Store struct { + SeqSet *imap.SeqSet + Item imap.StoreItem + Value interface{} +} + +func (cmd *Store) Command() *imap.Command { + return &imap.Command{ + Name: "STORE", + Arguments: []interface{}{cmd.SeqSet, imap.RawString(cmd.Item), cmd.Value}, + } +} + +func (cmd *Store) Parse(fields []interface{}) error { + if len(fields) < 3 { + return errors.New("No enough arguments") + } + + seqset, ok := fields[0].(string) + if !ok { + return errors.New("Invalid sequence set") + } + var err error + if cmd.SeqSet, err = imap.ParseSeqSet(seqset); err != nil { + return err + } + + if item, ok := fields[1].(string); !ok { + return errors.New("Item name must be a string") + } else { + cmd.Item = imap.StoreItem(strings.ToUpper(item)) + } + + if len(fields[2:]) == 1 { + cmd.Value = fields[2] + } else { + cmd.Value = fields[2:] + } + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/subscribe.go b/vendor/github.com/emersion/go-imap/commands/subscribe.go new file mode 100644 index 00000000..6540969c --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/subscribe.go @@ -0,0 +1,63 @@ +package commands + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +// Subscribe is a SUBSCRIBE command, as defined in RFC 3501 section 6.3.6. +type Subscribe struct { + Mailbox string +} + +func (cmd *Subscribe) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: "SUBSCRIBE", + Arguments: []interface{}{imap.FormatMailboxName(mailbox)}, + } +} + +func (cmd *Subscribe) Parse(fields []interface{}) error { + if len(fields) < 0 { + return errors.New("No enough arguments") + } + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if cmd.Mailbox, err = utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } + return nil +} + +// An UNSUBSCRIBE command. +// See RFC 3501 section 6.3.7 +type Unsubscribe struct { + Mailbox string +} + +func (cmd *Unsubscribe) Command() *imap.Command { + mailbox, _ := utf7.Encoding.NewEncoder().String(cmd.Mailbox) + + return &imap.Command{ + Name: "UNSUBSCRIBE", + Arguments: []interface{}{imap.FormatMailboxName(mailbox)}, + } +} + +func (cmd *Unsubscribe) Parse(fields []interface{}) error { + if len(fields) < 0 { + return errors.New("No enogh arguments") + } + + if mailbox, err := imap.ParseString(fields[0]); err != nil { + return err + } else if cmd.Mailbox, err = utf7.Encoding.NewDecoder().String(mailbox); err != nil { + return err + } + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/uid.go b/vendor/github.com/emersion/go-imap/commands/uid.go new file mode 100644 index 00000000..979af144 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/uid.go @@ -0,0 +1,44 @@ +package commands + +import ( + "errors" + "strings" + + "github.com/emersion/go-imap" +) + +// Uid is a UID command, as defined in RFC 3501 section 6.4.8. It wraps another +// command (e.g. wrapping a Fetch command will result in a UID FETCH). +type Uid struct { + Cmd imap.Commander +} + +func (cmd *Uid) Command() *imap.Command { + inner := cmd.Cmd.Command() + + args := []interface{}{imap.RawString(inner.Name)} + args = append(args, inner.Arguments...) + + return &imap.Command{ + Name: "UID", + Arguments: args, + } +} + +func (cmd *Uid) Parse(fields []interface{}) error { + if len(fields) < 0 { + return errors.New("No command name specified") + } + + name, ok := fields[0].(string) + if !ok { + return errors.New("Command name must be a string") + } + + cmd.Cmd = &imap.Command{ + Name: strings.ToUpper(name), // Command names are case-insensitive + Arguments: fields[1:], + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/commands/unselect.go b/vendor/github.com/emersion/go-imap/commands/unselect.go new file mode 100644 index 00000000..da5c63d2 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/commands/unselect.go @@ -0,0 +1,17 @@ +package commands + +import ( + "github.com/emersion/go-imap" +) + +// An UNSELECT command. +// See RFC 3691 section 2. +type Unselect struct{} + +func (cmd *Unselect) Command() *imap.Command { + return &imap.Command{Name: "UNSELECT"} +} + +func (cmd *Unselect) Parse(fields []interface{}) error { + return nil +} diff --git a/vendor/github.com/emersion/go-imap/conn.go b/vendor/github.com/emersion/go-imap/conn.go new file mode 100644 index 00000000..09ce6330 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/conn.go @@ -0,0 +1,284 @@ +package imap + +import ( + "bufio" + "crypto/tls" + "io" + "net" + "sync" +) + +// A connection state. +// See RFC 3501 section 3. +type ConnState int + +const ( + // In the connecting state, the server has not yet sent a greeting and no + // command can be issued. + ConnectingState = 0 + + // In the not authenticated state, the client MUST supply + // authentication credentials before most commands will be + // permitted. This state is entered when a connection starts + // unless the connection has been pre-authenticated. + NotAuthenticatedState ConnState = 1 << 0 + + // In the authenticated state, the client is authenticated and MUST + // select a mailbox to access before commands that affect messages + // will be permitted. This state is entered when a + // pre-authenticated connection starts, when acceptable + // authentication credentials have been provided, after an error in + // selecting a mailbox, or after a successful CLOSE command. + AuthenticatedState = 1 << 1 + + // In a selected state, a mailbox has been selected to access. + // This state is entered when a mailbox has been successfully + // selected. + SelectedState = AuthenticatedState + 1<<2 + + // In the logout state, the connection is being terminated. This + // state can be entered as a result of a client request (via the + // LOGOUT command) or by unilateral action on the part of either + // the client or server. + LogoutState = 1 << 3 + + // ConnectedState is either NotAuthenticatedState, AuthenticatedState or + // SelectedState. + ConnectedState = NotAuthenticatedState | AuthenticatedState | SelectedState +) + +// A function that upgrades a connection. +// +// This should only be used by libraries implementing an IMAP extension (e.g. +// COMPRESS). +type ConnUpgrader func(conn net.Conn) (net.Conn, error) + +type Waiter struct { + start sync.WaitGroup + end sync.WaitGroup + finished bool +} + +func NewWaiter() *Waiter { + w := &Waiter{finished: false} + w.start.Add(1) + w.end.Add(1) + return w +} + +func (w *Waiter) Wait() { + if !w.finished { + // Signal that we are ready for upgrade to continue. + w.start.Done() + // Wait for upgrade to finish. + w.end.Wait() + w.finished = true + } +} + +func (w *Waiter) WaitReady() { + if !w.finished { + // Wait for reader/writer goroutine to be ready for upgrade. + w.start.Wait() + } +} + +func (w *Waiter) Close() { + if !w.finished { + // Upgrade is finished, close chanel to release reader/writer + w.end.Done() + } +} + +type LockedWriter struct { + lock sync.Mutex + writer io.Writer +} + +// NewLockedWriter - goroutine safe writer. +func NewLockedWriter(w io.Writer) io.Writer { + return &LockedWriter{writer: w} +} + +func (w *LockedWriter) Write(b []byte) (int, error) { + w.lock.Lock() + defer w.lock.Unlock() + return w.writer.Write(b) +} + +type debugWriter struct { + io.Writer + + local io.Writer + remote io.Writer +} + +// NewDebugWriter creates a new io.Writer that will write local network activity +// to local and remote network activity to remote. +func NewDebugWriter(local, remote io.Writer) io.Writer { + return &debugWriter{Writer: local, local: local, remote: remote} +} + +type multiFlusher struct { + flushers []flusher +} + +func (mf *multiFlusher) Flush() error { + for _, f := range mf.flushers { + if err := f.Flush(); err != nil { + return err + } + } + return nil +} + +func newMultiFlusher(flushers ...flusher) flusher { + return &multiFlusher{flushers} +} + +// Underlying connection state information. +type ConnInfo struct { + RemoteAddr net.Addr + LocalAddr net.Addr + + // nil if connection is not using TLS. + TLS *tls.ConnectionState +} + +// An IMAP connection. +type Conn struct { + net.Conn + *Reader + *Writer + + br *bufio.Reader + bw *bufio.Writer + + waiter *Waiter + + // Print all commands and responses to this io.Writer. + debug io.Writer +} + +// NewConn creates a new IMAP connection. +func NewConn(conn net.Conn, r *Reader, w *Writer) *Conn { + c := &Conn{Conn: conn, Reader: r, Writer: w} + + c.init() + return c +} + +func (c *Conn) createWaiter() *Waiter { + // create new waiter each time. + w := NewWaiter() + c.waiter = w + return w +} + +func (c *Conn) init() { + r := io.Reader(c.Conn) + w := io.Writer(c.Conn) + + if c.debug != nil { + localDebug, remoteDebug := c.debug, c.debug + if debug, ok := c.debug.(*debugWriter); ok { + localDebug, remoteDebug = debug.local, debug.remote + } + // If local and remote are the same, then we need a LockedWriter. + if localDebug == remoteDebug { + localDebug = NewLockedWriter(localDebug) + remoteDebug = localDebug + } + + if localDebug != nil { + w = io.MultiWriter(c.Conn, localDebug) + } + if remoteDebug != nil { + r = io.TeeReader(c.Conn, remoteDebug) + } + } + + if c.br == nil { + c.br = bufio.NewReader(r) + c.Reader.reader = c.br + } else { + c.br.Reset(r) + } + + if c.bw == nil { + c.bw = bufio.NewWriter(w) + c.Writer.Writer = c.bw + } else { + c.bw.Reset(w) + } + + if f, ok := c.Conn.(flusher); ok { + c.Writer.Writer = struct { + io.Writer + flusher + }{ + c.bw, + newMultiFlusher(c.bw, f), + } + } +} + +func (c *Conn) Info() *ConnInfo { + info := &ConnInfo{ + RemoteAddr: c.RemoteAddr(), + LocalAddr: c.LocalAddr(), + } + + tlsConn, ok := c.Conn.(*tls.Conn) + if ok { + state := tlsConn.ConnectionState() + info.TLS = &state + } + + return info +} + +// Write implements io.Writer. +func (c *Conn) Write(b []byte) (n int, err error) { + return c.Writer.Write(b) +} + +// Flush writes any buffered data to the underlying connection. +func (c *Conn) Flush() error { + return c.Writer.Flush() +} + +// Upgrade a connection, e.g. wrap an unencrypted connection with an encrypted +// tunnel. +func (c *Conn) Upgrade(upgrader ConnUpgrader) error { + // Block reads and writes during the upgrading process + w := c.createWaiter() + defer w.Close() + + upgraded, err := upgrader(c.Conn) + if err != nil { + return err + } + + c.Conn = upgraded + c.init() + return nil +} + +// Called by reader/writer goroutines to wait for Upgrade to finish +func (c *Conn) Wait() { + c.waiter.Wait() +} + +// Called by Upgrader to wait for reader/writer goroutines to be ready for +// upgrade. +func (c *Conn) WaitReady() { + c.waiter.WaitReady() +} + +// SetDebug defines an io.Writer to which all network activity will be logged. +// If nil is provided, network activity will not be logged. +func (c *Conn) SetDebug(w io.Writer) { + c.debug = w + c.init() +} diff --git a/vendor/github.com/emersion/go-imap/date.go b/vendor/github.com/emersion/go-imap/date.go new file mode 100644 index 00000000..bf996473 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/date.go @@ -0,0 +1,71 @@ +package imap + +import ( + "fmt" + "regexp" + "time" +) + +// Date and time layouts. +// Dovecot adds a leading zero to dates: +// https://github.com/dovecot/core/blob/4fbd5c5e113078e72f29465ccc96d44955ceadc2/src/lib-imap/imap-date.c#L166 +// Cyrus adds a leading space to dates: +// https://github.com/cyrusimap/cyrus-imapd/blob/1cb805a3bffbdf829df0964f3b802cdc917e76db/lib/times.c#L543 +// GMail doesn't support leading spaces in dates used in SEARCH commands. +const ( + // Defined in RFC 3501 as date-text on page 83. + DateLayout = "_2-Jan-2006" + // Defined in RFC 3501 as date-time on page 83. + DateTimeLayout = "_2-Jan-2006 15:04:05 -0700" + // Defined in RFC 5322 section 3.3, mentioned as env-date in RFC 3501 page 84. + envelopeDateTimeLayout = "Mon, 02 Jan 2006 15:04:05 -0700" + // Use as an example in RFC 3501 page 54. + searchDateLayout = "2-Jan-2006" +) + +// time.Time with a specific layout. +type ( + Date time.Time + DateTime time.Time + envelopeDateTime time.Time + searchDate time.Time +) + +// Permutations of the layouts defined in RFC 5322, section 3.3. +var envelopeDateTimeLayouts = [...]string{ + envelopeDateTimeLayout, // popular, try it first + "_2 Jan 2006 15:04:05 -0700", + "_2 Jan 2006 15:04:05 MST", + "_2 Jan 2006 15:04 -0700", + "_2 Jan 2006 15:04 MST", + "_2 Jan 06 15:04:05 -0700", + "_2 Jan 06 15:04:05 MST", + "_2 Jan 06 15:04 -0700", + "_2 Jan 06 15:04 MST", + "Mon, _2 Jan 2006 15:04:05 -0700", + "Mon, _2 Jan 2006 15:04:05 MST", + "Mon, _2 Jan 2006 15:04 -0700", + "Mon, _2 Jan 2006 15:04 MST", + "Mon, _2 Jan 06 15:04:05 -0700", + "Mon, _2 Jan 06 15:04:05 MST", + "Mon, _2 Jan 06 15:04 -0700", + "Mon, _2 Jan 06 15:04 MST", +} + +// TODO: this is a blunt way to strip any trailing CFWS (comment). A sharper +// one would strip multiple CFWS, and only if really valid according to +// RFC5322. +var commentRE = regexp.MustCompile(`[ \t]+\(.*\)$`) + +// Try parsing the date based on the layouts defined in RFC 5322, section 3.3. +// Inspired by https://github.com/golang/go/blob/master/src/net/mail/message.go +func parseMessageDateTime(maybeDate string) (time.Time, error) { + maybeDate = commentRE.ReplaceAllString(maybeDate, "") + for _, layout := range envelopeDateTimeLayouts { + parsed, err := time.Parse(layout, maybeDate) + if err == nil { + return parsed, nil + } + } + return time.Time{}, fmt.Errorf("date %s could not be parsed", maybeDate) +} diff --git a/vendor/github.com/emersion/go-imap/imap.go b/vendor/github.com/emersion/go-imap/imap.go new file mode 100644 index 00000000..837d78db --- /dev/null +++ b/vendor/github.com/emersion/go-imap/imap.go @@ -0,0 +1,108 @@ +// Package imap implements IMAP4rev1 (RFC 3501). +package imap + +import ( + "errors" + "io" + "strings" +) + +// A StatusItem is a mailbox status data item that can be retrieved with a +// STATUS command. See RFC 3501 section 6.3.10. +type StatusItem string + +const ( + StatusMessages StatusItem = "MESSAGES" + StatusRecent StatusItem = "RECENT" + StatusUidNext StatusItem = "UIDNEXT" + StatusUidValidity StatusItem = "UIDVALIDITY" + StatusUnseen StatusItem = "UNSEEN" + + StatusAppendLimit StatusItem = "APPENDLIMIT" +) + +// A FetchItem is a message data item that can be fetched. +type FetchItem string + +// List of items that can be fetched. +const ( + // Macros + FetchAll FetchItem = "ALL" + FetchFast FetchItem = "FAST" + FetchFull FetchItem = "FULL" + + // Items + FetchBody FetchItem = "BODY" + FetchBodyStructure FetchItem = "BODYSTRUCTURE" + FetchEnvelope FetchItem = "ENVELOPE" + FetchFlags FetchItem = "FLAGS" + FetchInternalDate FetchItem = "INTERNALDATE" + FetchRFC822 FetchItem = "RFC822" + FetchRFC822Header FetchItem = "RFC822.HEADER" + FetchRFC822Size FetchItem = "RFC822.SIZE" + FetchRFC822Text FetchItem = "RFC822.TEXT" + FetchUid FetchItem = "UID" +) + +// Expand expands the item if it's a macro. +func (item FetchItem) Expand() []FetchItem { + switch item { + case FetchAll: + return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size, FetchEnvelope} + case FetchFast: + return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size} + case FetchFull: + return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size, FetchEnvelope, FetchBody} + default: + return []FetchItem{item} + } +} + +// FlagsOp is an operation that will be applied on message flags. +type FlagsOp string + +const ( + // SetFlags replaces existing flags by new ones. + SetFlags FlagsOp = "FLAGS" + // AddFlags adds new flags. + AddFlags = "+FLAGS" + // RemoveFlags removes existing flags. + RemoveFlags = "-FLAGS" +) + +// silentOp can be appended to a FlagsOp to prevent the operation from +// triggering unilateral message updates. +const silentOp = ".SILENT" + +// A StoreItem is a message data item that can be updated. +type StoreItem string + +// FormatFlagsOp returns the StoreItem that executes the flags operation op. +func FormatFlagsOp(op FlagsOp, silent bool) StoreItem { + s := string(op) + if silent { + s += silentOp + } + return StoreItem(s) +} + +// ParseFlagsOp parses a flags operation from StoreItem. +func ParseFlagsOp(item StoreItem) (op FlagsOp, silent bool, err error) { + itemStr := string(item) + silent = strings.HasSuffix(itemStr, silentOp) + if silent { + itemStr = strings.TrimSuffix(itemStr, silentOp) + } + op = FlagsOp(itemStr) + + if op != SetFlags && op != AddFlags && op != RemoveFlags { + err = errors.New("Unsupported STORE operation") + } + return +} + +// CharsetReader, if non-nil, defines a function to generate charset-conversion +// readers, converting from the provided charset into UTF-8. Charsets are always +// lower-case. utf-8 and us-ascii charsets are handled by default. One of the +// the CharsetReader's result values must be non-nil. +var CharsetReader func(charset string, r io.Reader) (io.Reader, error) diff --git a/vendor/github.com/emersion/go-imap/literal.go b/vendor/github.com/emersion/go-imap/literal.go new file mode 100644 index 00000000..b5b7f553 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/literal.go @@ -0,0 +1,13 @@ +package imap + +import ( + "io" +) + +// A literal, as defined in RFC 3501 section 4.3. +type Literal interface { + io.Reader + + // Len returns the number of bytes of the literal. + Len() int +} diff --git a/vendor/github.com/emersion/go-imap/logger.go b/vendor/github.com/emersion/go-imap/logger.go new file mode 100644 index 00000000..fa96cdc6 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/logger.go @@ -0,0 +1,8 @@ +package imap + +// Logger is the behaviour used by server/client to +// report errors for accepting connections and unexpected behavior from handlers. +type Logger interface { + Printf(format string, v ...interface{}) + Println(v ...interface{}) +} diff --git a/vendor/github.com/emersion/go-imap/mailbox.go b/vendor/github.com/emersion/go-imap/mailbox.go new file mode 100644 index 00000000..8f12d4d2 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/mailbox.go @@ -0,0 +1,314 @@ +package imap + +import ( + "errors" + "fmt" + "strings" + "sync" + + "github.com/emersion/go-imap/utf7" +) + +// The primary mailbox, as defined in RFC 3501 section 5.1. +const InboxName = "INBOX" + +// CanonicalMailboxName returns the canonical form of a mailbox name. Mailbox names can be +// case-sensitive or case-insensitive depending on the backend implementation. +// The special INBOX mailbox is case-insensitive. +func CanonicalMailboxName(name string) string { + if strings.EqualFold(name, InboxName) { + return InboxName + } + return name +} + +// Mailbox attributes definied in RFC 3501 section 7.2.2. +const ( + // It is not possible for any child levels of hierarchy to exist under this\ + // name; no child levels exist now and none can be created in the future. + NoInferiorsAttr = "\\Noinferiors" + // It is not possible to use this name as a selectable mailbox. + NoSelectAttr = "\\Noselect" + // The mailbox has been marked "interesting" by the server; the mailbox + // probably contains messages that have been added since the last time the + // mailbox was selected. + MarkedAttr = "\\Marked" + // The mailbox does not contain any additional messages since the last time + // the mailbox was selected. + UnmarkedAttr = "\\Unmarked" +) + +// Mailbox attributes defined in RFC 6154 section 2 (SPECIAL-USE extension). +const ( + // This mailbox presents all messages in the user's message store. + AllAttr = "\\All" + // This mailbox is used to archive messages. + ArchiveAttr = "\\Archive" + // This mailbox is used to hold draft messages -- typically, messages that are + // being composed but have not yet been sent. + DraftsAttr = "\\Drafts" + // This mailbox presents all messages marked in some way as "important". + FlaggedAttr = "\\Flagged" + // This mailbox is where messages deemed to be junk mail are held. + JunkAttr = "\\Junk" + // This mailbox is used to hold copies of messages that have been sent. + SentAttr = "\\Sent" + // This mailbox is used to hold messages that have been deleted or marked for + // deletion. + TrashAttr = "\\Trash" +) + +// Mailbox attributes defined in RFC 3348 (CHILDREN extension) +const ( + // The presence of this attribute indicates that the mailbox has child + // mailboxes. + HasChildrenAttr = "\\HasChildren" + // The presence of this attribute indicates that the mailbox has no child + // mailboxes. + HasNoChildrenAttr = "\\HasNoChildren" +) + +// This mailbox attribute is a signal that the mailbox contains messages that +// are likely important to the user. This attribute is defined in RFC 8457 +// section 3. +const ImportantAttr = "\\Important" + +// Basic mailbox info. +type MailboxInfo struct { + // The mailbox attributes. + Attributes []string + // The server's path separator. + Delimiter string + // The mailbox name. + Name string +} + +// Parse mailbox info from fields. +func (info *MailboxInfo) Parse(fields []interface{}) error { + if len(fields) < 3 { + return errors.New("Mailbox info needs at least 3 fields") + } + + var err error + if info.Attributes, err = ParseStringList(fields[0]); err != nil { + return err + } + + var ok bool + if info.Delimiter, ok = fields[1].(string); !ok { + // The delimiter may be specified as NIL, which gets converted to a nil interface. + if fields[1] != nil { + return errors.New("Mailbox delimiter must be a string") + } + info.Delimiter = "" + } + + if name, err := ParseString(fields[2]); err != nil { + return err + } else if name, err := utf7.Encoding.NewDecoder().String(name); err != nil { + return err + } else { + info.Name = CanonicalMailboxName(name) + } + + return nil +} + +// Format mailbox info to fields. +func (info *MailboxInfo) Format() []interface{} { + name, _ := utf7.Encoding.NewEncoder().String(info.Name) + attrs := make([]interface{}, len(info.Attributes)) + for i, attr := range info.Attributes { + attrs[i] = RawString(attr) + } + + // If the delimiter is NIL, we need to treat it specially by inserting + // a nil field (so that it's later converted to an unquoted NIL atom). + var del interface{} + + if info.Delimiter != "" { + del = info.Delimiter + } + + // Thunderbird doesn't understand delimiters if not quoted + return []interface{}{attrs, del, FormatMailboxName(name)} +} + +// TODO: optimize this +func (info *MailboxInfo) match(name, pattern string) bool { + i := strings.IndexAny(pattern, "*%") + if i == -1 { + // No more wildcards + return name == pattern + } + + // Get parts before and after wildcard + chunk, wildcard, rest := pattern[0:i], pattern[i], pattern[i+1:] + + // Check that name begins with chunk + if len(chunk) > 0 && !strings.HasPrefix(name, chunk) { + return false + } + name = strings.TrimPrefix(name, chunk) + + // Expand wildcard + var j int + for j = 0; j < len(name); j++ { + if wildcard == '%' && string(name[j]) == info.Delimiter { + break // Stop on delimiter if wildcard is % + } + // Try to match the rest from here + if info.match(name[j:], rest) { + return true + } + } + + return info.match(name[j:], rest) +} + +// Match checks if a reference and a pattern matches this mailbox name, as +// defined in RFC 3501 section 6.3.8. +func (info *MailboxInfo) Match(reference, pattern string) bool { + name := info.Name + + if info.Delimiter != "" && strings.HasPrefix(pattern, info.Delimiter) { + reference = "" + pattern = strings.TrimPrefix(pattern, info.Delimiter) + } + if reference != "" { + if info.Delimiter != "" && !strings.HasSuffix(reference, info.Delimiter) { + reference += info.Delimiter + } + if !strings.HasPrefix(name, reference) { + return false + } + name = strings.TrimPrefix(name, reference) + } + + return info.match(name, pattern) +} + +// A mailbox status. +type MailboxStatus struct { + // The mailbox name. + Name string + // True if the mailbox is open in read-only mode. + ReadOnly bool + // The mailbox items that are currently filled in. This map's values + // should not be used directly, they must only be used by libraries + // implementing extensions of the IMAP protocol. + Items map[StatusItem]interface{} + + // The Items map may be accessed in different goroutines. Protect + // concurrent writes. + ItemsLocker sync.Mutex + + // The mailbox flags. + Flags []string + // The mailbox permanent flags. + PermanentFlags []string + // The sequence number of the first unseen message in the mailbox. + UnseenSeqNum uint32 + + // The number of messages in this mailbox. + Messages uint32 + // The number of messages not seen since the last time the mailbox was opened. + Recent uint32 + // The number of unread messages. + Unseen uint32 + // The next UID. + UidNext uint32 + // Together with a UID, it is a unique identifier for a message. + // Must be greater than or equal to 1. + UidValidity uint32 + + // Per-mailbox limit of message size. Set only if server supports the + // APPENDLIMIT extension. + AppendLimit uint32 +} + +// Create a new mailbox status that will contain the specified items. +func NewMailboxStatus(name string, items []StatusItem) *MailboxStatus { + status := &MailboxStatus{ + Name: name, + Items: make(map[StatusItem]interface{}), + } + + for _, k := range items { + status.Items[k] = nil + } + + return status +} + +func (status *MailboxStatus) Parse(fields []interface{}) error { + status.Items = make(map[StatusItem]interface{}) + + var k StatusItem + for i, f := range fields { + if i%2 == 0 { + if kstr, ok := f.(string); !ok { + return fmt.Errorf("cannot parse mailbox status: key is not a string, but a %T", f) + } else { + k = StatusItem(strings.ToUpper(kstr)) + } + } else { + status.Items[k] = nil + + var err error + switch k { + case StatusMessages: + status.Messages, err = ParseNumber(f) + case StatusRecent: + status.Recent, err = ParseNumber(f) + case StatusUnseen: + status.Unseen, err = ParseNumber(f) + case StatusUidNext: + status.UidNext, err = ParseNumber(f) + case StatusUidValidity: + status.UidValidity, err = ParseNumber(f) + case StatusAppendLimit: + status.AppendLimit, err = ParseNumber(f) + default: + status.Items[k] = f + } + + if err != nil { + return err + } + } + } + + return nil +} + +func (status *MailboxStatus) Format() []interface{} { + var fields []interface{} + for k, v := range status.Items { + switch k { + case StatusMessages: + v = status.Messages + case StatusRecent: + v = status.Recent + case StatusUnseen: + v = status.Unseen + case StatusUidNext: + v = status.UidNext + case StatusUidValidity: + v = status.UidValidity + case StatusAppendLimit: + v = status.AppendLimit + } + + fields = append(fields, RawString(k), v) + } + return fields +} + +func FormatMailboxName(name string) interface{} { + // Some e-mails servers don't handle quoted INBOX names correctly so we special-case it. + if strings.EqualFold(name, "INBOX") { + return RawString(name) + } + return name +} diff --git a/vendor/github.com/emersion/go-imap/message.go b/vendor/github.com/emersion/go-imap/message.go new file mode 100644 index 00000000..bd28325d --- /dev/null +++ b/vendor/github.com/emersion/go-imap/message.go @@ -0,0 +1,1186 @@ +package imap + +import ( + "bytes" + "errors" + "fmt" + "io" + "mime" + "strconv" + "strings" + "time" +) + +// System message flags, defined in RFC 3501 section 2.3.2. +const ( + SeenFlag = "\\Seen" + AnsweredFlag = "\\Answered" + FlaggedFlag = "\\Flagged" + DeletedFlag = "\\Deleted" + DraftFlag = "\\Draft" + RecentFlag = "\\Recent" +) + +// ImportantFlag is a message flag to signal that a message is likely important +// to the user. This flag is defined in RFC 8457 section 2. +const ImportantFlag = "$Important" + +// TryCreateFlag is a special flag in MailboxStatus.PermanentFlags indicating +// that it is possible to create new keywords by attempting to store those +// flags in the mailbox. +const TryCreateFlag = "\\*" + +var flags = []string{ + SeenFlag, + AnsweredFlag, + FlaggedFlag, + DeletedFlag, + DraftFlag, + RecentFlag, +} + +// A PartSpecifier specifies which parts of the MIME entity should be returned. +type PartSpecifier string + +// Part specifiers described in RFC 3501 page 55. +const ( + // Refers to the entire part, including headers. + EntireSpecifier PartSpecifier = "" + // Refers to the header of the part. Must include the final CRLF delimiting + // the header and the body. + HeaderSpecifier = "HEADER" + // Refers to the text body of the part, omitting the header. + TextSpecifier = "TEXT" + // Refers to the MIME Internet Message Body header. Must include the final + // CRLF delimiting the header and the body. + MIMESpecifier = "MIME" +) + +// CanonicalFlag returns the canonical form of a flag. Flags are case-insensitive. +// +// If the flag is defined in RFC 3501, it returns the flag with the case of the +// RFC. Otherwise, it returns the lowercase version of the flag. +func CanonicalFlag(flag string) string { + for _, f := range flags { + if strings.EqualFold(f, flag) { + return f + } + } + return strings.ToLower(flag) +} + +func ParseParamList(fields []interface{}) (map[string]string, error) { + params := make(map[string]string) + + var k string + for i, f := range fields { + p, err := ParseString(f) + if err != nil { + return nil, errors.New("Parameter list contains a non-string: " + err.Error()) + } + + if i%2 == 0 { + k = p + } else { + params[k] = p + k = "" + } + } + + if k != "" { + return nil, errors.New("Parameter list contains a key without a value") + } + return params, nil +} + +func FormatParamList(params map[string]string) []interface{} { + var fields []interface{} + for key, value := range params { + fields = append(fields, key, value) + } + return fields +} + +var wordDecoder = &mime.WordDecoder{ + CharsetReader: func(charset string, input io.Reader) (io.Reader, error) { + if CharsetReader != nil { + return CharsetReader(charset, input) + } + return nil, fmt.Errorf("imap: unhandled charset %q", charset) + }, +} + +func decodeHeader(s string) (string, error) { + dec, err := wordDecoder.DecodeHeader(s) + if err != nil { + return s, err + } + return dec, nil +} + +func encodeHeader(s string) string { + return mime.QEncoding.Encode("utf-8", s) +} + +func stringLowered(i interface{}) (string, bool) { + s, ok := i.(string) + return strings.ToLower(s), ok +} + +func parseHeaderParamList(fields []interface{}) (map[string]string, error) { + params, err := ParseParamList(fields) + if err != nil { + return nil, err + } + + for k, v := range params { + if lower := strings.ToLower(k); lower != k { + delete(params, k) + k = lower + } + + params[k], _ = decodeHeader(v) + } + + return params, nil +} + +func formatHeaderParamList(params map[string]string) []interface{} { + encoded := make(map[string]string) + for k, v := range params { + encoded[k] = encodeHeader(v) + } + return FormatParamList(encoded) +} + +// A message. +type Message struct { + // The message sequence number. It must be greater than or equal to 1. + SeqNum uint32 + // The mailbox items that are currently filled in. This map's values + // should not be used directly, they must only be used by libraries + // implementing extensions of the IMAP protocol. + Items map[FetchItem]interface{} + + // The message envelope. + Envelope *Envelope + // The message body structure (either BODYSTRUCTURE or BODY). + BodyStructure *BodyStructure + // The message flags. + Flags []string + // The date the message was received by the server. + InternalDate time.Time + // The message size. + Size uint32 + // The message unique identifier. It must be greater than or equal to 1. + Uid uint32 + // The message body sections. + Body map[*BodySectionName]Literal + + // The order in which items were requested. This order must be preserved + // because some bad IMAP clients (looking at you, Outlook!) refuse responses + // containing items in a different order. + itemsOrder []FetchItem +} + +// Create a new empty message that will contain the specified items. +func NewMessage(seqNum uint32, items []FetchItem) *Message { + msg := &Message{ + SeqNum: seqNum, + Items: make(map[FetchItem]interface{}), + Body: make(map[*BodySectionName]Literal), + itemsOrder: items, + } + + for _, k := range items { + msg.Items[k] = nil + } + + return msg +} + +// Parse a message from fields. +func (m *Message) Parse(fields []interface{}) error { + m.Items = make(map[FetchItem]interface{}) + m.Body = map[*BodySectionName]Literal{} + m.itemsOrder = nil + + var k FetchItem + for i, f := range fields { + if i%2 == 0 { // It's a key + switch f := f.(type) { + case string: + k = FetchItem(strings.ToUpper(f)) + case RawString: + k = FetchItem(strings.ToUpper(string(f))) + default: + return fmt.Errorf("cannot parse message: key is not a string, but a %T", f) + } + } else { // It's a value + m.Items[k] = nil + m.itemsOrder = append(m.itemsOrder, k) + + switch k { + case FetchBody, FetchBodyStructure: + bs, ok := f.([]interface{}) + if !ok { + return fmt.Errorf("cannot parse message: BODYSTRUCTURE is not a list, but a %T", f) + } + + m.BodyStructure = &BodyStructure{Extended: k == FetchBodyStructure} + if err := m.BodyStructure.Parse(bs); err != nil { + return err + } + case FetchEnvelope: + env, ok := f.([]interface{}) + if !ok { + return fmt.Errorf("cannot parse message: ENVELOPE is not a list, but a %T", f) + } + + m.Envelope = &Envelope{} + if err := m.Envelope.Parse(env); err != nil { + return err + } + case FetchFlags: + flags, ok := f.([]interface{}) + if !ok { + return fmt.Errorf("cannot parse message: FLAGS is not a list, but a %T", f) + } + + m.Flags = make([]string, len(flags)) + for i, flag := range flags { + s, _ := ParseString(flag) + m.Flags[i] = CanonicalFlag(s) + } + case FetchInternalDate: + date, _ := f.(string) + m.InternalDate, _ = time.Parse(DateTimeLayout, date) + case FetchRFC822Size: + m.Size, _ = ParseNumber(f) + case FetchUid: + m.Uid, _ = ParseNumber(f) + default: + // Likely to be a section of the body + // First check that the section name is correct + if section, err := ParseBodySectionName(k); err != nil { + // Not a section name, maybe an attribute defined in an IMAP extension + m.Items[k] = f + } else { + m.Body[section], _ = f.(Literal) + } + } + } + } + + return nil +} + +func (m *Message) formatItem(k FetchItem) []interface{} { + v := m.Items[k] + var kk interface{} = RawString(k) + + switch k { + case FetchBody, FetchBodyStructure: + // Extension data is only returned with the BODYSTRUCTURE fetch + m.BodyStructure.Extended = k == FetchBodyStructure + v = m.BodyStructure.Format() + case FetchEnvelope: + v = m.Envelope.Format() + case FetchFlags: + flags := make([]interface{}, len(m.Flags)) + for i, flag := range m.Flags { + flags[i] = RawString(flag) + } + v = flags + case FetchInternalDate: + v = m.InternalDate + case FetchRFC822Size: + v = m.Size + case FetchUid: + v = m.Uid + default: + for section, literal := range m.Body { + if section.value == k { + // This can contain spaces, so we can't pass it as a string directly + kk = section.resp() + v = literal + break + } + } + } + + return []interface{}{kk, v} +} + +func (m *Message) Format() []interface{} { + var fields []interface{} + + // First send ordered items + processed := make(map[FetchItem]bool) + for _, k := range m.itemsOrder { + if _, ok := m.Items[k]; ok { + fields = append(fields, m.formatItem(k)...) + processed[k] = true + } + } + + // Then send other remaining items + for k := range m.Items { + if !processed[k] { + fields = append(fields, m.formatItem(k)...) + } + } + + return fields +} + +// GetBody gets the body section with the specified name. Returns nil if it's not found. +func (m *Message) GetBody(section *BodySectionName) Literal { + section = section.resp() + + for s, body := range m.Body { + if section.Equal(s) { + if body == nil { + // Server can return nil, we need to treat as empty string per RFC 3501 + body = bytes.NewReader(nil) + } + return body + } + } + return nil +} + +// A body section name. +// See RFC 3501 page 55. +type BodySectionName struct { + BodyPartName + + // If set to true, do not implicitly set the \Seen flag. + Peek bool + // The substring of the section requested. The first value is the position of + // the first desired octet and the second value is the maximum number of + // octets desired. + Partial []int + + value FetchItem +} + +func (section *BodySectionName) parse(s string) error { + section.value = FetchItem(s) + + if s == "RFC822" { + s = "BODY[]" + } + if s == "RFC822.HEADER" { + s = "BODY.PEEK[HEADER]" + } + if s == "RFC822.TEXT" { + s = "BODY[TEXT]" + } + + partStart := strings.Index(s, "[") + if partStart == -1 { + return errors.New("Invalid body section name: must contain an open bracket") + } + + partEnd := strings.LastIndex(s, "]") + if partEnd == -1 { + return errors.New("Invalid body section name: must contain a close bracket") + } + + name := s[:partStart] + part := s[partStart+1 : partEnd] + partial := s[partEnd+1:] + + if name == "BODY.PEEK" { + section.Peek = true + } else if name != "BODY" { + return errors.New("Invalid body section name") + } + + b := bytes.NewBufferString(part + string(cr) + string(lf)) + r := NewReader(b) + fields, err := r.ReadFields() + if err != nil { + return err + } + + if err := section.BodyPartName.parse(fields); err != nil { + return err + } + + if len(partial) > 0 { + if !strings.HasPrefix(partial, "<") || !strings.HasSuffix(partial, ">") { + return errors.New("Invalid body section name: invalid partial") + } + partial = partial[1 : len(partial)-1] + + partialParts := strings.SplitN(partial, ".", 2) + + var from, length int + if from, err = strconv.Atoi(partialParts[0]); err != nil { + return errors.New("Invalid body section name: invalid partial: invalid from: " + err.Error()) + } + section.Partial = []int{from} + + if len(partialParts) == 2 { + if length, err = strconv.Atoi(partialParts[1]); err != nil { + return errors.New("Invalid body section name: invalid partial: invalid length: " + err.Error()) + } + section.Partial = append(section.Partial, length) + } + } + + return nil +} + +func (section *BodySectionName) FetchItem() FetchItem { + if section.value != "" { + return section.value + } + + s := "BODY" + if section.Peek { + s += ".PEEK" + } + + s += "[" + section.BodyPartName.string() + "]" + + if len(section.Partial) > 0 { + s += "<" + s += strconv.Itoa(section.Partial[0]) + + if len(section.Partial) > 1 { + s += "." + s += strconv.Itoa(section.Partial[1]) + } + + s += ">" + } + + return FetchItem(s) +} + +// Equal checks whether two sections are equal. +func (section *BodySectionName) Equal(other *BodySectionName) bool { + if section.Peek != other.Peek { + return false + } + if len(section.Partial) != len(other.Partial) { + return false + } + if len(section.Partial) > 0 && section.Partial[0] != other.Partial[0] { + return false + } + if len(section.Partial) > 1 && section.Partial[1] != other.Partial[1] { + return false + } + return section.BodyPartName.Equal(&other.BodyPartName) +} + +func (section *BodySectionName) resp() *BodySectionName { + resp := *section // Copy section + if resp.Peek { + resp.Peek = false + } + if len(resp.Partial) == 2 { + resp.Partial = []int{resp.Partial[0]} + } + if !strings.HasPrefix(string(resp.value), string(FetchRFC822)) { + resp.value = "" + } + return &resp +} + +// ExtractPartial returns a subset of the specified bytes matching the partial requested in the +// section name. +func (section *BodySectionName) ExtractPartial(b []byte) []byte { + if len(section.Partial) != 2 { + return b + } + + from := section.Partial[0] + length := section.Partial[1] + to := from + length + if from > len(b) { + return nil + } + if to > len(b) { + to = len(b) + } + return b[from:to] +} + +// ParseBodySectionName parses a body section name. +func ParseBodySectionName(s FetchItem) (*BodySectionName, error) { + section := new(BodySectionName) + err := section.parse(string(s)) + return section, err +} + +// A body part name. +type BodyPartName struct { + // The specifier of the requested part. + Specifier PartSpecifier + // The part path. Parts indexes start at 1. + Path []int + // If Specifier is HEADER, contains header fields that will/won't be returned, + // depending of the value of NotFields. + Fields []string + // If set to true, Fields is a blacklist of fields instead of a whitelist. + NotFields bool +} + +func (part *BodyPartName) parse(fields []interface{}) error { + if len(fields) == 0 { + return nil + } + + name, ok := fields[0].(string) + if !ok { + return errors.New("Invalid body section name: part name must be a string") + } + + args := fields[1:] + + path := strings.Split(strings.ToUpper(name), ".") + + end := 0 +loop: + for i, node := range path { + switch PartSpecifier(node) { + case EntireSpecifier, HeaderSpecifier, MIMESpecifier, TextSpecifier: + part.Specifier = PartSpecifier(node) + end = i + 1 + break loop + } + + index, err := strconv.Atoi(node) + if err != nil { + return errors.New("Invalid body part name: " + err.Error()) + } + if index <= 0 { + return errors.New("Invalid body part name: index <= 0") + } + + part.Path = append(part.Path, index) + } + + if part.Specifier == HeaderSpecifier && len(path) > end && path[end] == "FIELDS" && len(args) > 0 { + end++ + if len(path) > end && path[end] == "NOT" { + part.NotFields = true + } + + names, ok := args[0].([]interface{}) + if !ok { + return errors.New("Invalid body part name: HEADER.FIELDS must have a list argument") + } + + for _, namei := range names { + if name, ok := namei.(string); ok { + part.Fields = append(part.Fields, name) + } + } + } + + return nil +} + +func (part *BodyPartName) string() string { + path := make([]string, len(part.Path)) + for i, index := range part.Path { + path[i] = strconv.Itoa(index) + } + + if part.Specifier != EntireSpecifier { + path = append(path, string(part.Specifier)) + } + + if part.Specifier == HeaderSpecifier && len(part.Fields) > 0 { + path = append(path, "FIELDS") + + if part.NotFields { + path = append(path, "NOT") + } + } + + s := strings.Join(path, ".") + + if len(part.Fields) > 0 { + s += " (" + strings.Join(part.Fields, " ") + ")" + } + + return s +} + +// Equal checks whether two body part names are equal. +func (part *BodyPartName) Equal(other *BodyPartName) bool { + if part.Specifier != other.Specifier { + return false + } + if part.NotFields != other.NotFields { + return false + } + if len(part.Path) != len(other.Path) { + return false + } + for i, node := range part.Path { + if node != other.Path[i] { + return false + } + } + if len(part.Fields) != len(other.Fields) { + return false + } + for _, field := range part.Fields { + found := false + for _, f := range other.Fields { + if strings.EqualFold(field, f) { + found = true + break + } + } + if !found { + return false + } + } + return true +} + +// An address. +type Address struct { + // The personal name. + PersonalName string + // The SMTP at-domain-list (source route). + AtDomainList string + // The mailbox name. + MailboxName string + // The host name. + HostName string +} + +// Address returns the mailbox address (e.g. "foo@example.org"). +func (addr *Address) Address() string { + return addr.MailboxName + "@" + addr.HostName +} + +// Parse an address from fields. +func (addr *Address) Parse(fields []interface{}) error { + if len(fields) < 4 { + return errors.New("Address doesn't contain 4 fields") + } + + if s, err := ParseString(fields[0]); err == nil { + addr.PersonalName, _ = decodeHeader(s) + } + if s, err := ParseString(fields[1]); err == nil { + addr.AtDomainList, _ = decodeHeader(s) + } + + s, err := ParseString(fields[2]) + if err != nil { + return errors.New("Mailbox name could not be parsed") + } + addr.MailboxName, _ = decodeHeader(s) + + s, err = ParseString(fields[3]) + if err != nil { + return errors.New("Host name could not be parsed") + } + addr.HostName, _ = decodeHeader(s) + + return nil +} + +// Format an address to fields. +func (addr *Address) Format() []interface{} { + fields := make([]interface{}, 4) + + if addr.PersonalName != "" { + fields[0] = encodeHeader(addr.PersonalName) + } + if addr.AtDomainList != "" { + fields[1] = addr.AtDomainList + } + if addr.MailboxName != "" { + fields[2] = addr.MailboxName + } + if addr.HostName != "" { + fields[3] = addr.HostName + } + + return fields +} + +// Parse an address list from fields. +func ParseAddressList(fields []interface{}) (addrs []*Address) { + for _, f := range fields { + if addrFields, ok := f.([]interface{}); ok { + addr := &Address{} + if err := addr.Parse(addrFields); err == nil { + addrs = append(addrs, addr) + } + } + } + + return +} + +// Format an address list to fields. +func FormatAddressList(addrs []*Address) interface{} { + if len(addrs) == 0 { + return nil + } + + fields := make([]interface{}, len(addrs)) + + for i, addr := range addrs { + fields[i] = addr.Format() + } + + return fields +} + +// A message envelope, ie. message metadata from its headers. +// See RFC 3501 page 77. +type Envelope struct { + // The message date. + Date time.Time + // The message subject. + Subject string + // The From header addresses. + From []*Address + // The message senders. + Sender []*Address + // The Reply-To header addresses. + ReplyTo []*Address + // The To header addresses. + To []*Address + // The Cc header addresses. + Cc []*Address + // The Bcc header addresses. + Bcc []*Address + // The In-Reply-To header. Contains the parent Message-Id. + InReplyTo string + // The Message-Id header. + MessageId string +} + +// Parse an envelope from fields. +func (e *Envelope) Parse(fields []interface{}) error { + if len(fields) < 10 { + return errors.New("ENVELOPE doesn't contain 10 fields") + } + + if date, ok := fields[0].(string); ok { + e.Date, _ = parseMessageDateTime(date) + } + if subject, err := ParseString(fields[1]); err == nil { + e.Subject, _ = decodeHeader(subject) + } + if from, ok := fields[2].([]interface{}); ok { + e.From = ParseAddressList(from) + } + if sender, ok := fields[3].([]interface{}); ok { + e.Sender = ParseAddressList(sender) + } + if replyTo, ok := fields[4].([]interface{}); ok { + e.ReplyTo = ParseAddressList(replyTo) + } + if to, ok := fields[5].([]interface{}); ok { + e.To = ParseAddressList(to) + } + if cc, ok := fields[6].([]interface{}); ok { + e.Cc = ParseAddressList(cc) + } + if bcc, ok := fields[7].([]interface{}); ok { + e.Bcc = ParseAddressList(bcc) + } + if inReplyTo, ok := fields[8].(string); ok { + e.InReplyTo = inReplyTo + } + if msgId, ok := fields[9].(string); ok { + e.MessageId = msgId + } + + return nil +} + +// Format an envelope to fields. +func (e *Envelope) Format() (fields []interface{}) { + fields = make([]interface{}, 0, 10) + fields = append(fields, envelopeDateTime(e.Date)) + if e.Subject != "" { + fields = append(fields, encodeHeader(e.Subject)) + } else { + fields = append(fields, nil) + } + fields = append(fields, + FormatAddressList(e.From), + FormatAddressList(e.Sender), + FormatAddressList(e.ReplyTo), + FormatAddressList(e.To), + FormatAddressList(e.Cc), + FormatAddressList(e.Bcc), + ) + if e.InReplyTo != "" { + fields = append(fields, e.InReplyTo) + } else { + fields = append(fields, nil) + } + if e.MessageId != "" { + fields = append(fields, e.MessageId) + } else { + fields = append(fields, nil) + } + return fields +} + +// A body structure. +// See RFC 3501 page 74. +type BodyStructure struct { + // Basic fields + + // The MIME type (e.g. "text", "image") + MIMEType string + // The MIME subtype (e.g. "plain", "png") + MIMESubType string + // The MIME parameters. + Params map[string]string + + // The Content-Id header. + Id string + // The Content-Description header. + Description string + // The Content-Encoding header. + Encoding string + // The Content-Length header. + Size uint32 + + // Type-specific fields + + // The children parts, if multipart. + Parts []*BodyStructure + // The envelope, if message/rfc822. + Envelope *Envelope + // The body structure, if message/rfc822. + BodyStructure *BodyStructure + // The number of lines, if text or message/rfc822. + Lines uint32 + + // Extension data + + // True if the body structure contains extension data. + Extended bool + + // The Content-Disposition header field value. + Disposition string + // The Content-Disposition header field parameters. + DispositionParams map[string]string + // The Content-Language header field, if multipart. + Language []string + // The content URI, if multipart. + Location []string + + // The MD5 checksum. + MD5 string +} + +func (bs *BodyStructure) Parse(fields []interface{}) error { + if len(fields) == 0 { + return nil + } + + // Initialize params map + bs.Params = make(map[string]string) + + switch fields[0].(type) { + case []interface{}: // A multipart body part + bs.MIMEType = "multipart" + + end := 0 + for i, fi := range fields { + switch f := fi.(type) { + case []interface{}: // A part + part := new(BodyStructure) + if err := part.Parse(f); err != nil { + return err + } + bs.Parts = append(bs.Parts, part) + case string: + end = i + } + + if end > 0 { + break + } + } + + bs.MIMESubType, _ = fields[end].(string) + end++ + + // GMail seems to return only 3 extension data fields. Parse as many fields + // as we can. + if len(fields) > end { + bs.Extended = true // Contains extension data + + params, _ := fields[end].([]interface{}) + bs.Params, _ = parseHeaderParamList(params) + end++ + } + if len(fields) > end { + if disp, ok := fields[end].([]interface{}); ok && len(disp) >= 2 { + if s, ok := disp[0].(string); ok { + bs.Disposition, _ = decodeHeader(s) + bs.Disposition = strings.ToLower(bs.Disposition) + } + if params, ok := disp[1].([]interface{}); ok { + bs.DispositionParams, _ = parseHeaderParamList(params) + } + } + end++ + } + if len(fields) > end { + switch langs := fields[end].(type) { + case string: + bs.Language = []string{langs} + case []interface{}: + bs.Language, _ = ParseStringList(langs) + default: + bs.Language = nil + } + end++ + } + if len(fields) > end { + location, _ := fields[end].([]interface{}) + bs.Location, _ = ParseStringList(location) + end++ + } + case string: // A non-multipart body part + if len(fields) < 7 { + return errors.New("Non-multipart body part doesn't have 7 fields") + } + + bs.MIMEType, _ = stringLowered(fields[0]) + bs.MIMESubType, _ = stringLowered(fields[1]) + + params, _ := fields[2].([]interface{}) + bs.Params, _ = parseHeaderParamList(params) + + bs.Id, _ = fields[3].(string) + if desc, err := ParseString(fields[4]); err == nil { + bs.Description, _ = decodeHeader(desc) + } + bs.Encoding, _ = stringLowered(fields[5]) + bs.Size, _ = ParseNumber(fields[6]) + + end := 7 + + // Type-specific fields + if strings.EqualFold(bs.MIMEType, "message") && strings.EqualFold(bs.MIMESubType, "rfc822") { + if len(fields)-end < 3 { + return errors.New("Missing type-specific fields for message/rfc822") + } + + envelope, _ := fields[end].([]interface{}) + bs.Envelope = new(Envelope) + bs.Envelope.Parse(envelope) + + structure, _ := fields[end+1].([]interface{}) + bs.BodyStructure = new(BodyStructure) + bs.BodyStructure.Parse(structure) + + bs.Lines, _ = ParseNumber(fields[end+2]) + + end += 3 + } + if strings.EqualFold(bs.MIMEType, "text") { + if len(fields)-end < 1 { + return errors.New("Missing type-specific fields for text/*") + } + + bs.Lines, _ = ParseNumber(fields[end]) + end++ + } + + // GMail seems to return only 3 extension data fields. Parse as many fields + // as we can. + if len(fields) > end { + bs.Extended = true // Contains extension data + + bs.MD5, _ = fields[end].(string) + end++ + } + if len(fields) > end { + if disp, ok := fields[end].([]interface{}); ok && len(disp) >= 2 { + if s, ok := disp[0].(string); ok { + bs.Disposition, _ = decodeHeader(s) + bs.Disposition = strings.ToLower(bs.Disposition) + } + if params, ok := disp[1].([]interface{}); ok { + bs.DispositionParams, _ = parseHeaderParamList(params) + } + } + end++ + } + if len(fields) > end { + switch langs := fields[end].(type) { + case string: + bs.Language = []string{langs} + case []interface{}: + bs.Language, _ = ParseStringList(langs) + default: + bs.Language = nil + } + end++ + } + if len(fields) > end { + location, _ := fields[end].([]interface{}) + bs.Location, _ = ParseStringList(location) + end++ + } + } + + return nil +} + +func (bs *BodyStructure) Format() (fields []interface{}) { + if strings.EqualFold(bs.MIMEType, "multipart") { + for _, part := range bs.Parts { + fields = append(fields, part.Format()) + } + + fields = append(fields, bs.MIMESubType) + + if bs.Extended { + extended := make([]interface{}, 4) + + if bs.Params != nil { + extended[0] = formatHeaderParamList(bs.Params) + } + if bs.Disposition != "" { + extended[1] = []interface{}{ + encodeHeader(bs.Disposition), + formatHeaderParamList(bs.DispositionParams), + } + } + if bs.Language != nil { + extended[2] = FormatStringList(bs.Language) + } + if bs.Location != nil { + extended[3] = FormatStringList(bs.Location) + } + + fields = append(fields, extended...) + } + } else { + fields = make([]interface{}, 7) + fields[0] = bs.MIMEType + fields[1] = bs.MIMESubType + fields[2] = formatHeaderParamList(bs.Params) + + if bs.Id != "" { + fields[3] = bs.Id + } + if bs.Description != "" { + fields[4] = encodeHeader(bs.Description) + } + if bs.Encoding != "" { + fields[5] = bs.Encoding + } + + fields[6] = bs.Size + + // Type-specific fields + if strings.EqualFold(bs.MIMEType, "message") && strings.EqualFold(bs.MIMESubType, "rfc822") { + var env interface{} + if bs.Envelope != nil { + env = bs.Envelope.Format() + } + + var bsbs interface{} + if bs.BodyStructure != nil { + bsbs = bs.BodyStructure.Format() + } + + fields = append(fields, env, bsbs, bs.Lines) + } + if strings.EqualFold(bs.MIMEType, "text") { + fields = append(fields, bs.Lines) + } + + // Extension data + if bs.Extended { + extended := make([]interface{}, 4) + + if bs.MD5 != "" { + extended[0] = bs.MD5 + } + if bs.Disposition != "" { + extended[1] = []interface{}{ + encodeHeader(bs.Disposition), + formatHeaderParamList(bs.DispositionParams), + } + } + if bs.Language != nil { + extended[2] = FormatStringList(bs.Language) + } + if bs.Location != nil { + extended[3] = FormatStringList(bs.Location) + } + + fields = append(fields, extended...) + } + } + + return +} + +// Filename parses the body structure's filename, if it's an attachment. An +// empty string is returned if the filename isn't specified. An error is +// returned if and only if a charset error occurs, in which case the undecoded +// filename is returned too. +func (bs *BodyStructure) Filename() (string, error) { + raw, ok := bs.DispositionParams["filename"] + if !ok { + // Using "name" in Content-Type is discouraged + raw = bs.Params["name"] + } + return decodeHeader(raw) +} + +// BodyStructureWalkFunc is the type of the function called for each body +// structure visited by BodyStructure.Walk. The path argument contains the IMAP +// part path (see BodyPartName). +// +// The function should return true to visit all of the part's children or false +// to skip them. +type BodyStructureWalkFunc func(path []int, part *BodyStructure) (walkChildren bool) + +// Walk walks the body structure tree, calling f for each part in the tree, +// including bs itself. The parts are visited in DFS pre-order. +func (bs *BodyStructure) Walk(f BodyStructureWalkFunc) { + // Non-multipart messages only have part 1 + if len(bs.Parts) == 0 { + f([]int{1}, bs) + return + } + + bs.walk(f, nil) +} + +func (bs *BodyStructure) walk(f BodyStructureWalkFunc, path []int) { + if !f(path, bs) { + return + } + + for i, part := range bs.Parts { + num := i + 1 + + partPath := append([]int(nil), path...) + partPath = append(partPath, num) + + part.walk(f, partPath) + } +} diff --git a/vendor/github.com/emersion/go-imap/read.go b/vendor/github.com/emersion/go-imap/read.go new file mode 100644 index 00000000..112ee28b --- /dev/null +++ b/vendor/github.com/emersion/go-imap/read.go @@ -0,0 +1,467 @@ +package imap + +import ( + "bytes" + "errors" + "io" + "strconv" + "strings" +) + +const ( + sp = ' ' + cr = '\r' + lf = '\n' + dquote = '"' + literalStart = '{' + literalEnd = '}' + listStart = '(' + listEnd = ')' + respCodeStart = '[' + respCodeEnd = ']' +) + +const ( + crlf = "\r\n" + nilAtom = "NIL" +) + +// TODO: add CTL to atomSpecials +var ( + quotedSpecials = string([]rune{dquote, '\\'}) + respSpecials = string([]rune{respCodeEnd}) + atomSpecials = string([]rune{listStart, listEnd, literalStart, sp, '%', '*'}) + quotedSpecials + respSpecials +) + +type parseError struct { + error +} + +func newParseError(text string) error { + return &parseError{errors.New(text)} +} + +// IsParseError returns true if the provided error is a parse error produced by +// Reader. +func IsParseError(err error) bool { + _, ok := err.(*parseError) + return ok +} + +// A string reader. +type StringReader interface { + // ReadString reads until the first occurrence of delim in the input, + // returning a string containing the data up to and including the delimiter. + // See https://golang.org/pkg/bufio/#Reader.ReadString + ReadString(delim byte) (line string, err error) +} + +type reader interface { + io.Reader + io.RuneScanner + StringReader +} + +// ParseNumber parses a number. +func ParseNumber(f interface{}) (uint32, error) { + // Useful for tests + if n, ok := f.(uint32); ok { + return n, nil + } + + var s string + switch f := f.(type) { + case RawString: + s = string(f) + case string: + s = f + default: + return 0, newParseError("expected a number, got a non-atom") + } + + nbr, err := strconv.ParseUint(string(s), 10, 32) + if err != nil { + return 0, &parseError{err} + } + + return uint32(nbr), nil +} + +// ParseString parses a string, which is either a literal, a quoted string or an +// atom. +func ParseString(f interface{}) (string, error) { + if s, ok := f.(string); ok { + return s, nil + } + + // Useful for tests + if a, ok := f.(RawString); ok { + return string(a), nil + } + + if l, ok := f.(Literal); ok { + b := make([]byte, l.Len()) + if _, err := io.ReadFull(l, b); err != nil { + return "", err + } + return string(b), nil + } + + return "", newParseError("expected a string") +} + +// Convert a field list to a string list. +func ParseStringList(f interface{}) ([]string, error) { + fields, ok := f.([]interface{}) + if !ok { + return nil, newParseError("expected a string list, got a non-list") + } + + list := make([]string, len(fields)) + for i, f := range fields { + var err error + if list[i], err = ParseString(f); err != nil { + return nil, newParseError("cannot parse string in string list: " + err.Error()) + } + } + return list, nil +} + +func trimSuffix(str string, suffix rune) string { + return str[:len(str)-1] +} + +// An IMAP reader. +type Reader struct { + MaxLiteralSize uint32 // The maximum literal size. + + reader + + continues chan<- bool + + brackets int + inRespCode bool +} + +func (r *Reader) ReadSp() error { + char, _, err := r.ReadRune() + if err != nil { + return err + } + if char != sp { + return newParseError("expected a space") + } + return nil +} + +func (r *Reader) ReadCrlf() (err error) { + var char rune + + if char, _, err = r.ReadRune(); err != nil { + return + } + if char == lf { + return + } + if char != cr { + err = newParseError("line doesn't end with a CR") + return + } + + if char, _, err = r.ReadRune(); err != nil { + return + } + if char != lf { + err = newParseError("line doesn't end with a LF") + } + + return +} + +func (r *Reader) ReadAtom() (interface{}, error) { + r.brackets = 0 + + var atom string + for { + char, _, err := r.ReadRune() + if err != nil { + return nil, err + } + + // TODO: list-wildcards and \ + if r.brackets == 0 && (char == listStart || char == literalStart || char == dquote) { + return nil, newParseError("atom contains forbidden char: " + string(char)) + } + if char == cr || char == lf { + break + } + if r.brackets == 0 && (char == sp || char == listEnd) { + break + } + if char == respCodeEnd { + if r.brackets == 0 { + if r.inRespCode { + break + } else { + return nil, newParseError("atom contains bad brackets nesting") + } + } + r.brackets-- + } + if char == respCodeStart { + r.brackets++ + } + + atom += string(char) + } + + r.UnreadRune() + + if atom == nilAtom { + return nil, nil + } + + return atom, nil +} + +func (r *Reader) ReadLiteral() (Literal, error) { + char, _, err := r.ReadRune() + if err != nil { + return nil, err + } else if char != literalStart { + return nil, newParseError("literal string doesn't start with an open brace") + } + + lstr, err := r.ReadString(byte(literalEnd)) + if err != nil { + return nil, err + } + lstr = trimSuffix(lstr, literalEnd) + + nonSync := strings.HasSuffix(lstr, "+") + if nonSync { + lstr = trimSuffix(lstr, '+') + } + + n, err := strconv.ParseUint(lstr, 10, 32) + if err != nil { + return nil, newParseError("cannot parse literal length: " + err.Error()) + } + if r.MaxLiteralSize > 0 && uint32(n) > r.MaxLiteralSize { + return nil, newParseError("literal exceeding maximum size") + } + + if err := r.ReadCrlf(); err != nil { + return nil, err + } + + // Send continuation request if necessary + if r.continues != nil && !nonSync { + r.continues <- true + } + + // Read literal + b := make([]byte, n) + if _, err := io.ReadFull(r, b); err != nil { + return nil, err + } + return bytes.NewBuffer(b), nil +} + +func (r *Reader) ReadQuotedString() (string, error) { + if char, _, err := r.ReadRune(); err != nil { + return "", err + } else if char != dquote { + return "", newParseError("quoted string doesn't start with a double quote") + } + + var buf bytes.Buffer + var escaped bool + for { + char, _, err := r.ReadRune() + if err != nil { + return "", err + } + + if char == '\\' && !escaped { + escaped = true + } else { + if char == cr || char == lf { + r.UnreadRune() + return "", newParseError("CR or LF not allowed in quoted string") + } + if char == dquote && !escaped { + break + } + + if !strings.ContainsRune(quotedSpecials, char) && escaped { + return "", newParseError("quoted string cannot contain backslash followed by a non-quoted-specials char") + } + + buf.WriteRune(char) + escaped = false + } + } + + return buf.String(), nil +} + +func (r *Reader) ReadFields() (fields []interface{}, err error) { + var char rune + for { + if char, _, err = r.ReadRune(); err != nil { + return + } + if err = r.UnreadRune(); err != nil { + return + } + + var field interface{} + ok := true + switch char { + case literalStart: + field, err = r.ReadLiteral() + case dquote: + field, err = r.ReadQuotedString() + case listStart: + field, err = r.ReadList() + case listEnd: + ok = false + case cr: + return + default: + field, err = r.ReadAtom() + } + + if err != nil { + return + } + if ok { + fields = append(fields, field) + } + + if char, _, err = r.ReadRune(); err != nil { + return + } + if char == cr || char == lf || char == listEnd || char == respCodeEnd { + if char == cr || char == lf { + r.UnreadRune() + } + return + } + if char == listStart { + r.UnreadRune() + continue + } + if char != sp { + err = newParseError("fields are not separated by a space") + return + } + } +} + +func (r *Reader) ReadList() (fields []interface{}, err error) { + char, _, err := r.ReadRune() + if err != nil { + return + } + if char != listStart { + err = newParseError("list doesn't start with an open parenthesis") + return + } + + fields, err = r.ReadFields() + if err != nil { + return + } + + r.UnreadRune() + if char, _, err = r.ReadRune(); err != nil { + return + } + if char != listEnd { + err = newParseError("list doesn't end with a close parenthesis") + } + return +} + +func (r *Reader) ReadLine() (fields []interface{}, err error) { + fields, err = r.ReadFields() + if err != nil { + return + } + + r.UnreadRune() + err = r.ReadCrlf() + return +} + +func (r *Reader) ReadRespCode() (code StatusRespCode, fields []interface{}, err error) { + char, _, err := r.ReadRune() + if err != nil { + return + } + if char != respCodeStart { + err = newParseError("response code doesn't start with an open bracket") + return + } + + r.inRespCode = true + fields, err = r.ReadFields() + r.inRespCode = false + if err != nil { + return + } + + if len(fields) == 0 { + err = newParseError("response code doesn't contain any field") + return + } + + codeStr, ok := fields[0].(string) + if !ok { + err = newParseError("response code doesn't start with a string atom") + return + } + if codeStr == "" { + err = newParseError("response code is empty") + return + } + code = StatusRespCode(strings.ToUpper(codeStr)) + + fields = fields[1:] + + r.UnreadRune() + char, _, err = r.ReadRune() + if err != nil { + return + } + if char != respCodeEnd { + err = newParseError("response code doesn't end with a close bracket") + } + return +} + +func (r *Reader) ReadInfo() (info string, err error) { + info, err = r.ReadString(byte(lf)) + if err != nil { + return + } + info = strings.TrimSuffix(info, string(lf)) + info = strings.TrimSuffix(info, string(cr)) + info = strings.TrimLeft(info, " ") + + return +} + +func NewReader(r reader) *Reader { + return &Reader{reader: r} +} + +func NewServerReader(r reader, continues chan<- bool) *Reader { + return &Reader{reader: r, continues: continues} +} + +type Parser interface { + Parse(fields []interface{}) error +} diff --git a/vendor/github.com/emersion/go-imap/response.go b/vendor/github.com/emersion/go-imap/response.go new file mode 100644 index 00000000..611d03e6 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/response.go @@ -0,0 +1,181 @@ +package imap + +import ( + "strings" +) + +// Resp is an IMAP response. It is either a *DataResp, a +// *ContinuationReq or a *StatusResp. +type Resp interface { + resp() +} + +// ReadResp reads a single response from a Reader. +func ReadResp(r *Reader) (Resp, error) { + atom, err := r.ReadAtom() + if err != nil { + return nil, err + } + tag, ok := atom.(string) + if !ok { + return nil, newParseError("response tag is not an atom") + } + + if tag == "+" { + if err := r.ReadSp(); err != nil { + r.UnreadRune() + } + + resp := &ContinuationReq{} + resp.Info, err = r.ReadInfo() + if err != nil { + return nil, err + } + + return resp, nil + } + + if err := r.ReadSp(); err != nil { + return nil, err + } + + // Can be either data or status + // Try to parse a status + var fields []interface{} + if atom, err := r.ReadAtom(); err == nil { + fields = append(fields, atom) + + if err := r.ReadSp(); err == nil { + if name, ok := atom.(string); ok { + status := StatusRespType(name) + switch status { + case StatusRespOk, StatusRespNo, StatusRespBad, StatusRespPreauth, StatusRespBye: + resp := &StatusResp{ + Tag: tag, + Type: status, + } + + char, _, err := r.ReadRune() + if err != nil { + return nil, err + } + r.UnreadRune() + + if char == '[' { + // Contains code & arguments + resp.Code, resp.Arguments, err = r.ReadRespCode() + if err != nil { + return nil, err + } + } + + resp.Info, err = r.ReadInfo() + if err != nil { + return nil, err + } + + return resp, nil + } + } + } else { + r.UnreadRune() + } + } else { + r.UnreadRune() + } + + // Not a status so it's data + resp := &DataResp{Tag: tag} + + var remaining []interface{} + remaining, err = r.ReadLine() + if err != nil { + return nil, err + } + + resp.Fields = append(fields, remaining...) + return resp, nil +} + +// DataResp is an IMAP response containing data. +type DataResp struct { + // The response tag. Can be either "" for untagged responses, "+" for continuation + // requests or a previous command's tag. + Tag string + // The parsed response fields. + Fields []interface{} +} + +// NewUntaggedResp creates a new untagged response. +func NewUntaggedResp(fields []interface{}) *DataResp { + return &DataResp{ + Tag: "*", + Fields: fields, + } +} + +func (r *DataResp) resp() {} + +func (r *DataResp) WriteTo(w *Writer) error { + tag := RawString(r.Tag) + if tag == "" { + tag = RawString("*") + } + + fields := []interface{}{RawString(tag)} + fields = append(fields, r.Fields...) + return w.writeLine(fields...) +} + +// ContinuationReq is a continuation request response. +type ContinuationReq struct { + // The info message sent with the continuation request. + Info string +} + +func (r *ContinuationReq) resp() {} + +func (r *ContinuationReq) WriteTo(w *Writer) error { + if err := w.writeString("+"); err != nil { + return err + } + + if r.Info != "" { + if err := w.writeString(string(sp) + r.Info); err != nil { + return err + } + } + + return w.writeCrlf() +} + +// ParseNamedResp attempts to parse a named data response. +func ParseNamedResp(resp Resp) (name string, fields []interface{}, ok bool) { + data, ok := resp.(*DataResp) + if !ok || len(data.Fields) == 0 { + return + } + + // Some responses (namely EXISTS and RECENT) are formatted like so: + // [num] [name] [...] + // Which is fucking stupid. But we handle that here by checking if the + // response name is a number and then rearranging it. + if len(data.Fields) > 1 { + name, ok := data.Fields[1].(string) + if ok { + if _, err := ParseNumber(data.Fields[0]); err == nil { + fields := []interface{}{data.Fields[0]} + fields = append(fields, data.Fields[2:]...) + return strings.ToUpper(name), fields, true + } + } + } + + // IMAP commands are formatted like this: + // [name] [...] + name, ok = data.Fields[0].(string) + if !ok { + return + } + return strings.ToUpper(name), data.Fields[1:], true +} diff --git a/vendor/github.com/emersion/go-imap/responses/authenticate.go b/vendor/github.com/emersion/go-imap/responses/authenticate.go new file mode 100644 index 00000000..8e134cb7 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/authenticate.go @@ -0,0 +1,61 @@ +package responses + +import ( + "encoding/base64" + + "github.com/emersion/go-imap" + "github.com/emersion/go-sasl" +) + +// An AUTHENTICATE response. +type Authenticate struct { + Mechanism sasl.Client + InitialResponse []byte + RepliesCh chan []byte +} + +// Implements +func (r *Authenticate) Replies() <-chan []byte { + return r.RepliesCh +} + +func (r *Authenticate) writeLine(l string) error { + r.RepliesCh <- []byte(l + "\r\n") + return nil +} + +func (r *Authenticate) cancel() error { + return r.writeLine("*") +} + +func (r *Authenticate) Handle(resp imap.Resp) error { + cont, ok := resp.(*imap.ContinuationReq) + if !ok { + return ErrUnhandled + } + + // Empty challenge, send initial response as stated in RFC 2222 section 5.1 + if cont.Info == "" && r.InitialResponse != nil { + encoded := base64.StdEncoding.EncodeToString(r.InitialResponse) + if err := r.writeLine(encoded); err != nil { + return err + } + r.InitialResponse = nil + return nil + } + + challenge, err := base64.StdEncoding.DecodeString(cont.Info) + if err != nil { + r.cancel() + return err + } + + reply, err := r.Mechanism.Next(challenge) + if err != nil { + r.cancel() + return err + } + + encoded := base64.StdEncoding.EncodeToString(reply) + return r.writeLine(encoded) +} diff --git a/vendor/github.com/emersion/go-imap/responses/capability.go b/vendor/github.com/emersion/go-imap/responses/capability.go new file mode 100644 index 00000000..483cb2e3 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/capability.go @@ -0,0 +1,20 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +// A CAPABILITY response. +// See RFC 3501 section 7.2.1 +type Capability struct { + Caps []string +} + +func (r *Capability) WriteTo(w *imap.Writer) error { + fields := []interface{}{imap.RawString("CAPABILITY")} + for _, cap := range r.Caps { + fields = append(fields, imap.RawString(cap)) + } + + return imap.NewUntaggedResp(fields).WriteTo(w) +} diff --git a/vendor/github.com/emersion/go-imap/responses/enabled.go b/vendor/github.com/emersion/go-imap/responses/enabled.go new file mode 100644 index 00000000..fc4e27bd --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/enabled.go @@ -0,0 +1,33 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +// An ENABLED response, defined in RFC 5161 section 3.2. +type Enabled struct { + Caps []string +} + +func (r *Enabled) Handle(resp imap.Resp) error { + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != "ENABLED" { + return ErrUnhandled + } + + if caps, err := imap.ParseStringList(fields); err != nil { + return err + } else { + r.Caps = append(r.Caps, caps...) + } + + return nil +} + +func (r *Enabled) WriteTo(w *imap.Writer) error { + fields := []interface{}{imap.RawString("ENABLED")} + for _, cap := range r.Caps { + fields = append(fields, imap.RawString(cap)) + } + return imap.NewUntaggedResp(fields).WriteTo(w) +} diff --git a/vendor/github.com/emersion/go-imap/responses/expunge.go b/vendor/github.com/emersion/go-imap/responses/expunge.go new file mode 100644 index 00000000..bce3bf1a --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/expunge.go @@ -0,0 +1,43 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +const expungeName = "EXPUNGE" + +// An EXPUNGE response. +// See RFC 3501 section 7.4.1 +type Expunge struct { + SeqNums chan uint32 +} + +func (r *Expunge) Handle(resp imap.Resp) error { + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != expungeName { + return ErrUnhandled + } + + if len(fields) == 0 { + return errNotEnoughFields + } + + seqNum, err := imap.ParseNumber(fields[0]) + if err != nil { + return err + } + + r.SeqNums <- seqNum + return nil +} + +func (r *Expunge) WriteTo(w *imap.Writer) error { + for seqNum := range r.SeqNums { + resp := imap.NewUntaggedResp([]interface{}{seqNum, imap.RawString(expungeName)}) + if err := resp.WriteTo(w); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/responses/fetch.go b/vendor/github.com/emersion/go-imap/responses/fetch.go new file mode 100644 index 00000000..691ebcb3 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/fetch.go @@ -0,0 +1,70 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +const fetchName = "FETCH" + +// A FETCH response. +// See RFC 3501 section 7.4.2 +type Fetch struct { + Messages chan *imap.Message + SeqSet *imap.SeqSet + Uid bool +} + +func (r *Fetch) Handle(resp imap.Resp) error { + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != fetchName { + return ErrUnhandled + } else if len(fields) < 1 { + return errNotEnoughFields + } + + seqNum, err := imap.ParseNumber(fields[0]) + if err != nil { + return err + } + + msgFields, _ := fields[1].([]interface{}) + msg := &imap.Message{SeqNum: seqNum} + if err := msg.Parse(msgFields); err != nil { + return err + } + + if r.Uid && msg.Uid == 0 { + // we requested UIDs and got a message without one --> unilateral update --> ignore + return ErrUnhandled + } + + var num uint32 + if r.Uid { + num = msg.Uid + } else { + num = seqNum + } + + // Check whether we obtained a result we requested with our SeqSet + // If the result is not contained in our SeqSet we have to handle an additional special case: + // In case we requested UIDs with a dynamic sequence (i.e. * or n:*) and the maximum UID of the mailbox + // is less then our n, the server will supply us with the max UID (cf. RFC 3501 §6.4.8 and §9 `seq-range`). + // Thus, such a result is correct and has to be returned by us. + if !r.SeqSet.Contains(num) && (!r.Uid || !r.SeqSet.Dynamic()) { + return ErrUnhandled + } + + r.Messages <- msg + return nil +} + +func (r *Fetch) WriteTo(w *imap.Writer) error { + var err error + for msg := range r.Messages { + resp := imap.NewUntaggedResp([]interface{}{msg.SeqNum, imap.RawString(fetchName), msg.Format()}) + if err == nil { + err = resp.WriteTo(w) + } + } + return err +} diff --git a/vendor/github.com/emersion/go-imap/responses/idle.go b/vendor/github.com/emersion/go-imap/responses/idle.go new file mode 100644 index 00000000..b5efcacd --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/idle.go @@ -0,0 +1,38 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +// An IDLE response. +type Idle struct { + RepliesCh chan []byte + Stop <-chan struct{} + + gotContinuationReq bool +} + +func (r *Idle) Replies() <-chan []byte { + return r.RepliesCh +} + +func (r *Idle) stop() { + r.RepliesCh <- []byte("DONE\r\n") +} + +func (r *Idle) Handle(resp imap.Resp) error { + // Wait for a continuation request + if _, ok := resp.(*imap.ContinuationReq); ok && !r.gotContinuationReq { + r.gotContinuationReq = true + + // We got a continuation request, wait for r.Stop to be closed + go func() { + <-r.Stop + r.stop() + }() + + return nil + } + + return ErrUnhandled +} diff --git a/vendor/github.com/emersion/go-imap/responses/list.go b/vendor/github.com/emersion/go-imap/responses/list.go new file mode 100644 index 00000000..e080fc16 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/list.go @@ -0,0 +1,57 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +const ( + listName = "LIST" + lsubName = "LSUB" +) + +// A LIST response. +// If Subscribed is set to true, LSUB will be used instead. +// See RFC 3501 section 7.2.2 +type List struct { + Mailboxes chan *imap.MailboxInfo + Subscribed bool +} + +func (r *List) Name() string { + if r.Subscribed { + return lsubName + } else { + return listName + } +} + +func (r *List) Handle(resp imap.Resp) error { + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != r.Name() { + return ErrUnhandled + } + + mbox := &imap.MailboxInfo{} + if err := mbox.Parse(fields); err != nil { + return err + } + + r.Mailboxes <- mbox + return nil +} + +func (r *List) WriteTo(w *imap.Writer) error { + respName := r.Name() + + for mbox := range r.Mailboxes { + fields := []interface{}{imap.RawString(respName)} + fields = append(fields, mbox.Format()...) + + resp := imap.NewUntaggedResp(fields) + if err := resp.WriteTo(w); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/responses/responses.go b/vendor/github.com/emersion/go-imap/responses/responses.go new file mode 100644 index 00000000..4d035eed --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/responses.go @@ -0,0 +1,35 @@ +// IMAP responses defined in RFC 3501. +package responses + +import ( + "errors" + + "github.com/emersion/go-imap" +) + +// ErrUnhandled is used when a response hasn't been handled. +var ErrUnhandled = errors.New("imap: unhandled response") + +var errNotEnoughFields = errors.New("imap: not enough fields in response") + +// Handler handles responses. +type Handler interface { + // Handle processes a response. If the response cannot be processed, + // ErrUnhandledResp must be returned. + Handle(resp imap.Resp) error +} + +// HandlerFunc is a function that handles responses. +type HandlerFunc func(resp imap.Resp) error + +// Handle implements Handler. +func (f HandlerFunc) Handle(resp imap.Resp) error { + return f(resp) +} + +// Replier is a Handler that needs to send raw data (for instance +// AUTHENTICATE). +type Replier interface { + Handler + Replies() <-chan []byte +} diff --git a/vendor/github.com/emersion/go-imap/responses/search.go b/vendor/github.com/emersion/go-imap/responses/search.go new file mode 100644 index 00000000..028dbc72 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/search.go @@ -0,0 +1,41 @@ +package responses + +import ( + "github.com/emersion/go-imap" +) + +const searchName = "SEARCH" + +// A SEARCH response. +// See RFC 3501 section 7.2.5 +type Search struct { + Ids []uint32 +} + +func (r *Search) Handle(resp imap.Resp) error { + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != searchName { + return ErrUnhandled + } + + r.Ids = make([]uint32, len(fields)) + for i, f := range fields { + if id, err := imap.ParseNumber(f); err != nil { + return err + } else { + r.Ids[i] = id + } + } + + return nil +} + +func (r *Search) WriteTo(w *imap.Writer) (err error) { + fields := []interface{}{imap.RawString(searchName)} + for _, id := range r.Ids { + fields = append(fields, id) + } + + resp := imap.NewUntaggedResp(fields) + return resp.WriteTo(w) +} diff --git a/vendor/github.com/emersion/go-imap/responses/select.go b/vendor/github.com/emersion/go-imap/responses/select.go new file mode 100644 index 00000000..e450963b --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/select.go @@ -0,0 +1,142 @@ +package responses + +import ( + "fmt" + + "github.com/emersion/go-imap" +) + +// A SELECT response. +type Select struct { + Mailbox *imap.MailboxStatus +} + +func (r *Select) Handle(resp imap.Resp) error { + if r.Mailbox == nil { + r.Mailbox = &imap.MailboxStatus{Items: make(map[imap.StatusItem]interface{})} + } + mbox := r.Mailbox + + switch resp := resp.(type) { + case *imap.DataResp: + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != "FLAGS" { + return ErrUnhandled + } else if len(fields) < 1 { + return errNotEnoughFields + } + + flags, _ := fields[0].([]interface{}) + mbox.Flags, _ = imap.ParseStringList(flags) + case *imap.StatusResp: + if len(resp.Arguments) < 1 { + return ErrUnhandled + } + + var item imap.StatusItem + switch resp.Code { + case "UNSEEN": + mbox.UnseenSeqNum, _ = imap.ParseNumber(resp.Arguments[0]) + case "PERMANENTFLAGS": + flags, _ := resp.Arguments[0].([]interface{}) + mbox.PermanentFlags, _ = imap.ParseStringList(flags) + case "UIDNEXT": + mbox.UidNext, _ = imap.ParseNumber(resp.Arguments[0]) + item = imap.StatusUidNext + case "UIDVALIDITY": + mbox.UidValidity, _ = imap.ParseNumber(resp.Arguments[0]) + item = imap.StatusUidValidity + default: + return ErrUnhandled + } + + if item != "" { + mbox.ItemsLocker.Lock() + mbox.Items[item] = nil + mbox.ItemsLocker.Unlock() + } + default: + return ErrUnhandled + } + return nil +} + +func (r *Select) WriteTo(w *imap.Writer) error { + mbox := r.Mailbox + + if mbox.Flags != nil { + flags := make([]interface{}, len(mbox.Flags)) + for i, f := range mbox.Flags { + flags[i] = imap.RawString(f) + } + res := imap.NewUntaggedResp([]interface{}{imap.RawString("FLAGS"), flags}) + if err := res.WriteTo(w); err != nil { + return err + } + } + + if mbox.PermanentFlags != nil { + flags := make([]interface{}, len(mbox.PermanentFlags)) + for i, f := range mbox.PermanentFlags { + flags[i] = imap.RawString(f) + } + statusRes := &imap.StatusResp{ + Type: imap.StatusRespOk, + Code: imap.CodePermanentFlags, + Arguments: []interface{}{flags}, + Info: "Flags permitted.", + } + if err := statusRes.WriteTo(w); err != nil { + return err + } + } + + if mbox.UnseenSeqNum > 0 { + statusRes := &imap.StatusResp{ + Type: imap.StatusRespOk, + Code: imap.CodeUnseen, + Arguments: []interface{}{mbox.UnseenSeqNum}, + Info: fmt.Sprintf("Message %d is first unseen", mbox.UnseenSeqNum), + } + if err := statusRes.WriteTo(w); err != nil { + return err + } + } + + for k := range r.Mailbox.Items { + switch k { + case imap.StatusMessages: + res := imap.NewUntaggedResp([]interface{}{mbox.Messages, imap.RawString("EXISTS")}) + if err := res.WriteTo(w); err != nil { + return err + } + case imap.StatusRecent: + res := imap.NewUntaggedResp([]interface{}{mbox.Recent, imap.RawString("RECENT")}) + if err := res.WriteTo(w); err != nil { + return err + } + case imap.StatusUidNext: + statusRes := &imap.StatusResp{ + Type: imap.StatusRespOk, + Code: imap.CodeUidNext, + Arguments: []interface{}{mbox.UidNext}, + Info: "Predicted next UID", + } + if err := statusRes.WriteTo(w); err != nil { + return err + } + case imap.StatusUidValidity: + statusRes := &imap.StatusResp{ + Type: imap.StatusRespOk, + Code: imap.CodeUidValidity, + Arguments: []interface{}{mbox.UidValidity}, + Info: "UIDs valid", + } + if err := statusRes.WriteTo(w); err != nil { + return err + } + } + } + + return nil +} diff --git a/vendor/github.com/emersion/go-imap/responses/status.go b/vendor/github.com/emersion/go-imap/responses/status.go new file mode 100644 index 00000000..6a8570c9 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/responses/status.go @@ -0,0 +1,53 @@ +package responses + +import ( + "errors" + + "github.com/emersion/go-imap" + "github.com/emersion/go-imap/utf7" +) + +const statusName = "STATUS" + +// A STATUS response. +// See RFC 3501 section 7.2.4 +type Status struct { + Mailbox *imap.MailboxStatus +} + +func (r *Status) Handle(resp imap.Resp) error { + if r.Mailbox == nil { + r.Mailbox = &imap.MailboxStatus{} + } + mbox := r.Mailbox + + name, fields, ok := imap.ParseNamedResp(resp) + if !ok || name != statusName { + return ErrUnhandled + } else if len(fields) < 2 { + return errNotEnoughFields + } + + if name, err := imap.ParseString(fields[0]); err != nil { + return err + } else if name, err := utf7.Encoding.NewDecoder().String(name); err != nil { + return err + } else { + mbox.Name = imap.CanonicalMailboxName(name) + } + + var items []interface{} + if items, ok = fields[1].([]interface{}); !ok { + return errors.New("STATUS response expects a list as second argument") + } + + mbox.Items = nil + return mbox.Parse(items) +} + +func (r *Status) WriteTo(w *imap.Writer) error { + mbox := r.Mailbox + name, _ := utf7.Encoding.NewEncoder().String(mbox.Name) + fields := []interface{}{imap.RawString(statusName), imap.FormatMailboxName(name), mbox.Format()} + return imap.NewUntaggedResp(fields).WriteTo(w) +} diff --git a/vendor/github.com/emersion/go-imap/search.go b/vendor/github.com/emersion/go-imap/search.go new file mode 100644 index 00000000..0ecb24d2 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/search.go @@ -0,0 +1,371 @@ +package imap + +import ( + "errors" + "fmt" + "io" + "net/textproto" + "strings" + "time" +) + +func maybeString(mystery interface{}) string { + if s, ok := mystery.(string); ok { + return s + } + return "" +} + +func convertField(f interface{}, charsetReader func(io.Reader) io.Reader) string { + // An IMAP string contains only 7-bit data, no need to decode it + if s, ok := f.(string); ok { + return s + } + + // If no charset is provided, getting directly the string is faster + if charsetReader == nil { + if stringer, ok := f.(fmt.Stringer); ok { + return stringer.String() + } + } + + // Not a string, it must be a literal + l, ok := f.(Literal) + if !ok { + return "" + } + + var r io.Reader = l + if charsetReader != nil { + if dec := charsetReader(r); dec != nil { + r = dec + } + } + + b := make([]byte, l.Len()) + if _, err := io.ReadFull(r, b); err != nil { + return "" + } + return string(b) +} + +func popSearchField(fields []interface{}) (interface{}, []interface{}, error) { + if len(fields) == 0 { + return nil, nil, errors.New("imap: no enough fields for search key") + } + return fields[0], fields[1:], nil +} + +// SearchCriteria is a search criteria. A message matches the criteria if and +// only if it matches each one of its fields. +type SearchCriteria struct { + SeqNum *SeqSet // Sequence number is in sequence set + Uid *SeqSet // UID is in sequence set + + // Time and timezone are ignored + Since time.Time // Internal date is since this date + Before time.Time // Internal date is before this date + SentSince time.Time // Date header field is since this date + SentBefore time.Time // Date header field is before this date + + Header textproto.MIMEHeader // Each header field value is present + Body []string // Each string is in the body + Text []string // Each string is in the text (header + body) + + WithFlags []string // Each flag is present + WithoutFlags []string // Each flag is not present + + Larger uint32 // Size is larger than this number + Smaller uint32 // Size is smaller than this number + + Not []*SearchCriteria // Each criteria doesn't match + Or [][2]*SearchCriteria // Each criteria pair has at least one match of two +} + +// NewSearchCriteria creates a new search criteria. +func NewSearchCriteria() *SearchCriteria { + return &SearchCriteria{Header: make(textproto.MIMEHeader)} +} + +func (c *SearchCriteria) parseField(fields []interface{}, charsetReader func(io.Reader) io.Reader) ([]interface{}, error) { + if len(fields) == 0 { + return nil, nil + } + + f := fields[0] + fields = fields[1:] + + if subfields, ok := f.([]interface{}); ok { + return fields, c.ParseWithCharset(subfields, charsetReader) + } + + key, ok := f.(string) + if !ok { + return nil, fmt.Errorf("imap: invalid search criteria field type: %T", f) + } + key = strings.ToUpper(key) + + var err error + switch key { + case "ALL": + // Nothing to do + case "ANSWERED", "DELETED", "DRAFT", "FLAGGED", "RECENT", "SEEN": + c.WithFlags = append(c.WithFlags, CanonicalFlag("\\"+key)) + case "BCC", "CC", "FROM", "SUBJECT", "TO": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } + if c.Header == nil { + c.Header = make(textproto.MIMEHeader) + } + c.Header.Add(key, convertField(f, charsetReader)) + case "BEFORE": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if t, err := time.Parse(DateLayout, maybeString(f)); err != nil { + return nil, err + } else if c.Before.IsZero() || t.Before(c.Before) { + c.Before = t + } + case "BODY": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else { + c.Body = append(c.Body, convertField(f, charsetReader)) + } + case "HEADER": + var f1, f2 interface{} + if f1, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if f2, fields, err = popSearchField(fields); err != nil { + return nil, err + } else { + if c.Header == nil { + c.Header = make(textproto.MIMEHeader) + } + c.Header.Add(maybeString(f1), convertField(f2, charsetReader)) + } + case "KEYWORD": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else { + c.WithFlags = append(c.WithFlags, CanonicalFlag(maybeString(f))) + } + case "LARGER": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if n, err := ParseNumber(f); err != nil { + return nil, err + } else if c.Larger == 0 || n > c.Larger { + c.Larger = n + } + case "NEW": + c.WithFlags = append(c.WithFlags, RecentFlag) + c.WithoutFlags = append(c.WithoutFlags, SeenFlag) + case "NOT": + not := new(SearchCriteria) + if fields, err = not.parseField(fields, charsetReader); err != nil { + return nil, err + } + c.Not = append(c.Not, not) + case "OLD": + c.WithoutFlags = append(c.WithoutFlags, RecentFlag) + case "ON": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if t, err := time.Parse(DateLayout, maybeString(f)); err != nil { + return nil, err + } else { + c.Since = t + c.Before = t.Add(24 * time.Hour) + } + case "OR": + c1, c2 := new(SearchCriteria), new(SearchCriteria) + if fields, err = c1.parseField(fields, charsetReader); err != nil { + return nil, err + } else if fields, err = c2.parseField(fields, charsetReader); err != nil { + return nil, err + } + c.Or = append(c.Or, [2]*SearchCriteria{c1, c2}) + case "SENTBEFORE": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if t, err := time.Parse(DateLayout, maybeString(f)); err != nil { + return nil, err + } else if c.SentBefore.IsZero() || t.Before(c.SentBefore) { + c.SentBefore = t + } + case "SENTON": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if t, err := time.Parse(DateLayout, maybeString(f)); err != nil { + return nil, err + } else { + c.SentSince = t + c.SentBefore = t.Add(24 * time.Hour) + } + case "SENTSINCE": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if t, err := time.Parse(DateLayout, maybeString(f)); err != nil { + return nil, err + } else if c.SentSince.IsZero() || t.After(c.SentSince) { + c.SentSince = t + } + case "SINCE": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if t, err := time.Parse(DateLayout, maybeString(f)); err != nil { + return nil, err + } else if c.Since.IsZero() || t.After(c.Since) { + c.Since = t + } + case "SMALLER": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if n, err := ParseNumber(f); err != nil { + return nil, err + } else if c.Smaller == 0 || n < c.Smaller { + c.Smaller = n + } + case "TEXT": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else { + c.Text = append(c.Text, convertField(f, charsetReader)) + } + case "UID": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else if c.Uid, err = ParseSeqSet(maybeString(f)); err != nil { + return nil, err + } + case "UNANSWERED", "UNDELETED", "UNDRAFT", "UNFLAGGED", "UNSEEN": + unflag := strings.TrimPrefix(key, "UN") + c.WithoutFlags = append(c.WithoutFlags, CanonicalFlag("\\"+unflag)) + case "UNKEYWORD": + if f, fields, err = popSearchField(fields); err != nil { + return nil, err + } else { + c.WithoutFlags = append(c.WithoutFlags, CanonicalFlag(maybeString(f))) + } + default: // Try to parse a sequence set + if c.SeqNum, err = ParseSeqSet(key); err != nil { + return nil, err + } + } + + return fields, nil +} + +// ParseWithCharset parses a search criteria from the provided fields. +// charsetReader is an optional function that converts from the fields charset +// to UTF-8. +func (c *SearchCriteria) ParseWithCharset(fields []interface{}, charsetReader func(io.Reader) io.Reader) error { + for len(fields) > 0 { + var err error + if fields, err = c.parseField(fields, charsetReader); err != nil { + return err + } + } + return nil +} + +// Format formats search criteria to fields. UTF-8 is used. +func (c *SearchCriteria) Format() []interface{} { + var fields []interface{} + + if c.SeqNum != nil { + fields = append(fields, c.SeqNum) + } + if c.Uid != nil { + fields = append(fields, RawString("UID"), c.Uid) + } + + if !c.Since.IsZero() && !c.Before.IsZero() && c.Before.Sub(c.Since) == 24*time.Hour { + fields = append(fields, RawString("ON"), searchDate(c.Since)) + } else { + if !c.Since.IsZero() { + fields = append(fields, RawString("SINCE"), searchDate(c.Since)) + } + if !c.Before.IsZero() { + fields = append(fields, RawString("BEFORE"), searchDate(c.Before)) + } + } + if !c.SentSince.IsZero() && !c.SentBefore.IsZero() && c.SentBefore.Sub(c.SentSince) == 24*time.Hour { + fields = append(fields, RawString("SENTON"), searchDate(c.SentSince)) + } else { + if !c.SentSince.IsZero() { + fields = append(fields, RawString("SENTSINCE"), searchDate(c.SentSince)) + } + if !c.SentBefore.IsZero() { + fields = append(fields, RawString("SENTBEFORE"), searchDate(c.SentBefore)) + } + } + + for key, values := range c.Header { + var prefields []interface{} + switch key { + case "Bcc", "Cc", "From", "Subject", "To": + prefields = []interface{}{RawString(strings.ToUpper(key))} + default: + prefields = []interface{}{RawString("HEADER"), key} + } + for _, value := range values { + fields = append(fields, prefields...) + fields = append(fields, value) + } + } + + for _, value := range c.Body { + fields = append(fields, RawString("BODY"), value) + } + for _, value := range c.Text { + fields = append(fields, RawString("TEXT"), value) + } + + for _, flag := range c.WithFlags { + var subfields []interface{} + switch flag { + case AnsweredFlag, DeletedFlag, DraftFlag, FlaggedFlag, RecentFlag, SeenFlag: + subfields = []interface{}{RawString(strings.ToUpper(strings.TrimPrefix(flag, "\\")))} + default: + subfields = []interface{}{RawString("KEYWORD"), RawString(flag)} + } + fields = append(fields, subfields...) + } + for _, flag := range c.WithoutFlags { + var subfields []interface{} + switch flag { + case AnsweredFlag, DeletedFlag, DraftFlag, FlaggedFlag, SeenFlag: + subfields = []interface{}{RawString("UN" + strings.ToUpper(strings.TrimPrefix(flag, "\\")))} + case RecentFlag: + subfields = []interface{}{RawString("OLD")} + default: + subfields = []interface{}{RawString("UNKEYWORD"), RawString(flag)} + } + fields = append(fields, subfields...) + } + + if c.Larger > 0 { + fields = append(fields, RawString("LARGER"), c.Larger) + } + if c.Smaller > 0 { + fields = append(fields, RawString("SMALLER"), c.Smaller) + } + + for _, not := range c.Not { + fields = append(fields, RawString("NOT"), not.Format()) + } + + for _, or := range c.Or { + fields = append(fields, RawString("OR"), or[0].Format(), or[1].Format()) + } + + // Not a single criteria given, add ALL criteria as fallback + if len(fields) == 0 { + fields = append(fields, RawString("ALL")) + } + + return fields +} diff --git a/vendor/github.com/emersion/go-imap/seqset.go b/vendor/github.com/emersion/go-imap/seqset.go new file mode 100644 index 00000000..abe6afc1 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/seqset.go @@ -0,0 +1,289 @@ +package imap + +import ( + "fmt" + "strconv" + "strings" +) + +// ErrBadSeqSet is used to report problems with the format of a sequence set +// value. +type ErrBadSeqSet string + +func (err ErrBadSeqSet) Error() string { + return fmt.Sprintf("imap: bad sequence set value %q", string(err)) +} + +// Seq represents a single seq-number or seq-range value (RFC 3501 ABNF). Values +// may be static (e.g. "1", "2:4") or dynamic (e.g. "*", "1:*"). A seq-number is +// represented by setting Start = Stop. Zero is used to represent "*", which is +// safe because seq-number uses nz-number rule. The order of values is always +// Start <= Stop, except when representing "n:*", where Start = n and Stop = 0. +type Seq struct { + Start, Stop uint32 +} + +// parseSeqNumber parses a single seq-number value (non-zero uint32 or "*"). +func parseSeqNumber(v string) (uint32, error) { + if n, err := strconv.ParseUint(v, 10, 32); err == nil && v[0] != '0' { + return uint32(n), nil + } else if v == "*" { + return 0, nil + } + return 0, ErrBadSeqSet(v) +} + +// parseSeq creates a new seq instance by parsing strings in the format "n" or +// "n:m", where n and/or m may be "*". An error is returned for invalid values. +func parseSeq(v string) (s Seq, err error) { + if sep := strings.IndexRune(v, ':'); sep < 0 { + s.Start, err = parseSeqNumber(v) + s.Stop = s.Start + return + } else if s.Start, err = parseSeqNumber(v[:sep]); err == nil { + if s.Stop, err = parseSeqNumber(v[sep+1:]); err == nil { + if (s.Stop < s.Start && s.Stop != 0) || s.Start == 0 { + s.Start, s.Stop = s.Stop, s.Start + } + return + } + } + return s, ErrBadSeqSet(v) +} + +// Contains returns true if the seq-number q is contained in sequence value s. +// The dynamic value "*" contains only other "*" values, the dynamic range "n:*" +// contains "*" and all numbers >= n. +func (s Seq) Contains(q uint32) bool { + if q == 0 { + return s.Stop == 0 // "*" is contained only in "*" and "n:*" + } + return s.Start != 0 && s.Start <= q && (q <= s.Stop || s.Stop == 0) +} + +// Less returns true if s precedes and does not contain seq-number q. +func (s Seq) Less(q uint32) bool { + return (s.Stop < q || q == 0) && s.Stop != 0 +} + +// Merge combines sequence values s and t into a single union if the two +// intersect or one is a superset of the other. The order of s and t does not +// matter. If the values cannot be merged, s is returned unmodified and ok is +// set to false. +func (s Seq) Merge(t Seq) (union Seq, ok bool) { + if union = s; s == t { + ok = true + return + } + if s.Start != 0 && t.Start != 0 { + // s and t are any combination of "n", "n:m", or "n:*" + if s.Start > t.Start { + s, t = t, s + } + // s starts at or before t, check where it ends + if (s.Stop >= t.Stop && t.Stop != 0) || s.Stop == 0 { + return s, true // s is a superset of t + } + // s is "n" or "n:m", if m == ^uint32(0) then t is "n:*" + if s.Stop+1 >= t.Start || s.Stop == ^uint32(0) { + return Seq{s.Start, t.Stop}, true // s intersects or touches t + } + return + } + // exactly one of s and t is "*" + if s.Start == 0 { + if t.Stop == 0 { + return t, true // s is "*", t is "n:*" + } + } else if s.Stop == 0 { + return s, true // s is "n:*", t is "*" + } + return +} + +// String returns sequence value s as a seq-number or seq-range string. +func (s Seq) String() string { + if s.Start == s.Stop { + if s.Start == 0 { + return "*" + } + return strconv.FormatUint(uint64(s.Start), 10) + } + b := strconv.AppendUint(make([]byte, 0, 24), uint64(s.Start), 10) + if s.Stop == 0 { + return string(append(b, ':', '*')) + } + return string(strconv.AppendUint(append(b, ':'), uint64(s.Stop), 10)) +} + +// SeqSet is used to represent a set of message sequence numbers or UIDs (see +// sequence-set ABNF rule). The zero value is an empty set. +type SeqSet struct { + Set []Seq +} + +// ParseSeqSet returns a new SeqSet instance after parsing the set string. +func ParseSeqSet(set string) (s *SeqSet, err error) { + s = new(SeqSet) + return s, s.Add(set) +} + +// Add inserts new sequence values into the set. The string format is described +// by RFC 3501 sequence-set ABNF rule. If an error is encountered, all values +// inserted successfully prior to the error remain in the set. +func (s *SeqSet) Add(set string) error { + for _, sv := range strings.Split(set, ",") { + v, err := parseSeq(sv) + if err != nil { + return err + } + s.insert(v) + } + return nil +} + +// AddNum inserts new sequence numbers into the set. The value 0 represents "*". +func (s *SeqSet) AddNum(q ...uint32) { + for _, v := range q { + s.insert(Seq{v, v}) + } +} + +// AddRange inserts a new sequence range into the set. +func (s *SeqSet) AddRange(Start, Stop uint32) { + if (Stop < Start && Stop != 0) || Start == 0 { + s.insert(Seq{Stop, Start}) + } else { + s.insert(Seq{Start, Stop}) + } +} + +// AddSet inserts all values from t into s. +func (s *SeqSet) AddSet(t *SeqSet) { + for _, v := range t.Set { + s.insert(v) + } +} + +// Clear removes all values from the set. +func (s *SeqSet) Clear() { + s.Set = s.Set[:0] +} + +// Empty returns true if the sequence set does not contain any values. +func (s SeqSet) Empty() bool { + return len(s.Set) == 0 +} + +// Dynamic returns true if the set contains "*" or "n:*" values. +func (s SeqSet) Dynamic() bool { + return len(s.Set) > 0 && s.Set[len(s.Set)-1].Stop == 0 +} + +// Contains returns true if the non-zero sequence number or UID q is contained +// in the set. The dynamic range "n:*" contains all q >= n. It is the caller's +// responsibility to handle the special case where q is the maximum UID in the +// mailbox and q < n (i.e. the set cannot match UIDs against "*:n" or "*" since +// it doesn't know what the maximum value is). +func (s SeqSet) Contains(q uint32) bool { + if _, ok := s.search(q); ok { + return q != 0 + } + return false +} + +// String returns a sorted representation of all contained sequence values. +func (s SeqSet) String() string { + if len(s.Set) == 0 { + return "" + } + b := make([]byte, 0, 64) + for _, v := range s.Set { + b = append(b, ',') + if v.Start == 0 { + b = append(b, '*') + continue + } + b = strconv.AppendUint(b, uint64(v.Start), 10) + if v.Start != v.Stop { + if v.Stop == 0 { + b = append(b, ':', '*') + continue + } + b = strconv.AppendUint(append(b, ':'), uint64(v.Stop), 10) + } + } + return string(b[1:]) +} + +// insert adds sequence value v to the set. +func (s *SeqSet) insert(v Seq) { + i, _ := s.search(v.Start) + merged := false + if i > 0 { + // try merging with the preceding entry (e.g. "1,4".insert(2), i == 1) + s.Set[i-1], merged = s.Set[i-1].Merge(v) + } + if i == len(s.Set) { + // v was either merged with the last entry or needs to be appended + if !merged { + s.insertAt(i, v) + } + return + } else if merged { + i-- + } else if s.Set[i], merged = s.Set[i].Merge(v); !merged { + s.insertAt(i, v) // insert in the middle (e.g. "1,5".insert(3), i == 1) + return + } + // v was merged with s.Set[i], continue trying to merge until the end + for j := i + 1; j < len(s.Set); j++ { + if s.Set[i], merged = s.Set[i].Merge(s.Set[j]); !merged { + if j > i+1 { + // cut out all entries between i and j that were merged + s.Set = append(s.Set[:i+1], s.Set[j:]...) + } + return + } + } + // everything after s.Set[i] was merged + s.Set = s.Set[:i+1] +} + +// insertAt inserts a new sequence value v at index i, resizing s.Set as needed. +func (s *SeqSet) insertAt(i int, v Seq) { + if n := len(s.Set); i == n { + // insert at the end + s.Set = append(s.Set, v) + return + } else if n < cap(s.Set) { + // enough space, shift everything at and after i to the right + s.Set = s.Set[:n+1] + copy(s.Set[i+1:], s.Set[i:]) + } else { + // allocate new slice and copy everything, n is at least 1 + set := make([]Seq, n+1, n*2) + copy(set, s.Set[:i]) + copy(set[i+1:], s.Set[i:]) + s.Set = set + } + s.Set[i] = v +} + +// search attempts to find the index of the sequence set value that contains q. +// If no values contain q, the returned index is the position where q should be +// inserted and ok is set to false. +func (s SeqSet) search(q uint32) (i int, ok bool) { + min, max := 0, len(s.Set)-1 + for min < max { + if mid := (min + max) >> 1; s.Set[mid].Less(q) { + min = mid + 1 + } else { + max = mid + } + } + if max < 0 || s.Set[min].Less(q) { + return len(s.Set), false // q is the new largest value + } + return min, s.Set[min].Contains(q) +} diff --git a/vendor/github.com/emersion/go-imap/status.go b/vendor/github.com/emersion/go-imap/status.go new file mode 100644 index 00000000..81ffd1b9 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/status.go @@ -0,0 +1,136 @@ +package imap + +import ( + "errors" +) + +// A status response type. +type StatusRespType string + +// Status response types defined in RFC 3501 section 7.1. +const ( + // The OK response indicates an information message from the server. When + // tagged, it indicates successful completion of the associated command. + // The untagged form indicates an information-only message. + StatusRespOk StatusRespType = "OK" + + // The NO response indicates an operational error message from the + // server. When tagged, it indicates unsuccessful completion of the + // associated command. The untagged form indicates a warning; the + // command can still complete successfully. + StatusRespNo StatusRespType = "NO" + + // The BAD response indicates an error message from the server. When + // tagged, it reports a protocol-level error in the client's command; + // the tag indicates the command that caused the error. The untagged + // form indicates a protocol-level error for which the associated + // command can not be determined; it can also indicate an internal + // server failure. + StatusRespBad StatusRespType = "BAD" + + // The PREAUTH response is always untagged, and is one of three + // possible greetings at connection startup. It indicates that the + // connection has already been authenticated by external means; thus + // no LOGIN command is needed. + StatusRespPreauth StatusRespType = "PREAUTH" + + // The BYE response is always untagged, and indicates that the server + // is about to close the connection. + StatusRespBye StatusRespType = "BYE" +) + +type StatusRespCode string + +// Status response codes defined in RFC 3501 section 7.1. +const ( + CodeAlert StatusRespCode = "ALERT" + CodeBadCharset StatusRespCode = "BADCHARSET" + CodeCapability StatusRespCode = "CAPABILITY" + CodeParse StatusRespCode = "PARSE" + CodePermanentFlags StatusRespCode = "PERMANENTFLAGS" + CodeReadOnly StatusRespCode = "READ-ONLY" + CodeReadWrite StatusRespCode = "READ-WRITE" + CodeTryCreate StatusRespCode = "TRYCREATE" + CodeUidNext StatusRespCode = "UIDNEXT" + CodeUidValidity StatusRespCode = "UIDVALIDITY" + CodeUnseen StatusRespCode = "UNSEEN" +) + +// A status response. +// See RFC 3501 section 7.1 +type StatusResp struct { + // The response tag. If empty, it defaults to *. + Tag string + // The status type. + Type StatusRespType + // The status code. + // See https://www.iana.org/assignments/imap-response-codes/imap-response-codes.xhtml + Code StatusRespCode + // Arguments provided with the status code. + Arguments []interface{} + // The status info. + Info string +} + +func (r *StatusResp) resp() {} + +// If this status is NO or BAD, returns an error with the status info. +// Otherwise, returns nil. +func (r *StatusResp) Err() error { + if r == nil { + // No status response, connection closed before we get one + return errors.New("imap: connection closed during command execution") + } + + if r.Type == StatusRespNo || r.Type == StatusRespBad { + return errors.New(r.Info) + } + return nil +} + +func (r *StatusResp) WriteTo(w *Writer) error { + tag := RawString(r.Tag) + if tag == "" { + tag = "*" + } + + if err := w.writeFields([]interface{}{RawString(tag), RawString(r.Type)}); err != nil { + return err + } + + if err := w.writeString(string(sp)); err != nil { + return err + } + + if r.Code != "" { + if err := w.writeRespCode(r.Code, r.Arguments); err != nil { + return err + } + + if err := w.writeString(string(sp)); err != nil { + return err + } + } + + if err := w.writeString(r.Info); err != nil { + return err + } + + return w.writeCrlf() +} + +// ErrStatusResp can be returned by a server.Handler to replace the default status +// response. The response tag must be empty. +// +// To suppress default response, Resp should be set to nil. +type ErrStatusResp struct { + // Response to send instead of default. + Resp *StatusResp +} + +func (err *ErrStatusResp) Error() string { + if err.Resp == nil { + return "imap: suppressed response" + } + return err.Resp.Info +} diff --git a/vendor/github.com/emersion/go-imap/utf7/decoder.go b/vendor/github.com/emersion/go-imap/utf7/decoder.go new file mode 100644 index 00000000..cfcba8c0 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/utf7/decoder.go @@ -0,0 +1,149 @@ +package utf7 + +import ( + "errors" + "unicode/utf16" + "unicode/utf8" + + "golang.org/x/text/transform" +) + +// ErrInvalidUTF7 means that a transformer encountered invalid UTF-7. +var ErrInvalidUTF7 = errors.New("utf7: invalid UTF-7") + +type decoder struct { + ascii bool +} + +func (d *decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + for i := 0; i < len(src); i++ { + ch := src[i] + + if ch < min || ch > max { // Illegal code point in ASCII mode + err = ErrInvalidUTF7 + return + } + + if ch != '&' { + if nDst+1 > len(dst) { + err = transform.ErrShortDst + return + } + + nSrc++ + + dst[nDst] = ch + nDst++ + + d.ascii = true + continue + } + + // Find the end of the Base64 or "&-" segment + start := i + 1 + for i++; i < len(src) && src[i] != '-'; i++ { + if src[i] == '\r' || src[i] == '\n' { // base64 package ignores CR and LF + err = ErrInvalidUTF7 + return + } + } + + if i == len(src) { // Implicit shift ("&...") + if atEOF { + err = ErrInvalidUTF7 + } else { + err = transform.ErrShortSrc + } + return + } + + var b []byte + if i == start { // Escape sequence "&-" + b = []byte{'&'} + d.ascii = true + } else { // Control or non-ASCII code points in base64 + if !d.ascii { // Null shift ("&...-&...-") + err = ErrInvalidUTF7 + return + } + + b = decode(src[start:i]) + d.ascii = false + } + + if len(b) == 0 { // Bad encoding + err = ErrInvalidUTF7 + return + } + + if nDst+len(b) > len(dst) { + d.ascii = true + err = transform.ErrShortDst + return + } + + nSrc = i + 1 + + for _, ch := range b { + dst[nDst] = ch + nDst++ + } + } + + if atEOF { + d.ascii = true + } + + return +} + +func (d *decoder) Reset() { + d.ascii = true +} + +// Extracts UTF-16-BE bytes from base64 data and converts them to UTF-8. +// A nil slice is returned if the encoding is invalid. +func decode(b64 []byte) []byte { + var b []byte + + // Allocate a single block of memory large enough to store the Base64 data + // (if padding is required), UTF-16-BE bytes, and decoded UTF-8 bytes. + // Since a 2-byte UTF-16 sequence may expand into a 3-byte UTF-8 sequence, + // double the space allocation for UTF-8. + if n := len(b64); b64[n-1] == '=' { + return nil + } else if n&3 == 0 { + b = make([]byte, b64Enc.DecodedLen(n)*3) + } else { + n += 4 - n&3 + b = make([]byte, n+b64Enc.DecodedLen(n)*3) + copy(b[copy(b, b64):n], []byte("==")) + b64, b = b[:n], b[n:] + } + + // Decode Base64 into the first 1/3rd of b + n, err := b64Enc.Decode(b, b64) + if err != nil || n&1 == 1 { + return nil + } + + // Decode UTF-16-BE into the remaining 2/3rds of b + b, s := b[:n], b[n:] + j := 0 + for i := 0; i < n; i += 2 { + r := rune(b[i])<<8 | rune(b[i+1]) + if utf16.IsSurrogate(r) { + if i += 2; i == n { + return nil + } + r2 := rune(b[i])<<8 | rune(b[i+1]) + if r = utf16.DecodeRune(r, r2); r == repl { + return nil + } + } else if min <= r && r <= max { + return nil + } + j += utf8.EncodeRune(s[j:], r) + } + return s[:j] +} diff --git a/vendor/github.com/emersion/go-imap/utf7/encoder.go b/vendor/github.com/emersion/go-imap/utf7/encoder.go new file mode 100644 index 00000000..8414d109 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/utf7/encoder.go @@ -0,0 +1,91 @@ +package utf7 + +import ( + "unicode/utf16" + "unicode/utf8" + + "golang.org/x/text/transform" +) + +type encoder struct{} + +func (e *encoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + for i := 0; i < len(src); { + ch := src[i] + + var b []byte + if min <= ch && ch <= max { + b = []byte{ch} + if ch == '&' { + b = append(b, '-') + } + + i++ + } else { + start := i + + // Find the next printable ASCII code point + i++ + for i < len(src) && (src[i] < min || src[i] > max) { + i++ + } + + if !atEOF && i == len(src) { + err = transform.ErrShortSrc + return + } + + b = encode(src[start:i]) + } + + if nDst+len(b) > len(dst) { + err = transform.ErrShortDst + return + } + + nSrc = i + + for _, ch := range b { + dst[nDst] = ch + nDst++ + } + } + + return +} + +func (e *encoder) Reset() {} + +// Converts string s from UTF-8 to UTF-16-BE, encodes the result as base64, +// removes the padding, and adds UTF-7 shifts. +func encode(s []byte) []byte { + // len(s) is sufficient for UTF-8 to UTF-16 conversion if there are no + // control code points (see table below). + b := make([]byte, 0, len(s)+4) + for len(s) > 0 { + r, size := utf8.DecodeRune(s) + if r > utf8.MaxRune { + r, size = utf8.RuneError, 1 // Bug fix (issue 3785) + } + s = s[size:] + if r1, r2 := utf16.EncodeRune(r); r1 != repl { + b = append(b, byte(r1>>8), byte(r1)) + r = r2 + } + b = append(b, byte(r>>8), byte(r)) + } + + // Encode as base64 + n := b64Enc.EncodedLen(len(b)) + 2 + b64 := make([]byte, n) + b64Enc.Encode(b64[1:], b) + + // Strip padding + n -= 2 - (len(b)+2)%3 + b64 = b64[:n] + + // Add UTF-7 shifts + b64[0] = '&' + b64[n-1] = '-' + return b64 +} diff --git a/vendor/github.com/emersion/go-imap/utf7/utf7.go b/vendor/github.com/emersion/go-imap/utf7/utf7.go new file mode 100644 index 00000000..b9dd9623 --- /dev/null +++ b/vendor/github.com/emersion/go-imap/utf7/utf7.go @@ -0,0 +1,34 @@ +// Package utf7 implements modified UTF-7 encoding defined in RFC 3501 section 5.1.3 +package utf7 + +import ( + "encoding/base64" + + "golang.org/x/text/encoding" +) + +const ( + min = 0x20 // Minimum self-representing UTF-7 value + max = 0x7E // Maximum self-representing UTF-7 value + + repl = '\uFFFD' // Unicode replacement code point +) + +var b64Enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,") + +type enc struct{} + +func (e enc) NewDecoder() *encoding.Decoder { + return &encoding.Decoder{ + Transformer: &decoder{true}, + } +} + +func (e enc) NewEncoder() *encoding.Encoder { + return &encoding.Encoder{ + Transformer: &encoder{}, + } +} + +// Encoding is the modified UTF-7 encoding. +var Encoding encoding.Encoding = enc{} diff --git a/vendor/github.com/emersion/go-imap/write.go b/vendor/github.com/emersion/go-imap/write.go new file mode 100644 index 00000000..c295e4ef --- /dev/null +++ b/vendor/github.com/emersion/go-imap/write.go @@ -0,0 +1,255 @@ +package imap + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "strconv" + "time" + "unicode" +) + +type flusher interface { + Flush() error +} + +type ( + // A raw string. + RawString string +) + +type WriterTo interface { + WriteTo(w *Writer) error +} + +func formatNumber(num uint32) string { + return strconv.FormatUint(uint64(num), 10) +} + +// Convert a string list to a field list. +func FormatStringList(list []string) (fields []interface{}) { + fields = make([]interface{}, len(list)) + for i, v := range list { + fields[i] = v + } + return +} + +// Check if a string is 8-bit clean. +func isAscii(s string) bool { + for _, c := range s { + if c > unicode.MaxASCII || unicode.IsControl(c) { + return false + } + } + return true +} + +// An IMAP writer. +type Writer struct { + io.Writer + + AllowAsyncLiterals bool + + continues <-chan bool +} + +// Helper function to write a string to w. +func (w *Writer) writeString(s string) error { + _, err := io.WriteString(w.Writer, s) + return err +} + +func (w *Writer) writeCrlf() error { + if err := w.writeString(crlf); err != nil { + return err + } + + return w.Flush() +} + +func (w *Writer) writeNumber(num uint32) error { + return w.writeString(formatNumber(num)) +} + +func (w *Writer) writeQuoted(s string) error { + return w.writeString(strconv.Quote(s)) +} + +func (w *Writer) writeQuotedOrLiteral(s string) error { + if !isAscii(s) { + // IMAP doesn't allow 8-bit data outside literals + return w.writeLiteral(bytes.NewBufferString(s)) + } + + return w.writeQuoted(s) +} + +func (w *Writer) writeDateTime(t time.Time, layout string) error { + if t.IsZero() { + return w.writeString(nilAtom) + } + return w.writeQuoted(t.Format(layout)) +} + +func (w *Writer) writeFields(fields []interface{}) error { + for i, field := range fields { + if i > 0 { // Write separator + if err := w.writeString(string(sp)); err != nil { + return err + } + } + + if err := w.writeField(field); err != nil { + return err + } + } + + return nil +} + +func (w *Writer) writeList(fields []interface{}) error { + if err := w.writeString(string(listStart)); err != nil { + return err + } + + if err := w.writeFields(fields); err != nil { + return err + } + + return w.writeString(string(listEnd)) +} + +// LiteralLengthErr is returned when the Len() of the Literal object does not +// match the actual length of the byte stream. +type LiteralLengthErr struct { + Actual int + Expected int +} + +func (e LiteralLengthErr) Error() string { + return fmt.Sprintf("imap: size of Literal is not equal to Len() (%d != %d)", e.Expected, e.Actual) +} + +func (w *Writer) writeLiteral(l Literal) error { + if l == nil { + return w.writeString(nilAtom) + } + + unsyncLiteral := w.AllowAsyncLiterals && l.Len() <= 4096 + + header := string(literalStart) + strconv.Itoa(l.Len()) + if unsyncLiteral { + header += string('+') + } + header += string(literalEnd) + crlf + if err := w.writeString(header); err != nil { + return err + } + + // If a channel is available, wait for a continuation request before sending data + if !unsyncLiteral && w.continues != nil { + // Make sure to flush the writer, otherwise we may never receive a continuation request + if err := w.Flush(); err != nil { + return err + } + + if !<-w.continues { + return fmt.Errorf("imap: cannot send literal: no continuation request received") + } + } + + // In case of bufio.Buffer, it will be 0 after io.Copy. + literalLen := int64(l.Len()) + + n, err := io.CopyN(w, l, literalLen) + if err != nil { + if err == io.EOF && n != literalLen { + return LiteralLengthErr{int(n), l.Len()} + } + return err + } + extra, _ := io.Copy(ioutil.Discard, l) + if extra != 0 { + return LiteralLengthErr{int(n + extra), l.Len()} + } + + return nil +} + +func (w *Writer) writeField(field interface{}) error { + if field == nil { + return w.writeString(nilAtom) + } + + switch field := field.(type) { + case RawString: + return w.writeString(string(field)) + case string: + return w.writeQuotedOrLiteral(field) + case int: + return w.writeNumber(uint32(field)) + case uint32: + return w.writeNumber(field) + case Literal: + return w.writeLiteral(field) + case []interface{}: + return w.writeList(field) + case envelopeDateTime: + return w.writeDateTime(time.Time(field), envelopeDateTimeLayout) + case searchDate: + return w.writeDateTime(time.Time(field), searchDateLayout) + case Date: + return w.writeDateTime(time.Time(field), DateLayout) + case DateTime: + return w.writeDateTime(time.Time(field), DateTimeLayout) + case time.Time: + return w.writeDateTime(field, DateTimeLayout) + case *SeqSet: + return w.writeString(field.String()) + case *BodySectionName: + // Can contain spaces - that's why we don't just pass it as a string + return w.writeString(string(field.FetchItem())) + } + + return fmt.Errorf("imap: cannot format field: %v", field) +} + +func (w *Writer) writeRespCode(code StatusRespCode, args []interface{}) error { + if err := w.writeString(string(respCodeStart)); err != nil { + return err + } + + fields := []interface{}{RawString(code)} + fields = append(fields, args...) + + if err := w.writeFields(fields); err != nil { + return err + } + + return w.writeString(string(respCodeEnd)) +} + +func (w *Writer) writeLine(fields ...interface{}) error { + if err := w.writeFields(fields); err != nil { + return err + } + + return w.writeCrlf() +} + +func (w *Writer) Flush() error { + if f, ok := w.Writer.(flusher); ok { + return f.Flush() + } + return nil +} + +func NewWriter(w io.Writer) *Writer { + return &Writer{Writer: w} +} + +func NewClientWriter(w io.Writer, continues <-chan bool) *Writer { + return &Writer{Writer: w, continues: continues} +} diff --git a/vendor/github.com/emersion/go-message/.build.yml b/vendor/github.com/emersion/go-message/.build.yml new file mode 100644 index 00000000..36f961ae --- /dev/null +++ b/vendor/github.com/emersion/go-message/.build.yml @@ -0,0 +1,17 @@ +image: alpine/edge +packages: + - go +sources: + - https://github.com/emersion/go-message +artifacts: + - coverage.html +tasks: + - build: | + cd go-message + go build -v ./... + - test: | + cd go-message + go test -coverprofile=coverage.txt -covermode=atomic ./... + - coverage: | + cd go-message + go tool cover -html=coverage.txt -o ~/coverage.html diff --git a/vendor/github.com/emersion/go-message/.gitignore b/vendor/github.com/emersion/go-message/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/vendor/github.com/emersion/go-message/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/emersion/go-message/LICENSE b/vendor/github.com/emersion/go-message/LICENSE new file mode 100644 index 00000000..0d504877 --- /dev/null +++ b/vendor/github.com/emersion/go-message/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 emersion + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/emersion/go-message/README.md b/vendor/github.com/emersion/go-message/README.md new file mode 100644 index 00000000..f3830c93 --- /dev/null +++ b/vendor/github.com/emersion/go-message/README.md @@ -0,0 +1,31 @@ +# go-message + +[![godocs.io](https://godocs.io/github.com/emersion/go-message?status.svg)](https://godocs.io/github.com/emersion/go-message) +[![builds.sr.ht status](https://builds.sr.ht/~emersion/go-message/commits.svg)](https://builds.sr.ht/~emersion/go-message/commits?) + +A Go library for the Internet Message Format. It implements: + +* [RFC 5322]: Internet Message Format +* [RFC 2045], [RFC 2046] and [RFC 2047]: Multipurpose Internet Mail Extensions +* [RFC 2183]: Content-Disposition Header Field + +## Features + +* Streaming API +* Automatic encoding and charset handling (to decode all charsets, add + `import _ "github.com/emersion/go-message/charset"` to your application) +* A [`mail`](https://godocs.io/github.com/emersion/go-message/mail) subpackage + to read and write mail messages +* DKIM-friendly +* A [`textproto`](https://godocs.io/github.com/emersion/go-message/textproto) + subpackage that just implements the wire format + +## License + +MIT + +[RFC 5322]: https://tools.ietf.org/html/rfc5322 +[RFC 2045]: https://tools.ietf.org/html/rfc2045 +[RFC 2046]: https://tools.ietf.org/html/rfc2046 +[RFC 2047]: https://tools.ietf.org/html/rfc2047 +[RFC 2183]: https://tools.ietf.org/html/rfc2183 diff --git a/vendor/github.com/emersion/go-message/charset.go b/vendor/github.com/emersion/go-message/charset.go new file mode 100644 index 00000000..9d4d10e7 --- /dev/null +++ b/vendor/github.com/emersion/go-message/charset.go @@ -0,0 +1,66 @@ +package message + +import ( + "errors" + "fmt" + "io" + "mime" + "strings" +) + +type UnknownCharsetError struct { + e error +} + +func (u UnknownCharsetError) Unwrap() error { return u.e } + +func (u UnknownCharsetError) Error() string { + return "unknown charset: " + u.e.Error() +} + +// IsUnknownCharset returns a boolean indicating whether the error is known to +// report that the charset advertised by the entity is unknown. +func IsUnknownCharset(err error) bool { + return errors.As(err, new(UnknownCharsetError)) +} + +// CharsetReader, if non-nil, defines a function to generate charset-conversion +// readers, converting from the provided charset into UTF-8. Charsets are always +// lower-case. utf-8 and us-ascii charsets are handled by default. One of the +// the CharsetReader's result values must be non-nil. +// +// Importing github.com/emersion/go-message/charset will set CharsetReader to +// a function that handles most common charsets. Alternatively, CharsetReader +// can be set to e.g. golang.org/x/net/html/charset.NewReaderLabel. +var CharsetReader func(charset string, input io.Reader) (io.Reader, error) + +// charsetReader calls CharsetReader if non-nil. +func charsetReader(charset string, input io.Reader) (io.Reader, error) { + charset = strings.ToLower(charset) + if charset == "utf-8" || charset == "us-ascii" { + return input, nil + } + if CharsetReader != nil { + r, err := CharsetReader(charset, input) + if err != nil { + return r, UnknownCharsetError{err} + } + return r, nil + } + return input, UnknownCharsetError{fmt.Errorf("message: unhandled charset %q", charset)} +} + +// decodeHeader decodes an internationalized header field. If it fails, it +// returns the input string and the error. +func decodeHeader(s string) (string, error) { + wordDecoder := mime.WordDecoder{CharsetReader: charsetReader} + dec, err := wordDecoder.DecodeHeader(s) + if err != nil { + return s, err + } + return dec, nil +} + +func encodeHeader(s string) string { + return mime.QEncoding.Encode("utf-8", s) +} diff --git a/vendor/github.com/emersion/go-message/encoding.go b/vendor/github.com/emersion/go-message/encoding.go new file mode 100644 index 00000000..ca4869b9 --- /dev/null +++ b/vendor/github.com/emersion/go-message/encoding.go @@ -0,0 +1,88 @@ +package message + +import ( + "encoding/base64" + "errors" + "fmt" + "io" + "mime/quotedprintable" + "strings" + + "github.com/emersion/go-textwrapper" +) + +type UnknownEncodingError struct { + e error +} + +func (u UnknownEncodingError) Unwrap() error { return u.e } + +func (u UnknownEncodingError) Error() string { + return "encoding error: " + u.e.Error() +} + +// IsUnknownEncoding returns a boolean indicating whether the error is known to +// report that the encoding advertised by the entity is unknown. +func IsUnknownEncoding(err error) bool { + return errors.As(err, new(UnknownEncodingError)) +} + +func encodingReader(enc string, r io.Reader) (io.Reader, error) { + var dec io.Reader + switch strings.ToLower(enc) { + case "quoted-printable": + dec = quotedprintable.NewReader(r) + case "base64": + wrapped := &whitespaceReplacingReader{wrapped: r} + dec = base64.NewDecoder(base64.StdEncoding, wrapped) + case "7bit", "8bit", "binary", "": + dec = r + default: + return nil, fmt.Errorf("unhandled encoding %q", enc) + } + return dec, nil +} + +type nopCloser struct { + io.Writer +} + +func (nopCloser) Close() error { + return nil +} + +func encodingWriter(enc string, w io.Writer) (io.WriteCloser, error) { + var wc io.WriteCloser + switch strings.ToLower(enc) { + case "quoted-printable": + wc = quotedprintable.NewWriter(w) + case "base64": + wc = base64.NewEncoder(base64.StdEncoding, textwrapper.NewRFC822(w)) + case "7bit", "8bit": + wc = nopCloser{textwrapper.New(w, "\r\n", 1000)} + case "binary", "": + wc = nopCloser{w} + default: + return nil, fmt.Errorf("unhandled encoding %q", enc) + } + return wc, nil +} + +// whitespaceReplacingReader replaces space and tab characters with a LF so +// base64 bodies with a continuation indent can be decoded by the base64 decoder +// even though it is against the spec. +type whitespaceReplacingReader struct { + wrapped io.Reader +} + +func (r *whitespaceReplacingReader) Read(p []byte) (int, error) { + n, err := r.wrapped.Read(p) + + for i := 0; i < n; i++ { + if p[i] == ' ' || p[i] == '\t' { + p[i] = '\n' + } + } + + return n, err +} diff --git a/vendor/github.com/emersion/go-message/entity.go b/vendor/github.com/emersion/go-message/entity.go new file mode 100644 index 00000000..a0858e54 --- /dev/null +++ b/vendor/github.com/emersion/go-message/entity.go @@ -0,0 +1,260 @@ +package message + +import ( + "bufio" + "errors" + "io" + "math" + "strings" + + "github.com/emersion/go-message/textproto" +) + +// An Entity is either a whole message or a one of the parts in the body of a +// multipart entity. +type Entity struct { + Header Header // The entity's header. + Body io.Reader // The decoded entity's body. + + mediaType string + mediaParams map[string]string +} + +// New makes a new message with the provided header and body. The entity's +// transfer encoding and charset are automatically decoded to UTF-8. +// +// If the message uses an unknown transfer encoding or charset, New returns an +// error that verifies IsUnknownCharset, but also returns an Entity that can +// be read. +func New(header Header, body io.Reader) (*Entity, error) { + var err error + + mediaType, mediaParams, _ := header.ContentType() + + // QUIRK: RFC 2045 section 6.4 specifies that multipart messages can't have + // a Content-Transfer-Encoding other than "7bit", "8bit" or "binary". + // However some messages in the wild are non-conformant and have it set to + // e.g. "quoted-printable". So we just ignore it for multipart. + // See https://github.com/emersion/go-message/issues/48 + if !strings.HasPrefix(mediaType, "multipart/") { + enc := header.Get("Content-Transfer-Encoding") + if decoded, encErr := encodingReader(enc, body); encErr != nil { + err = UnknownEncodingError{encErr} + } else { + body = decoded + } + } + + // RFC 2046 section 4.1.2: charset only applies to text/* + if strings.HasPrefix(mediaType, "text/") { + if ch, ok := mediaParams["charset"]; ok { + if converted, charsetErr := charsetReader(ch, body); charsetErr != nil { + err = UnknownCharsetError{charsetErr} + } else { + body = converted + } + } + } + + return &Entity{ + Header: header, + Body: body, + mediaType: mediaType, + mediaParams: mediaParams, + }, err +} + +// NewMultipart makes a new multipart message with the provided header and +// parts. The Content-Type header must begin with "multipart/". +// +// If the message uses an unknown transfer encoding, NewMultipart returns an +// error that verifies IsUnknownCharset, but also returns an Entity that can +// be read. +func NewMultipart(header Header, parts []*Entity) (*Entity, error) { + r := &multipartBody{ + header: header, + parts: parts, + } + + return New(header, r) +} + +const defaultMaxHeaderBytes = 1 << 20 // 1 MB + +var errHeaderTooBig = errors.New("message: header exceeds maximum size") + +// limitedReader is the same as io.LimitedReader, but returns a custom error. +type limitedReader struct { + R io.Reader + N int64 +} + +func (lr *limitedReader) Read(p []byte) (int, error) { + if lr.N <= 0 { + return 0, errHeaderTooBig + } + if int64(len(p)) > lr.N { + p = p[0:lr.N] + } + n, err := lr.R.Read(p) + lr.N -= int64(n) + return n, err +} + +// ReadOptions are options for ReadWithOptions. +type ReadOptions struct { + // MaxHeaderBytes limits the maximum permissible size of a message header + // block. If exceeded, an error will be returned. + // + // Set to -1 for no limit, set to 0 for the default value (1MB). + MaxHeaderBytes int64 +} + +// withDefaults returns a sanitised version of the options with defaults/special +// values accounted for. +func (o *ReadOptions) withDefaults() *ReadOptions { + var out ReadOptions + if o != nil { + out = *o + } + if out.MaxHeaderBytes == 0 { + out.MaxHeaderBytes = defaultMaxHeaderBytes + } else if out.MaxHeaderBytes < 0 { + out.MaxHeaderBytes = math.MaxInt64 + } + return &out +} + +// ReadWithOptions see Read, but allows overriding some parameters with +// ReadOptions. +// +// If the message uses an unknown transfer encoding or charset, ReadWithOptions +// returns an error that verifies IsUnknownCharset or IsUnknownEncoding, but +// also returns an Entity that can be read. +func ReadWithOptions(r io.Reader, opts *ReadOptions) (*Entity, error) { + opts = opts.withDefaults() + + lr := &limitedReader{R: r, N: opts.MaxHeaderBytes} + br := bufio.NewReader(lr) + + h, err := textproto.ReadHeader(br) + if err != nil { + return nil, err + } + + lr.N = math.MaxInt64 + + return New(Header{h}, br) +} + +// Read reads a message from r. The message's encoding and charset are +// automatically decoded to raw UTF-8. Note that this function only reads the +// message header. +// +// If the message uses an unknown transfer encoding or charset, Read returns an +// error that verifies IsUnknownCharset or IsUnknownEncoding, but also returns +// an Entity that can be read. +func Read(r io.Reader) (*Entity, error) { + return ReadWithOptions(r, nil) +} + +// MultipartReader returns a MultipartReader that reads parts from this entity's +// body. If this entity is not multipart, it returns nil. +func (e *Entity) MultipartReader() MultipartReader { + if !strings.HasPrefix(e.mediaType, "multipart/") { + return nil + } + if mb, ok := e.Body.(*multipartBody); ok { + return mb + } + return &multipartReader{textproto.NewMultipartReader(e.Body, e.mediaParams["boundary"])} +} + +// writeBodyTo writes this entity's body to w (without the header). +func (e *Entity) writeBodyTo(w *Writer) error { + var err error + if mb, ok := e.Body.(*multipartBody); ok { + err = mb.writeBodyTo(w) + } else { + _, err = io.Copy(w, e.Body) + } + return err +} + +// WriteTo writes this entity's header and body to w. +func (e *Entity) WriteTo(w io.Writer) error { + ew, err := CreateWriter(w, e.Header) + if err != nil { + return err + } + defer ew.Close() + + return e.writeBodyTo(ew) +} + +// WalkFunc is the type of the function called for each part visited by Walk. +// +// The path argument is a list of multipart indices leading to the part. The +// root part has a nil path. +// +// If there was an encoding error walking to a part, the incoming error will +// describe the problem and the function can decide how to handle that error. +// +// Unlike IMAP part paths, indices start from 0 (instead of 1) and a +// non-multipart message has a nil path (instead of {1}). +// +// If an error is returned, processing stops. +type WalkFunc func(path []int, entity *Entity, err error) error + +// Walk walks the entity's multipart tree, calling walkFunc for each part in +// the tree, including the root entity. +// +// Walk consumes the entity. +func (e *Entity) Walk(walkFunc WalkFunc) error { + var multipartReaders []MultipartReader + var path []int + part := e + for { + var err error + if part == nil { + if len(multipartReaders) == 0 { + break + } + + // Get the next part from the last multipart reader + mr := multipartReaders[len(multipartReaders)-1] + part, err = mr.NextPart() + if err == io.EOF { + multipartReaders = multipartReaders[:len(multipartReaders)-1] + path = path[:len(path)-1] + continue + } else if IsUnknownEncoding(err) || IsUnknownCharset(err) { + // Forward the error to walkFunc + } else if err != nil { + return err + } + + path[len(path)-1]++ + } + + // Copy the path since we'll mutate it on the next iteration + var pathCopy []int + if len(path) > 0 { + pathCopy = make([]int, len(path)) + copy(pathCopy, path) + } + + if err := walkFunc(pathCopy, part, err); err != nil { + return err + } + + if mr := part.MultipartReader(); mr != nil { + multipartReaders = append(multipartReaders, mr) + path = append(path, -1) + } + + part = nil + } + + return nil +} diff --git a/vendor/github.com/emersion/go-message/header.go b/vendor/github.com/emersion/go-message/header.go new file mode 100644 index 00000000..1a98fe66 --- /dev/null +++ b/vendor/github.com/emersion/go-message/header.go @@ -0,0 +1,118 @@ +package message + +import ( + "mime" + + "github.com/emersion/go-message/textproto" +) + +func parseHeaderWithParams(s string) (f string, params map[string]string, err error) { + f, params, err = mime.ParseMediaType(s) + if err != nil { + return s, nil, err + } + for k, v := range params { + params[k], _ = decodeHeader(v) + } + return +} + +func formatHeaderWithParams(f string, params map[string]string) string { + encParams := make(map[string]string) + for k, v := range params { + encParams[k] = encodeHeader(v) + } + return mime.FormatMediaType(f, encParams) +} + +// HeaderFields iterates over header fields. +type HeaderFields interface { + textproto.HeaderFields + + // Text parses the value of the current field as plaintext. The field + // charset is decoded to UTF-8. If the header field's charset is unknown, + // the raw field value is returned and the error verifies IsUnknownCharset. + Text() (string, error) +} + +type headerFields struct { + textproto.HeaderFields +} + +func (hf *headerFields) Text() (string, error) { + return decodeHeader(hf.Value()) +} + +// A Header represents the key-value pairs in a message header. +type Header struct { + textproto.Header +} + +// HeaderFromMap creates a header from a map of header fields. +// +// This function is provided for interoperability with the standard library. +// If possible, ReadHeader should be used instead to avoid loosing information. +// The map representation looses the ordering of the fields, the capitalization +// of the header keys, and the whitespace of the original header. +func HeaderFromMap(m map[string][]string) Header { + return Header{textproto.HeaderFromMap(m)} +} + +// ContentType parses the Content-Type header field. +// +// If no Content-Type is specified, it returns "text/plain". +func (h *Header) ContentType() (t string, params map[string]string, err error) { + v := h.Get("Content-Type") + if v == "" { + return "text/plain", nil, nil + } + return parseHeaderWithParams(v) +} + +// SetContentType formats the Content-Type header field. +func (h *Header) SetContentType(t string, params map[string]string) { + h.Set("Content-Type", formatHeaderWithParams(t, params)) +} + +// ContentDisposition parses the Content-Disposition header field, as defined in +// RFC 2183. +func (h *Header) ContentDisposition() (disp string, params map[string]string, err error) { + return parseHeaderWithParams(h.Get("Content-Disposition")) +} + +// SetContentDisposition formats the Content-Disposition header field, as +// defined in RFC 2183. +func (h *Header) SetContentDisposition(disp string, params map[string]string) { + h.Set("Content-Disposition", formatHeaderWithParams(disp, params)) +} + +// Text parses a plaintext header field. The field charset is automatically +// decoded to UTF-8. If the header field's charset is unknown, the raw field +// value is returned and the error verifies IsUnknownCharset. +func (h *Header) Text(k string) (string, error) { + return decodeHeader(h.Get(k)) +} + +// SetText sets a plaintext header field. +func (h *Header) SetText(k, v string) { + h.Set(k, encodeHeader(v)) +} + +// Copy creates a stand-alone copy of the header. +func (h *Header) Copy() Header { + return Header{h.Header.Copy()} +} + +// Fields iterates over all the header fields. +// +// The header may not be mutated while iterating, except using HeaderFields.Del. +func (h *Header) Fields() HeaderFields { + return &headerFields{h.Header.Fields()} +} + +// FieldsByKey iterates over all fields having the specified key. +// +// The header may not be mutated while iterating, except using HeaderFields.Del. +func (h *Header) FieldsByKey(k string) HeaderFields { + return &headerFields{h.Header.FieldsByKey(k)} +} diff --git a/vendor/github.com/emersion/go-message/mail/address.go b/vendor/github.com/emersion/go-message/mail/address.go new file mode 100644 index 00000000..3d3bbca1 --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/address.go @@ -0,0 +1,42 @@ +package mail + +import ( + "mime" + "net/mail" + "strings" + + "github.com/emersion/go-message" +) + +// Address represents a single mail address. +// The type alias ensures that a net/mail.Address can be used wherever an +// Address is expected +type Address = mail.Address + +func formatAddressList(l []*Address) string { + formatted := make([]string, len(l)) + for i, a := range l { + formatted[i] = a.String() + } + return strings.Join(formatted, ", ") +} + +// ParseAddress parses a single RFC 5322 address, e.g. "Barry Gibbs " +// Use this function only if you parse from a string, if you have a Header use +// Header.AddressList instead +func ParseAddress(address string) (*Address, error) { + parser := mail.AddressParser{ + &mime.WordDecoder{message.CharsetReader}, + } + return parser.Parse(address) +} + +// ParseAddressList parses the given string as a list of addresses. +// Use this function only if you parse from a string, if you have a Header use +// Header.AddressList instead +func ParseAddressList(list string) ([]*Address, error) { + parser := mail.AddressParser{ + &mime.WordDecoder{message.CharsetReader}, + } + return parser.ParseList(list) +} diff --git a/vendor/github.com/emersion/go-message/mail/attachment.go b/vendor/github.com/emersion/go-message/mail/attachment.go new file mode 100644 index 00000000..3fbbce26 --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/attachment.go @@ -0,0 +1,30 @@ +package mail + +import ( + "github.com/emersion/go-message" +) + +// An AttachmentHeader represents an attachment's header. +type AttachmentHeader struct { + message.Header +} + +// Filename parses the attachment's filename. +func (h *AttachmentHeader) Filename() (string, error) { + _, params, err := h.ContentDisposition() + + filename, ok := params["filename"] + if !ok { + // Using "name" in Content-Type is discouraged + _, params, err = h.ContentType() + filename = params["name"] + } + + return filename, err +} + +// SetFilename formats the attachment's filename. +func (h *AttachmentHeader) SetFilename(filename string) { + dispParams := map[string]string{"filename": filename} + h.SetContentDisposition("attachment", dispParams) +} diff --git a/vendor/github.com/emersion/go-message/mail/header.go b/vendor/github.com/emersion/go-message/mail/header.go new file mode 100644 index 00000000..751c9090 --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/header.go @@ -0,0 +1,358 @@ +package mail + +import ( + "crypto/rand" + "encoding/binary" + "errors" + "fmt" + "net/mail" + "os" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/emersion/go-message" +) + +const dateLayout = "Mon, 02 Jan 2006 15:04:05 -0700" + +type headerParser struct { + s string +} + +func (p *headerParser) len() int { + return len(p.s) +} + +func (p *headerParser) empty() bool { + return p.len() == 0 +} + +func (p *headerParser) peek() byte { + return p.s[0] +} + +func (p *headerParser) consume(c byte) bool { + if p.empty() || p.peek() != c { + return false + } + p.s = p.s[1:] + return true +} + +// skipSpace skips the leading space and tab characters. +func (p *headerParser) skipSpace() { + p.s = strings.TrimLeft(p.s, " \t") +} + +// skipCFWS skips CFWS as defined in RFC5322. It returns false if the CFWS is +// malformed. +func (p *headerParser) skipCFWS() bool { + p.skipSpace() + + for { + if !p.consume('(') { + break + } + + if _, ok := p.consumeComment(); !ok { + return false + } + + p.skipSpace() + } + + return true +} + +func (p *headerParser) consumeComment() (string, bool) { + // '(' already consumed. + depth := 1 + + var comment string + for { + if p.empty() || depth == 0 { + break + } + + if p.peek() == '\\' && p.len() > 1 { + p.s = p.s[1:] + } else if p.peek() == '(' { + depth++ + } else if p.peek() == ')' { + depth-- + } + + if depth > 0 { + comment += p.s[:1] + } + + p.s = p.s[1:] + } + + return comment, depth == 0 +} + +func (p *headerParser) parseAtomText(dot bool) (string, error) { + i := 0 + for { + r, size := utf8.DecodeRuneInString(p.s[i:]) + if size == 1 && r == utf8.RuneError { + return "", fmt.Errorf("mail: invalid UTF-8 in atom-text: %q", p.s) + } else if size == 0 || !isAtext(r, dot) { + break + } + i += size + } + if i == 0 { + return "", errors.New("mail: invalid string") + } + + var atom string + atom, p.s = p.s[:i], p.s[i:] + return atom, nil +} + +func isAtext(r rune, dot bool) bool { + switch r { + case '.': + return dot + // RFC 5322 3.2.3 specials + case '(', ')', '[', ']', ';', '@', '\\', ',': + return false + case '<', '>', '"', ':': + return false + } + return isVchar(r) +} + +// isVchar reports whether r is an RFC 5322 VCHAR character. +func isVchar(r rune) bool { + // Visible (printing) characters + return '!' <= r && r <= '~' || isMultibyte(r) +} + +// isMultibyte reports whether r is a multi-byte UTF-8 character +// as supported by RFC 6532 +func isMultibyte(r rune) bool { + return r >= utf8.RuneSelf +} + +func (p *headerParser) parseNoFoldLiteral() (string, error) { + if !p.consume('[') { + return "", errors.New("mail: missing '[' in no-fold-literal") + } + + i := 0 + for { + r, size := utf8.DecodeRuneInString(p.s[i:]) + if size == 1 && r == utf8.RuneError { + return "", fmt.Errorf("mail: invalid UTF-8 in no-fold-literal: %q", p.s) + } else if size == 0 || !isDtext(r) { + break + } + i += size + } + var lit string + lit, p.s = p.s[:i], p.s[i:] + + if !p.consume(']') { + return "", errors.New("mail: missing ']' in no-fold-literal") + } + return "[" + lit + "]", nil +} + +func isDtext(r rune) bool { + switch r { + case '[', ']', '\\': + return false + } + return isVchar(r) +} + +func (p *headerParser) parseMsgID() (string, error) { + if !p.skipCFWS() { + return "", errors.New("mail: malformed parenthetical comment") + } + + if !p.consume('<') { + return "", errors.New("mail: missing '<' in msg-id") + } + + left, err := p.parseAtomText(true) + if err != nil { + return "", err + } + + if !p.consume('@') { + return "", errors.New("mail: missing '@' in msg-id") + } + + var right string + if !p.empty() && p.peek() == '[' { + // no-fold-literal + right, err = p.parseNoFoldLiteral() + } else { + right, err = p.parseAtomText(true) + if err != nil { + return "", err + } + } + + if !p.consume('>') { + return "", errors.New("mail: missing '>' in msg-id") + } + + if !p.skipCFWS() { + return "", errors.New("mail: malformed parenthetical comment") + } + + return left + "@" + right, nil +} + +// A Header is a mail header. +type Header struct { + message.Header +} + +// HeaderFromMap creates a header from a map of header fields. +// +// This function is provided for interoperability with the standard library. +// If possible, ReadHeader should be used instead to avoid loosing information. +// The map representation looses the ordering of the fields, the capitalization +// of the header keys, and the whitespace of the original header. +func HeaderFromMap(m map[string][]string) Header { + return Header{message.HeaderFromMap(m)} +} + +// AddressList parses the named header field as a list of addresses. If the +// header field is missing, it returns nil. +// +// This can be used on From, Sender, Reply-To, To, Cc and Bcc header fields. +func (h *Header) AddressList(key string) ([]*Address, error) { + v := h.Get(key) + if v == "" { + return nil, nil + } + return ParseAddressList(v) +} + +// SetAddressList formats the named header field to the provided list of +// addresses. +// +// This can be used on From, Sender, Reply-To, To, Cc and Bcc header fields. +func (h *Header) SetAddressList(key string, addrs []*Address) { + if len(addrs) > 0 { + h.Set(key, formatAddressList(addrs)) + } else { + h.Del(key) + } +} + +// Date parses the Date header field. +func (h *Header) Date() (time.Time, error) { + return mail.ParseDate(h.Get("Date")) +} + +// SetDate formats the Date header field. +func (h *Header) SetDate(t time.Time) { + h.Set("Date", t.Format(dateLayout)) +} + +// Subject parses the Subject header field. If there is an error, the raw field +// value is returned alongside the error. +func (h *Header) Subject() (string, error) { + return h.Text("Subject") +} + +// SetSubject formats the Subject header field. +func (h *Header) SetSubject(s string) { + h.SetText("Subject", s) +} + +// MessageID parses the Message-ID field. It returns the message identifier, +// without the angle brackets. If the message doesn't have a Message-ID header +// field, it returns an empty string. +func (h *Header) MessageID() (string, error) { + v := h.Get("Message-Id") + if v == "" { + return "", nil + } + + p := headerParser{v} + return p.parseMsgID() +} + +// MsgIDList parses a list of message identifiers. It returns message +// identifiers without angle brackets. If the header field is missing, it +// returns nil. +// +// This can be used on In-Reply-To and References header fields. +func (h *Header) MsgIDList(key string) ([]string, error) { + v := h.Get(key) + if v == "" { + return nil, nil + } + + p := headerParser{v} + var l []string + for !p.empty() { + msgID, err := p.parseMsgID() + if err != nil { + return l, err + } + l = append(l, msgID) + } + + return l, nil +} + +// GenerateMessageID generates an RFC 2822-compliant Message-Id based on the +// informational draft "Recommendations for generating Message IDs", for lack +// of a better authoritative source. +func (h *Header) GenerateMessageID() error { + now := uint64(time.Now().UnixNano()) + + nonceByte := make([]byte, 8) + if _, err := rand.Read(nonceByte); err != nil { + return err + } + nonce := binary.BigEndian.Uint64(nonceByte) + + hostname, err := os.Hostname() + if err != nil { + return err + } + + msgID := fmt.Sprintf("%s.%s@%s", base36(now), base36(nonce), hostname) + h.SetMessageID(msgID) + return nil +} + +func base36(input uint64) string { + return strings.ToUpper(strconv.FormatUint(input, 36)) +} + +// SetMessageID sets the Message-ID field. id is the message identifier, +// without the angle brackets. +func (h *Header) SetMessageID(id string) { + h.Set("Message-Id", "<"+id+">") +} + +// SetMsgIDList formats a list of message identifiers. Message identifiers +// don't include angle brackets. +// +// This can be used on In-Reply-To and References header fields. +func (h *Header) SetMsgIDList(key string, l []string) { + if len(l) > 0 { + h.Set(key, "<"+strings.Join(l, "> <")+">") + } else { + h.Del(key) + } +} + +// Copy creates a stand-alone copy of the header. +func (h *Header) Copy() Header { + return Header{h.Header.Copy()} +} diff --git a/vendor/github.com/emersion/go-message/mail/inline.go b/vendor/github.com/emersion/go-message/mail/inline.go new file mode 100644 index 00000000..2aadfdca --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/inline.go @@ -0,0 +1,10 @@ +package mail + +import ( + "github.com/emersion/go-message" +) + +// A InlineHeader represents a message text header. +type InlineHeader struct { + message.Header +} diff --git a/vendor/github.com/emersion/go-message/mail/mail.go b/vendor/github.com/emersion/go-message/mail/mail.go new file mode 100644 index 00000000..2f9a12c9 --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/mail.go @@ -0,0 +1,9 @@ +// Package mail implements reading and writing mail messages. +// +// This package assumes that a mail message contains one or more text parts and +// zero or more attachment parts. Each text part represents a different version +// of the message content (e.g. a different type, a different language and so +// on). +// +// RFC 5322 defines the Internet Message Format. +package mail diff --git a/vendor/github.com/emersion/go-message/mail/reader.go b/vendor/github.com/emersion/go-message/mail/reader.go new file mode 100644 index 00000000..f721a452 --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/reader.go @@ -0,0 +1,130 @@ +package mail + +import ( + "container/list" + "io" + "strings" + + "github.com/emersion/go-message" +) + +// A PartHeader is a mail part header. It contains convenience functions to get +// and set header fields. +type PartHeader interface { + // Add adds the key, value pair to the header. + Add(key, value string) + // Del deletes the values associated with key. + Del(key string) + // Get gets the first value associated with the given key. If there are no + // values associated with the key, Get returns "". + Get(key string) string + // Set sets the header entries associated with key to the single element + // value. It replaces any existing values associated with key. + Set(key, value string) +} + +// A Part is either a mail text or an attachment. Header is either a InlineHeader +// or an AttachmentHeader. +type Part struct { + Header PartHeader + Body io.Reader +} + +// A Reader reads a mail message. +type Reader struct { + Header Header + + e *message.Entity + readers *list.List +} + +// NewReader creates a new mail reader. +func NewReader(e *message.Entity) *Reader { + mr := e.MultipartReader() + if mr == nil { + // Artificially create a multipart entity + // With this header, no error will be returned by message.NewMultipart + var h message.Header + h.Set("Content-Type", "multipart/mixed") + me, _ := message.NewMultipart(h, []*message.Entity{e}) + mr = me.MultipartReader() + } + + l := list.New() + l.PushBack(mr) + + return &Reader{Header{e.Header}, e, l} +} + +// CreateReader reads a mail header from r and returns a new mail reader. +// +// If the message uses an unknown transfer encoding or charset, CreateReader +// returns an error that verifies message.IsUnknownCharset, but also returns a +// Reader that can be used. +func CreateReader(r io.Reader) (*Reader, error) { + e, err := message.Read(r) + if err != nil && !message.IsUnknownCharset(err) { + return nil, err + } + + return NewReader(e), err +} + +// NextPart returns the next mail part. If there is no more part, io.EOF is +// returned as error. +// +// The returned Part.Body must be read completely before the next call to +// NextPart, otherwise it will be discarded. +// +// If the part uses an unknown transfer encoding or charset, NextPart returns an +// error that verifies message.IsUnknownCharset, but also returns a Part that +// can be used. +func (r *Reader) NextPart() (*Part, error) { + for r.readers.Len() > 0 { + e := r.readers.Back() + mr := e.Value.(message.MultipartReader) + + p, err := mr.NextPart() + if err == io.EOF { + // This whole multipart entity has been read, continue with the next one + r.readers.Remove(e) + continue + } else if err != nil && !message.IsUnknownCharset(err) { + return nil, err + } + + if pmr := p.MultipartReader(); pmr != nil { + // This is a multipart part, read it + r.readers.PushBack(pmr) + } else { + // This is a non-multipart part, return a mail part + mp := &Part{Body: p.Body} + t, _, _ := p.Header.ContentType() + disp, _, _ := p.Header.ContentDisposition() + if disp == "inline" || (disp != "attachment" && strings.HasPrefix(t, "text/")) { + mp.Header = &InlineHeader{p.Header} + } else { + mp.Header = &AttachmentHeader{p.Header} + } + return mp, err + } + } + + return nil, io.EOF +} + +// Close finishes the reader. +func (r *Reader) Close() error { + for r.readers.Len() > 0 { + e := r.readers.Back() + mr := e.Value.(message.MultipartReader) + + if err := mr.Close(); err != nil { + return err + } + + r.readers.Remove(e) + } + + return nil +} diff --git a/vendor/github.com/emersion/go-message/mail/writer.go b/vendor/github.com/emersion/go-message/mail/writer.go new file mode 100644 index 00000000..6e6a0d24 --- /dev/null +++ b/vendor/github.com/emersion/go-message/mail/writer.go @@ -0,0 +1,132 @@ +package mail + +import ( + "io" + "strings" + + "github.com/emersion/go-message" +) + +func initInlineContentTransferEncoding(h *message.Header) { + if !h.Has("Content-Transfer-Encoding") { + t, _, _ := h.ContentType() + if strings.HasPrefix(t, "text/") { + h.Set("Content-Transfer-Encoding", "quoted-printable") + } else { + h.Set("Content-Transfer-Encoding", "base64") + } + } +} + +func initInlineHeader(h *InlineHeader) { + h.Set("Content-Disposition", "inline") + initInlineContentTransferEncoding(&h.Header) +} + +func initAttachmentHeader(h *AttachmentHeader) { + disp, _, _ := h.ContentDisposition() + if disp != "attachment" { + h.Set("Content-Disposition", "attachment") + } + if !h.Has("Content-Transfer-Encoding") { + h.Set("Content-Transfer-Encoding", "base64") + } +} + +// A Writer writes a mail message. A mail message contains one or more text +// parts and zero or more attachments. +type Writer struct { + mw *message.Writer +} + +// CreateWriter writes a mail header to w and creates a new Writer. +func CreateWriter(w io.Writer, header Header) (*Writer, error) { + header = header.Copy() // don't modify the caller's view + header.Set("Content-Type", "multipart/mixed") + + mw, err := message.CreateWriter(w, header.Header) + if err != nil { + return nil, err + } + + return &Writer{mw}, nil +} + +// CreateInlineWriter writes a mail header to w. The mail will contain an +// inline part, allowing to represent the same text in different formats. +// Attachments cannot be included. +func CreateInlineWriter(w io.Writer, header Header) (*InlineWriter, error) { + header = header.Copy() // don't modify the caller's view + header.Set("Content-Type", "multipart/alternative") + + mw, err := message.CreateWriter(w, header.Header) + if err != nil { + return nil, err + } + + return &InlineWriter{mw}, nil +} + +// CreateSingleInlineWriter writes a mail header to w. The mail will contain a +// single inline part. The body of the part should be written to the returned +// io.WriteCloser. Only one single inline part should be written, use +// CreateWriter if you want multiple parts. +func CreateSingleInlineWriter(w io.Writer, header Header) (io.WriteCloser, error) { + header = header.Copy() // don't modify the caller's view + initInlineContentTransferEncoding(&header.Header) + return message.CreateWriter(w, header.Header) +} + +// CreateInline creates a InlineWriter. One or more parts representing the same +// text in different formats can be written to a InlineWriter. +func (w *Writer) CreateInline() (*InlineWriter, error) { + var h message.Header + h.Set("Content-Type", "multipart/alternative") + + mw, err := w.mw.CreatePart(h) + if err != nil { + return nil, err + } + return &InlineWriter{mw}, nil +} + +// CreateSingleInline creates a new single text part with the provided header. +// The body of the part should be written to the returned io.WriteCloser. Only +// one single text part should be written, use CreateInline if you want multiple +// text parts. +func (w *Writer) CreateSingleInline(h InlineHeader) (io.WriteCloser, error) { + h = InlineHeader{h.Header.Copy()} // don't modify the caller's view + initInlineHeader(&h) + return w.mw.CreatePart(h.Header) +} + +// CreateAttachment creates a new attachment with the provided header. The body +// of the part should be written to the returned io.WriteCloser. +func (w *Writer) CreateAttachment(h AttachmentHeader) (io.WriteCloser, error) { + h = AttachmentHeader{h.Header.Copy()} // don't modify the caller's view + initAttachmentHeader(&h) + return w.mw.CreatePart(h.Header) +} + +// Close finishes the Writer. +func (w *Writer) Close() error { + return w.mw.Close() +} + +// InlineWriter writes a mail message's text. +type InlineWriter struct { + mw *message.Writer +} + +// CreatePart creates a new text part with the provided header. The body of the +// part should be written to the returned io.WriteCloser. +func (w *InlineWriter) CreatePart(h InlineHeader) (io.WriteCloser, error) { + h = InlineHeader{h.Header.Copy()} // don't modify the caller's view + initInlineHeader(&h) + return w.mw.CreatePart(h.Header) +} + +// Close finishes the InlineWriter. +func (w *InlineWriter) Close() error { + return w.mw.Close() +} diff --git a/vendor/github.com/emersion/go-message/message.go b/vendor/github.com/emersion/go-message/message.go new file mode 100644 index 00000000..c570df70 --- /dev/null +++ b/vendor/github.com/emersion/go-message/message.go @@ -0,0 +1,12 @@ +// Package message implements reading and writing multipurpose messages. +// +// RFC 2045, RFC 2046 and RFC 2047 defines MIME, and RFC 2183 defines the +// Content-Disposition header field. +// +// Add this import to your package if you want to handle most common charsets +// by default: +// +// import ( +// _ "github.com/emersion/go-message/charset" +// ) +package message diff --git a/vendor/github.com/emersion/go-message/multipart.go b/vendor/github.com/emersion/go-message/multipart.go new file mode 100644 index 00000000..c406a311 --- /dev/null +++ b/vendor/github.com/emersion/go-message/multipart.go @@ -0,0 +1,116 @@ +package message + +import ( + "io" + + "github.com/emersion/go-message/textproto" +) + +// MultipartReader is an iterator over parts in a MIME multipart body. +type MultipartReader interface { + io.Closer + + // NextPart returns the next part in the multipart or an error. When there are + // no more parts, the error io.EOF is returned. + // + // Entity.Body must be read completely before the next call to NextPart, + // otherwise it will be discarded. + NextPart() (*Entity, error) +} + +type multipartReader struct { + r *textproto.MultipartReader +} + +// NextPart implements MultipartReader. +func (r *multipartReader) NextPart() (*Entity, error) { + p, err := r.r.NextPart() + if err != nil { + return nil, err + } + return New(Header{p.Header}, p) +} + +// Close implements io.Closer. +func (r *multipartReader) Close() error { + return nil +} + +type multipartBody struct { + header Header + parts []*Entity + + r *io.PipeReader + w *Writer + + i int +} + +// Read implements io.Reader. +func (m *multipartBody) Read(p []byte) (n int, err error) { + if m.r == nil { + r, w := io.Pipe() + m.r = r + + var err error + m.w, err = createWriter(w, &m.header) + if err != nil { + return 0, err + } + + // Prevent calls to NextPart to succeed + m.i = len(m.parts) + + go func() { + if err := m.writeBodyTo(m.w); err != nil { + w.CloseWithError(err) + return + } + + if err := m.w.Close(); err != nil { + w.CloseWithError(err) + return + } + + w.Close() + }() + } + + return m.r.Read(p) +} + +// Close implements io.Closer. +func (m *multipartBody) Close() error { + if m.r != nil { + m.r.Close() + } + return nil +} + +// NextPart implements MultipartReader. +func (m *multipartBody) NextPart() (*Entity, error) { + if m.i >= len(m.parts) { + return nil, io.EOF + } + + part := m.parts[m.i] + m.i++ + return part, nil +} + +func (m *multipartBody) writeBodyTo(w *Writer) error { + for _, p := range m.parts { + pw, err := w.CreatePart(p.Header) + if err != nil { + return err + } + + if err := p.writeBodyTo(pw); err != nil { + return err + } + if err := pw.Close(); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/emersion/go-message/textproto/header.go b/vendor/github.com/emersion/go-message/textproto/header.go new file mode 100644 index 00000000..10c04f31 --- /dev/null +++ b/vendor/github.com/emersion/go-message/textproto/header.go @@ -0,0 +1,677 @@ +package textproto + +import ( + "bufio" + "bytes" + "fmt" + "io" + "net/textproto" + "sort" + "strings" +) + +type headerField struct { + b []byte // Raw header field, including whitespace + + k string + v string +} + +func newHeaderField(k, v string, b []byte) *headerField { + return &headerField{k: textproto.CanonicalMIMEHeaderKey(k), v: v, b: b} +} + +func (f *headerField) raw() ([]byte, error) { + if f.b != nil { + return f.b, nil + } else { + for pos, ch := range f.k { + // check if character is a printable US-ASCII except ':' + if !(ch >= '!' && ch < ':' || ch > ':' && ch <= '~') { + return nil, fmt.Errorf("field name contains incorrect symbols (\\x%x at %v)", ch, pos) + } + } + + if pos := strings.IndexAny(f.v, "\r\n"); pos != -1 { + return nil, fmt.Errorf("field value contains \\r\\n (at %v)", pos) + } + + return []byte(formatHeaderField(f.k, f.v)), nil + } +} + +// A Header represents the key-value pairs in a message header. +// +// The header representation is idempotent: if the header can be read and +// written, the result will be exactly the same as the original (including +// whitespace and header field ordering). This is required for e.g. DKIM. +// +// Mutating the header is restricted: the only two allowed operations are +// inserting a new header field at the top and deleting a header field. This is +// again necessary for DKIM. +type Header struct { + // Fields are in reverse order so that inserting a new field at the top is + // cheap. + l []*headerField + m map[string][]*headerField +} + +func makeHeaderMap(fs []*headerField) map[string][]*headerField { + if len(fs) == 0 { + return nil + } + + m := make(map[string][]*headerField, len(fs)) + for i, f := range fs { + m[f.k] = append(m[f.k], fs[i]) + } + return m +} + +func newHeader(fs []*headerField) Header { + // Reverse order + for i := len(fs)/2 - 1; i >= 0; i-- { + opp := len(fs) - 1 - i + fs[i], fs[opp] = fs[opp], fs[i] + } + + return Header{l: fs, m: makeHeaderMap(fs)} +} + +// HeaderFromMap creates a header from a map of header fields. +// +// This function is provided for interoperability with the standard library. +// If possible, ReadHeader should be used instead to avoid loosing information. +// The map representation looses the ordering of the fields, the capitalization +// of the header keys, and the whitespace of the original header. +func HeaderFromMap(m map[string][]string) Header { + fs := make([]*headerField, 0, len(m)) + for k, vs := range m { + for _, v := range vs { + fs = append(fs, newHeaderField(k, v, nil)) + } + } + + sort.SliceStable(fs, func(i, j int) bool { + return fs[i].k < fs[j].k + }) + + return newHeader(fs) +} + +// AddRaw adds the raw key, value pair to the header. +// +// The supplied byte slice should be a complete field in the "Key: Value" form +// including trailing CRLF. If there is no comma in the input - AddRaw panics. +// No changes are made to kv contents and it will be copied into WriteHeader +// output as is. +// +// kv is directly added to the underlying structure and therefore should not be +// modified after the AddRaw call. +func (h *Header) AddRaw(kv []byte) { + colon := bytes.IndexByte(kv, ':') + if colon == -1 { + panic("textproto: Header.AddRaw: missing colon") + } + k := textproto.CanonicalMIMEHeaderKey(string(trim(kv[:colon]))) + v := trimAroundNewlines(kv[colon+1:]) + + if h.m == nil { + h.m = make(map[string][]*headerField) + } + + f := newHeaderField(k, v, kv) + h.l = append(h.l, f) + h.m[k] = append(h.m[k], f) +} + +// Add adds the key, value pair to the header. It prepends to any existing +// fields associated with key. +// +// Key and value should obey character requirements of RFC 6532. +// If you need to format or fold lines manually, use AddRaw. +func (h *Header) Add(k, v string) { + k = textproto.CanonicalMIMEHeaderKey(k) + + if h.m == nil { + h.m = make(map[string][]*headerField) + } + + f := newHeaderField(k, v, nil) + h.l = append(h.l, f) + h.m[k] = append(h.m[k], f) +} + +// Get gets the first value associated with the given key. If there are no +// values associated with the key, Get returns "". +func (h *Header) Get(k string) string { + fields := h.m[textproto.CanonicalMIMEHeaderKey(k)] + if len(fields) == 0 { + return "" + } + return fields[len(fields)-1].v +} + +// Raw gets the first raw header field associated with the given key. +// +// The returned bytes contain a complete field in the "Key: value" form, +// including trailing CRLF. +// +// The returned slice should not be modified and becomes invalid when the +// header is updated. +// +// An error is returned if the header field contains incorrect characters (see +// RFC 6532). +func (h *Header) Raw(k string) ([]byte, error) { + fields := h.m[textproto.CanonicalMIMEHeaderKey(k)] + if len(fields) == 0 { + return nil, nil + } + return fields[len(fields)-1].raw() +} + +// Values returns all values associated with the given key. +// +// The returned slice should not be modified and becomes invalid when the +// header is updated. +func (h *Header) Values(k string) []string { + fields := h.m[textproto.CanonicalMIMEHeaderKey(k)] + if len(fields) == 0 { + return nil + } + l := make([]string, len(fields)) + for i, field := range fields { + l[len(fields)-i-1] = field.v + } + return l +} + +// Set sets the header fields associated with key to the single field value. +// It replaces any existing values associated with key. +func (h *Header) Set(k, v string) { + h.Del(k) + h.Add(k, v) +} + +// Del deletes the values associated with key. +func (h *Header) Del(k string) { + k = textproto.CanonicalMIMEHeaderKey(k) + + delete(h.m, k) + + // Delete existing keys + for i := len(h.l) - 1; i >= 0; i-- { + if h.l[i].k == k { + h.l = append(h.l[:i], h.l[i+1:]...) + } + } +} + +// Has checks whether the header has a field with the specified key. +func (h *Header) Has(k string) bool { + _, ok := h.m[textproto.CanonicalMIMEHeaderKey(k)] + return ok +} + +// Copy creates an independent copy of the header. +func (h *Header) Copy() Header { + l := make([]*headerField, len(h.l)) + copy(l, h.l) + m := makeHeaderMap(l) + return Header{l: l, m: m} +} + +// Len returns the number of fields in the header. +func (h *Header) Len() int { + return len(h.l) +} + +// Map returns all header fields as a map. +// +// This function is provided for interoperability with the standard library. +// If possible, Fields should be used instead to avoid loosing information. +// The map representation looses the ordering of the fields, the capitalization +// of the header keys, and the whitespace of the original header. +func (h *Header) Map() map[string][]string { + m := make(map[string][]string, h.Len()) + fields := h.Fields() + for fields.Next() { + m[fields.Key()] = append(m[fields.Key()], fields.Value()) + } + return m +} + +// HeaderFields iterates over header fields. Its cursor starts before the first +// field of the header. Use Next to advance from field to field. +type HeaderFields interface { + // Next advances to the next header field. It returns true on success, or + // false if there is no next field. + Next() (more bool) + // Key returns the key of the current field. + Key() string + // Value returns the value of the current field. + Value() string + // Raw returns the raw current header field. See Header.Raw. + Raw() ([]byte, error) + // Del deletes the current field. + Del() + // Len returns the amount of header fields in the subset of header iterated + // by this HeaderFields instance. + // + // For Fields(), it will return the amount of fields in the whole header section. + // For FieldsByKey(), it will return the amount of fields with certain key. + Len() int +} + +type headerFields struct { + h *Header + cur int +} + +func (fs *headerFields) Next() bool { + fs.cur++ + return fs.cur < len(fs.h.l) +} + +func (fs *headerFields) index() int { + if fs.cur < 0 { + panic("message: HeaderFields method called before Next") + } + if fs.cur >= len(fs.h.l) { + panic("message: HeaderFields method called after Next returned false") + } + return len(fs.h.l) - fs.cur - 1 +} + +func (fs *headerFields) field() *headerField { + return fs.h.l[fs.index()] +} + +func (fs *headerFields) Key() string { + return fs.field().k +} + +func (fs *headerFields) Value() string { + return fs.field().v +} + +func (fs *headerFields) Raw() ([]byte, error) { + return fs.field().raw() +} + +func (fs *headerFields) Del() { + f := fs.field() + + ok := false + for i, ff := range fs.h.m[f.k] { + if ff == f { + ok = true + fs.h.m[f.k] = append(fs.h.m[f.k][:i], fs.h.m[f.k][i+1:]...) + if len(fs.h.m[f.k]) == 0 { + delete(fs.h.m, f.k) + } + break + } + } + if !ok { + panic("message: field not found in Header.m") + } + + fs.h.l = append(fs.h.l[:fs.index()], fs.h.l[fs.index()+1:]...) + fs.cur-- +} + +func (fs *headerFields) Len() int { + return len(fs.h.l) +} + +// Fields iterates over all the header fields. +// +// The header may not be mutated while iterating, except using HeaderFields.Del. +func (h *Header) Fields() HeaderFields { + return &headerFields{h, -1} +} + +type headerFieldsByKey struct { + h *Header + k string + cur int +} + +func (fs *headerFieldsByKey) Next() bool { + fs.cur++ + return fs.cur < len(fs.h.m[fs.k]) +} + +func (fs *headerFieldsByKey) index() int { + if fs.cur < 0 { + panic("message: headerfields.key or value called before next") + } + if fs.cur >= len(fs.h.m[fs.k]) { + panic("message: headerfields.key or value called after next returned false") + } + return len(fs.h.m[fs.k]) - fs.cur - 1 +} + +func (fs *headerFieldsByKey) field() *headerField { + return fs.h.m[fs.k][fs.index()] +} + +func (fs *headerFieldsByKey) Key() string { + return fs.field().k +} + +func (fs *headerFieldsByKey) Value() string { + return fs.field().v +} + +func (fs *headerFieldsByKey) Raw() ([]byte, error) { + return fs.field().raw() +} + +func (fs *headerFieldsByKey) Del() { + f := fs.field() + + ok := false + for i := range fs.h.l { + if f == fs.h.l[i] { + ok = true + fs.h.l = append(fs.h.l[:i], fs.h.l[i+1:]...) + break + } + } + if !ok { + panic("message: field not found in Header.l") + } + + fs.h.m[fs.k] = append(fs.h.m[fs.k][:fs.index()], fs.h.m[fs.k][fs.index()+1:]...) + if len(fs.h.m[fs.k]) == 0 { + delete(fs.h.m, fs.k) + } + fs.cur-- +} + +func (fs *headerFieldsByKey) Len() int { + return len(fs.h.m[fs.k]) +} + +// FieldsByKey iterates over all fields having the specified key. +// +// The header may not be mutated while iterating, except using HeaderFields.Del. +func (h *Header) FieldsByKey(k string) HeaderFields { + return &headerFieldsByKey{h, textproto.CanonicalMIMEHeaderKey(k), -1} +} + +func readLineSlice(r *bufio.Reader, line []byte) ([]byte, error) { + for { + l, more, err := r.ReadLine() + line = append(line, l...) + if err != nil { + return line, err + } + + if !more { + break + } + } + + return line, nil +} + +func isSpace(c byte) bool { + return c == ' ' || c == '\t' +} + +func validHeaderKeyByte(b byte) bool { + c := int(b) + return c >= 33 && c <= 126 && c != ':' +} + +// trim returns s with leading and trailing spaces and tabs removed. +// It does not assume Unicode or UTF-8. +func trim(s []byte) []byte { + i := 0 + for i < len(s) && isSpace(s[i]) { + i++ + } + n := len(s) + for n > i && isSpace(s[n-1]) { + n-- + } + return s[i:n] +} + +func hasContinuationLine(r *bufio.Reader) bool { + c, err := r.ReadByte() + if err != nil { + return false // bufio will keep err until next read. + } + r.UnreadByte() + return isSpace(c) +} + +func readContinuedLineSlice(r *bufio.Reader) ([]byte, error) { + // Read the first line. We preallocate slice that it enough + // for most fields. + line, err := readLineSlice(r, make([]byte, 0, 256)) + if err == io.EOF && len(line) == 0 { + // Header without a body + return nil, nil + } else if err != nil { + return nil, err + } + + if len(line) == 0 { // blank line - no continuation + return line, nil + } + + line = append(line, '\r', '\n') + + // Read continuation lines. + for hasContinuationLine(r) { + line, err = readLineSlice(r, line) + if err != nil { + break // bufio will keep err until next read. + } + + line = append(line, '\r', '\n') + } + + return line, nil +} + +func writeContinued(b *strings.Builder, l []byte) { + // Strip trailing \r, if any + if len(l) > 0 && l[len(l)-1] == '\r' { + l = l[:len(l)-1] + } + l = trim(l) + if len(l) == 0 { + return + } + if b.Len() > 0 { + b.WriteByte(' ') + } + b.Write(l) +} + +// Strip newlines and spaces around newlines. +func trimAroundNewlines(v []byte) string { + var b strings.Builder + b.Grow(len(v)) + for { + i := bytes.IndexByte(v, '\n') + if i < 0 { + writeContinued(&b, v) + break + } + writeContinued(&b, v[:i]) + v = v[i+1:] + } + + return b.String() +} + +// ReadHeader reads a MIME header from r. The header is a sequence of possibly +// continued "Key: Value" lines ending in a blank line. +// +// To avoid denial of service attacks, the provided bufio.Reader should be +// reading from an io.LimitedReader or a similar Reader to bound the size of +// headers. +func ReadHeader(r *bufio.Reader) (Header, error) { + fs := make([]*headerField, 0, 32) + + // The first line cannot start with a leading space. + if buf, err := r.Peek(1); err == nil && isSpace(buf[0]) { + line, err := readLineSlice(r, nil) + if err != nil { + return newHeader(fs), err + } + + return newHeader(fs), fmt.Errorf("message: malformed MIME header initial line: %v", string(line)) + } + + for { + kv, err := readContinuedLineSlice(r) + if len(kv) == 0 { + return newHeader(fs), err + } + + // Key ends at first colon; should not have trailing spaces but they + // appear in the wild, violating specs, so we remove them if present. + i := bytes.IndexByte(kv, ':') + if i < 0 { + return newHeader(fs), fmt.Errorf("message: malformed MIME header line: %v", string(kv)) + } + + keyBytes := trim(kv[:i]) + + // Verify that there are no invalid characters in the header key. + // See RFC 5322 Section 2.2 + for _, c := range keyBytes { + if !validHeaderKeyByte(c) { + return newHeader(fs), fmt.Errorf("message: malformed MIME header key: %v", string(keyBytes)) + } + } + + key := textproto.CanonicalMIMEHeaderKey(string(keyBytes)) + + // As per RFC 7230 field-name is a token, tokens consist of one or more + // chars. We could return a an error here, but better to be liberal in + // what we accept, so if we get an empty key, skip it. + if key == "" { + continue + } + + i++ // skip colon + v := kv[i:] + + value := trimAroundNewlines(v) + fs = append(fs, newHeaderField(key, value, kv)) + + if err != nil { + return newHeader(fs), err + } + } +} + +func foldLine(v string, maxlen int) (line, next string, ok bool) { + ok = true + + // We'll need to fold before maxlen + foldBefore := maxlen + 1 + foldAt := len(v) + + var folding string + if foldBefore > len(v) { + // We reached the end of the string + if v[len(v)-1] != '\n' { + // If there isn't already a trailing CRLF, insert one + folding = "\r\n" + } + } else { + // Find the closest whitespace before maxlen + foldAt = strings.LastIndexAny(v[:foldBefore], " \t\n") + + if foldAt == 0 { + // The whitespace we found was the previous folding WSP + foldAt = foldBefore - 1 + } else if foldAt < 0 { + // We didn't find any whitespace, we have to insert one + foldAt = foldBefore - 2 + } + + switch v[foldAt] { + case ' ', '\t': + if v[foldAt-1] != '\n' { + folding = "\r\n" // The next char will be a WSP, don't need to insert one + } + case '\n': + folding = "" // There is already a CRLF, nothing to do + default: + // Another char, we need to insert CRLF + WSP. This will insert an + // extra space in the string, so this should be avoided if + // possible. + folding = "\r\n " + ok = false + } + } + + return v[:foldAt] + folding, v[foldAt:], ok +} + +const ( + preferredHeaderLen = 76 + maxHeaderLen = 998 +) + +// formatHeaderField formats a header field, ensuring each line is no longer +// than 76 characters. It tries to fold lines at whitespace characters if +// possible. If the header contains a word longer than this limit, it will be +// split. +func formatHeaderField(k, v string) string { + s := k + ": " + + if v == "" { + return s + "\r\n" + } + + first := true + for len(v) > 0 { + // If this is the first line, substract the length of the key + keylen := 0 + if first { + keylen = len(s) + } + + // First try with a soft limit + l, next, ok := foldLine(v, preferredHeaderLen-keylen) + if !ok { + // Folding failed to preserve the original header field value. Try + // with a larger, hard limit. + l, next, _ = foldLine(v, maxHeaderLen-keylen) + } + v = next + s += l + first = false + } + + return s +} + +// WriteHeader writes a MIME header to w. +func WriteHeader(w io.Writer, h Header) error { + for i := len(h.l) - 1; i >= 0; i-- { + f := h.l[i] + if rawField, err := f.raw(); err == nil { + if _, err := w.Write(rawField); err != nil { + return err + } + } else { + return fmt.Errorf("failed to write header field #%v (%q): %w", len(h.l)-i, f.k, err) + } + } + + _, err := w.Write([]byte{'\r', '\n'}) + return err +} diff --git a/vendor/github.com/emersion/go-message/textproto/multipart.go b/vendor/github.com/emersion/go-message/textproto/multipart.go new file mode 100644 index 00000000..7b72ee3d --- /dev/null +++ b/vendor/github.com/emersion/go-message/textproto/multipart.go @@ -0,0 +1,473 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// + +package textproto + +// Multipart is defined in RFC 2046. + +import ( + "bufio" + "bytes" + "crypto/rand" + "errors" + "fmt" + "io" + "io/ioutil" +) + +var emptyParams = make(map[string]string) + +// This constant needs to be at least 76 for this package to work correctly. +// This is because \r\n--separator_of_len_70- would fill the buffer and it +// wouldn't be safe to consume a single byte from it. +const peekBufferSize = 4096 + +// A Part represents a single part in a multipart body. +type Part struct { + Header Header + + mr *MultipartReader + + // r is either a reader directly reading from mr + r io.Reader + + n int // known data bytes waiting in mr.bufReader + total int64 // total data bytes read already + err error // error to return when n == 0 + readErr error // read error observed from mr.bufReader +} + +// NewMultipartReader creates a new multipart reader reading from r using the +// given MIME boundary. +// +// The boundary is usually obtained from the "boundary" parameter of +// the message's "Content-Type" header. Use mime.ParseMediaType to +// parse such headers. +func NewMultipartReader(r io.Reader, boundary string) *MultipartReader { + b := []byte("\r\n--" + boundary + "--") + return &MultipartReader{ + bufReader: bufio.NewReaderSize(&stickyErrorReader{r: r}, peekBufferSize), + nl: b[:2], + nlDashBoundary: b[:len(b)-2], + dashBoundaryDash: b[2:], + dashBoundary: b[2 : len(b)-2], + } +} + +// stickyErrorReader is an io.Reader which never calls Read on its +// underlying Reader once an error has been seen. (the io.Reader +// interface's contract promises nothing about the return values of +// Read calls after an error, yet this package does do multiple Reads +// after error) +type stickyErrorReader struct { + r io.Reader + err error +} + +func (r *stickyErrorReader) Read(p []byte) (n int, _ error) { + if r.err != nil { + return 0, r.err + } + n, r.err = r.r.Read(p) + return n, r.err +} + +func newPart(mr *MultipartReader) (*Part, error) { + bp := &Part{mr: mr} + if err := bp.populateHeaders(); err != nil { + return nil, err + } + bp.r = partReader{bp} + return bp, nil +} + +func (bp *Part) populateHeaders() error { + header, err := ReadHeader(bp.mr.bufReader) + if err == nil { + bp.Header = header + } + return err +} + +// Read reads the body of a part, after its headers and before the +// next part (if any) begins. +func (p *Part) Read(d []byte) (n int, err error) { + return p.r.Read(d) +} + +// partReader implements io.Reader by reading raw bytes directly from the +// wrapped *Part, without doing any Transfer-Encoding decoding. +type partReader struct { + p *Part +} + +func (pr partReader) Read(d []byte) (int, error) { + p := pr.p + br := p.mr.bufReader + + // Read into buffer until we identify some data to return, + // or we find a reason to stop (boundary or read error). + for p.n == 0 && p.err == nil { + peek, _ := br.Peek(br.Buffered()) + p.n, p.err = scanUntilBoundary(peek, p.mr.dashBoundary, p.mr.nlDashBoundary, p.total, p.readErr) + if p.n == 0 && p.err == nil { + // Force buffered I/O to read more into buffer. + _, p.readErr = br.Peek(len(peek) + 1) + if p.readErr == io.EOF { + p.readErr = io.ErrUnexpectedEOF + } + } + } + + // Read out from "data to return" part of buffer. + if p.n == 0 { + return 0, p.err + } + n := len(d) + if n > p.n { + n = p.n + } + n, _ = br.Read(d[:n]) + p.total += int64(n) + p.n -= n + if p.n == 0 { + return n, p.err + } + return n, nil +} + +// scanUntilBoundary scans buf to identify how much of it can be safely +// returned as part of the Part body. +// dashBoundary is "--boundary". +// nlDashBoundary is "\r\n--boundary" or "\n--boundary", depending on what mode we are in. +// The comments below (and the name) assume "\n--boundary", but either is accepted. +// total is the number of bytes read out so far. If total == 0, then a leading "--boundary" is recognized. +// readErr is the read error, if any, that followed reading the bytes in buf. +// scanUntilBoundary returns the number of data bytes from buf that can be +// returned as part of the Part body and also the error to return (if any) +// once those data bytes are done. +func scanUntilBoundary(buf, dashBoundary, nlDashBoundary []byte, total int64, readErr error) (int, error) { + if total == 0 { + // At beginning of body, allow dashBoundary. + if bytes.HasPrefix(buf, dashBoundary) { + switch matchAfterPrefix(buf, dashBoundary, readErr) { + case -1: + return len(dashBoundary), nil + case 0: + return 0, nil + case +1: + return 0, io.EOF + } + } + if bytes.HasPrefix(dashBoundary, buf) { + return 0, readErr + } + } + + // Search for "\n--boundary". + if i := bytes.Index(buf, nlDashBoundary); i >= 0 { + switch matchAfterPrefix(buf[i:], nlDashBoundary, readErr) { + case -1: + return i + len(nlDashBoundary), nil + case 0: + return i, nil + case +1: + return i, io.EOF + } + } + if bytes.HasPrefix(nlDashBoundary, buf) { + return 0, readErr + } + + // Otherwise, anything up to the final \n is not part of the boundary + // and so must be part of the body. + // Also if the section from the final \n onward is not a prefix of the boundary, + // it too must be part of the body. + i := bytes.LastIndexByte(buf, nlDashBoundary[0]) + if i >= 0 && bytes.HasPrefix(nlDashBoundary, buf[i:]) { + return i, nil + } + return len(buf), readErr +} + +// matchAfterPrefix checks whether buf should be considered to match the boundary. +// The prefix is "--boundary" or "\r\n--boundary" or "\n--boundary", +// and the caller has verified already that bytes.HasPrefix(buf, prefix) is true. +// +// matchAfterPrefix returns +1 if the buffer does match the boundary, +// meaning the prefix is followed by a dash, space, tab, cr, nl, or end of input. +// It returns -1 if the buffer definitely does NOT match the boundary, +// meaning the prefix is followed by some other character. +// For example, "--foobar" does not match "--foo". +// It returns 0 more input needs to be read to make the decision, +// meaning that len(buf) == len(prefix) and readErr == nil. +func matchAfterPrefix(buf, prefix []byte, readErr error) int { + if len(buf) == len(prefix) { + if readErr != nil { + return +1 + } + return 0 + } + c := buf[len(prefix)] + if c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '-' { + return +1 + } + return -1 +} + +func (p *Part) Close() error { + io.Copy(ioutil.Discard, p) + return nil +} + +// MultipartReader is an iterator over parts in a MIME multipart body. +// MultipartReader's underlying parser consumes its input as needed. Seeking +// isn't supported. +type MultipartReader struct { + bufReader *bufio.Reader + + currentPart *Part + partsRead int + + nl []byte // "\r\n" or "\n" (set after seeing first boundary line) + nlDashBoundary []byte // nl + "--boundary" + dashBoundaryDash []byte // "--boundary--" + dashBoundary []byte // "--boundary" +} + +// NextPart returns the next part in the multipart or an error. +// When there are no more parts, the error io.EOF is returned. +func (r *MultipartReader) NextPart() (*Part, error) { + if r.currentPart != nil { + r.currentPart.Close() + } + if string(r.dashBoundary) == "--" { + return nil, fmt.Errorf("multipart: boundary is empty") + } + expectNewPart := false + for { + line, err := r.bufReader.ReadSlice('\n') + + if err == io.EOF && r.isFinalBoundary(line) { + // If the buffer ends in "--boundary--" without the + // trailing "\r\n", ReadSlice will return an error + // (since it's missing the '\n'), but this is a valid + // multipart EOF so we need to return io.EOF instead of + // a fmt-wrapped one. + return nil, io.EOF + } + if err != nil { + return nil, fmt.Errorf("multipart: NextPart: %v", err) + } + + if r.isBoundaryDelimiterLine(line) { + r.partsRead++ + bp, err := newPart(r) + if err != nil { + return nil, err + } + r.currentPart = bp + return bp, nil + } + + if r.isFinalBoundary(line) { + // Expected EOF + return nil, io.EOF + } + + if expectNewPart { + return nil, fmt.Errorf("multipart: expecting a new Part; got line %q", string(line)) + } + + if r.partsRead == 0 { + // skip line + continue + } + + // Consume the "\n" or "\r\n" separator between the + // body of the previous part and the boundary line we + // now expect will follow. (either a new part or the + // end boundary) + if bytes.Equal(line, r.nl) { + expectNewPart = true + continue + } + + return nil, fmt.Errorf("multipart: unexpected line in Next(): %q", line) + } +} + +// isFinalBoundary reports whether line is the final boundary line +// indicating that all parts are over. +// It matches `^--boundary--[ \t]*(\r\n)?$` +func (mr *MultipartReader) isFinalBoundary(line []byte) bool { + if !bytes.HasPrefix(line, mr.dashBoundaryDash) { + return false + } + rest := line[len(mr.dashBoundaryDash):] + rest = skipLWSPChar(rest) + return len(rest) == 0 || bytes.Equal(rest, mr.nl) +} + +func (mr *MultipartReader) isBoundaryDelimiterLine(line []byte) (ret bool) { + // https://tools.ietf.org/html/rfc2046#section-5.1 + // The boundary delimiter line is then defined as a line + // consisting entirely of two hyphen characters ("-", + // decimal value 45) followed by the boundary parameter + // value from the Content-Type header field, optional linear + // whitespace, and a terminating CRLF. + if !bytes.HasPrefix(line, mr.dashBoundary) { + return false + } + rest := line[len(mr.dashBoundary):] + rest = skipLWSPChar(rest) + + // On the first part, see our lines are ending in \n instead of \r\n + // and switch into that mode if so. This is a violation of the spec, + // but occurs in practice. + if mr.partsRead == 0 && len(rest) == 1 && rest[0] == '\n' { + mr.nl = mr.nl[1:] + mr.nlDashBoundary = mr.nlDashBoundary[1:] + } + return bytes.Equal(rest, mr.nl) +} + +// skipLWSPChar returns b with leading spaces and tabs removed. +// RFC 822 defines: +// LWSP-char = SPACE / HTAB +func skipLWSPChar(b []byte) []byte { + for len(b) > 0 && (b[0] == ' ' || b[0] == '\t') { + b = b[1:] + } + return b +} + +// A MultipartWriter generates multipart messages. +type MultipartWriter struct { + w io.Writer + boundary string + lastpart *part +} + +// NewMultipartWriter returns a new multipart Writer with a random boundary, +// writing to w. +func NewMultipartWriter(w io.Writer) *MultipartWriter { + return &MultipartWriter{ + w: w, + boundary: randomBoundary(), + } +} + +// Boundary returns the Writer's boundary. +func (w *MultipartWriter) Boundary() string { + return w.boundary +} + +// SetBoundary overrides the Writer's default randomly-generated +// boundary separator with an explicit value. +// +// SetBoundary must be called before any parts are created, may only +// contain certain ASCII characters, and must be non-empty and +// at most 70 bytes long. +func (w *MultipartWriter) SetBoundary(boundary string) error { + if w.lastpart != nil { + return errors.New("mime: SetBoundary called after write") + } + // rfc2046#section-5.1.1 + if len(boundary) < 1 || len(boundary) > 70 { + return errors.New("mime: invalid boundary length") + } + end := len(boundary) - 1 + for i, b := range boundary { + if 'A' <= b && b <= 'Z' || 'a' <= b && b <= 'z' || '0' <= b && b <= '9' { + continue + } + switch b { + case '\'', '(', ')', '+', '_', ',', '-', '.', '/', ':', '=', '?': + continue + case ' ': + if i != end { + continue + } + } + return errors.New("mime: invalid boundary character") + } + w.boundary = boundary + return nil +} + +func randomBoundary() string { + var buf [30]byte + _, err := io.ReadFull(rand.Reader, buf[:]) + if err != nil { + panic(err) + } + return fmt.Sprintf("%x", buf[:]) +} + +// CreatePart creates a new multipart section with the provided +// header. The body of the part should be written to the returned +// Writer. After calling CreatePart, any previous part may no longer +// be written to. +func (w *MultipartWriter) CreatePart(header Header) (io.Writer, error) { + if w.lastpart != nil { + if err := w.lastpart.close(); err != nil { + return nil, err + } + } + var b bytes.Buffer + if w.lastpart != nil { + fmt.Fprintf(&b, "\r\n--%s\r\n", w.boundary) + } else { + fmt.Fprintf(&b, "--%s\r\n", w.boundary) + } + + WriteHeader(&b, header) + + _, err := io.Copy(w.w, &b) + if err != nil { + return nil, err + } + p := &part{ + mw: w, + } + w.lastpart = p + return p, nil +} + +// Close finishes the multipart message and writes the trailing +// boundary end line to the output. +func (w *MultipartWriter) Close() error { + if w.lastpart != nil { + if err := w.lastpart.close(); err != nil { + return err + } + w.lastpart = nil + } + _, err := fmt.Fprintf(w.w, "\r\n--%s--\r\n", w.boundary) + return err +} + +type part struct { + mw *MultipartWriter + closed bool + we error // last error that occurred writing +} + +func (p *part) close() error { + p.closed = true + return p.we +} + +func (p *part) Write(d []byte) (n int, err error) { + if p.closed { + return 0, errors.New("multipart: can't write to finished part") + } + n, err = p.mw.w.Write(d) + if err != nil { + p.we = err + } + return +} diff --git a/vendor/github.com/emersion/go-message/textproto/textproto.go b/vendor/github.com/emersion/go-message/textproto/textproto.go new file mode 100644 index 00000000..2fa994bd --- /dev/null +++ b/vendor/github.com/emersion/go-message/textproto/textproto.go @@ -0,0 +1,2 @@ +// Package textproto implements low-level manipulation of MIME messages. +package textproto diff --git a/vendor/github.com/emersion/go-message/writer.go b/vendor/github.com/emersion/go-message/writer.go new file mode 100644 index 00000000..0b3bc7de --- /dev/null +++ b/vendor/github.com/emersion/go-message/writer.go @@ -0,0 +1,135 @@ +package message + +import ( + "errors" + "fmt" + "io" + "strings" + + "github.com/emersion/go-message/textproto" +) + +// Writer writes message entities. +// +// If the message is not multipart, it should be used as a WriteCloser. Don't +// forget to call Close. +// +// If the message is multipart, users can either use CreatePart to write child +// parts or Write to directly pipe a multipart message. In any case, Close must +// be called at the end. +type Writer struct { + w io.Writer + c io.Closer + mw *textproto.MultipartWriter +} + +// createWriter creates a new Writer writing to w with the provided header. +// Nothing is written to w when it is called. header is modified in-place. +func createWriter(w io.Writer, header *Header) (*Writer, error) { + ww := &Writer{w: w} + + mediaType, mediaParams, _ := header.ContentType() + if strings.HasPrefix(mediaType, "multipart/") { + ww.mw = textproto.NewMultipartWriter(ww.w) + + // Do not set ww's io.Closer for now: if this is a multipart entity but + // CreatePart is not used (only Write is used), then the final boundary + // is expected to be written by the user too. In this case, ww.Close + // shouldn't write the final boundary. + + if mediaParams["boundary"] != "" { + ww.mw.SetBoundary(mediaParams["boundary"]) + } else { + mediaParams["boundary"] = ww.mw.Boundary() + header.SetContentType(mediaType, mediaParams) + } + + header.Del("Content-Transfer-Encoding") + } else { + wc, err := encodingWriter(header.Get("Content-Transfer-Encoding"), ww.w) + if err != nil { + return nil, err + } + ww.w = wc + ww.c = wc + } + + switch strings.ToLower(mediaParams["charset"]) { + case "", "us-ascii", "utf-8": + // This is OK + default: + // Anything else is invalid + return nil, fmt.Errorf("unhandled charset %q", mediaParams["charset"]) + } + + return ww, nil +} + +// CreateWriter creates a new message writer to w. If header contains an +// encoding, data written to the Writer will automatically be encoded with it. +// The charset needs to be utf-8 or us-ascii. +func CreateWriter(w io.Writer, header Header) (*Writer, error) { + + // ensure that modifications are invisible to the caller + header = header.Copy() + + // If the message uses MIME, it has to include MIME-Version + if !header.Has("Mime-Version") { + header.Set("MIME-Version", "1.0") + } + + ww, err := createWriter(w, &header) + if err != nil { + return nil, err + } + if err := textproto.WriteHeader(w, header.Header); err != nil { + return nil, err + } + return ww, nil +} + +// Write implements io.Writer. +func (w *Writer) Write(b []byte) (int, error) { + return w.w.Write(b) +} + +// Close implements io.Closer. +func (w *Writer) Close() error { + if w.c != nil { + return w.c.Close() + } + return nil +} + +// CreatePart returns a Writer to a new part in this multipart entity. If this +// entity is not multipart, it fails. The body of the part should be written to +// the returned io.WriteCloser. +func (w *Writer) CreatePart(header Header) (*Writer, error) { + if w.mw == nil { + return nil, errors.New("cannot create a part in a non-multipart message") + } + + if w.c == nil { + // We know that the user calls CreatePart so Close should write the final + // boundary + w.c = w.mw + } + + // cw -> ww -> pw -> w.mw -> w.w + + ww := &struct{ io.Writer }{nil} + + // ensure that modifications are invisible to the caller + header = header.Copy() + cw, err := createWriter(ww, &header) + if err != nil { + return nil, err + } + pw, err := w.mw.CreatePart(header.Header) + if err != nil { + return nil, err + } + + ww.Writer = pw + return cw, nil +} diff --git a/vendor/github.com/emersion/go-sasl/.build.yml b/vendor/github.com/emersion/go-sasl/.build.yml new file mode 100644 index 00000000..daa6006d --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/.build.yml @@ -0,0 +1,19 @@ +image: alpine/latest +packages: + - go + # Required by codecov + - bash + - findutils +sources: + - https://github.com/emersion/go-sasl +tasks: + - build: | + cd go-sasl + go build -v ./... + - test: | + cd go-sasl + go test -coverprofile=coverage.txt -covermode=atomic ./... + - upload-coverage: | + cd go-sasl + export CODECOV_TOKEN=3f257f71-a128-4834-8f68-2b534e9f4cb1 + curl -s https://codecov.io/bash | bash diff --git a/vendor/github.com/emersion/go-sasl/.gitignore b/vendor/github.com/emersion/go-sasl/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/emersion/go-sasl/LICENSE b/vendor/github.com/emersion/go-sasl/LICENSE new file mode 100644 index 00000000..dc1922e4 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 emersion + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/emersion/go-sasl/README.md b/vendor/github.com/emersion/go-sasl/README.md new file mode 100644 index 00000000..1f8a6826 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/README.md @@ -0,0 +1,17 @@ +# go-sasl + +[![GoDoc](https://godoc.org/github.com/emersion/go-sasl?status.svg)](https://godoc.org/github.com/emersion/go-sasl) +[![Build Status](https://travis-ci.org/emersion/go-sasl.svg?branch=master)](https://travis-ci.org/emersion/go-sasl) + +A [SASL](https://tools.ietf.org/html/rfc4422) library written in Go. + +Implemented mechanisms: +* [ANONYMOUS](https://tools.ietf.org/html/rfc4505) +* [EXTERNAL](https://tools.ietf.org/html/rfc4422#appendix-A) +* [LOGIN](https://tools.ietf.org/html/draft-murchison-sasl-login-00) (obsolete, use PLAIN instead) +* [PLAIN](https://tools.ietf.org/html/rfc4616) +* [OAUTHBEARER](https://tools.ietf.org/html/rfc7628) + +## License + +MIT diff --git a/vendor/github.com/emersion/go-sasl/anonymous.go b/vendor/github.com/emersion/go-sasl/anonymous.go new file mode 100644 index 00000000..8ccb8175 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/anonymous.go @@ -0,0 +1,56 @@ +package sasl + +// The ANONYMOUS mechanism name. +const Anonymous = "ANONYMOUS" + +type anonymousClient struct { + Trace string +} + +func (c *anonymousClient) Start() (mech string, ir []byte, err error) { + mech = Anonymous + ir = []byte(c.Trace) + return +} + +func (c *anonymousClient) Next(challenge []byte) (response []byte, err error) { + return nil, ErrUnexpectedServerChallenge +} + +// A client implementation of the ANONYMOUS authentication mechanism, as +// described in RFC 4505. +func NewAnonymousClient(trace string) Client { + return &anonymousClient{trace} +} + +// Get trace information from clients logging in anonymously. +type AnonymousAuthenticator func(trace string) error + +type anonymousServer struct { + done bool + authenticate AnonymousAuthenticator +} + +func (s *anonymousServer) Next(response []byte) (challenge []byte, done bool, err error) { + if s.done { + err = ErrUnexpectedClientResponse + return + } + + // No initial response, send an empty challenge + if response == nil { + return []byte{}, false, nil + } + + s.done = true + + err = s.authenticate(string(response)) + done = true + return +} + +// A server implementation of the ANONYMOUS authentication mechanism, as +// described in RFC 4505. +func NewAnonymousServer(authenticator AnonymousAuthenticator) Server { + return &anonymousServer{authenticate: authenticator} +} diff --git a/vendor/github.com/emersion/go-sasl/external.go b/vendor/github.com/emersion/go-sasl/external.go new file mode 100644 index 00000000..da070c8b --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/external.go @@ -0,0 +1,26 @@ +package sasl + +// The EXTERNAL mechanism name. +const External = "EXTERNAL" + +type externalClient struct { + Identity string +} + +func (a *externalClient) Start() (mech string, ir []byte, err error) { + mech = External + ir = []byte(a.Identity) + return +} + +func (a *externalClient) Next(challenge []byte) (response []byte, err error) { + return nil, ErrUnexpectedServerChallenge +} + +// An implementation of the EXTERNAL authentication mechanism, as described in +// RFC 4422. Authorization identity may be left blank to indicate that the +// client is requesting to act as the identity associated with the +// authentication credentials. +func NewExternalClient(identity string) Client { + return &externalClient{identity} +} diff --git a/vendor/github.com/emersion/go-sasl/login.go b/vendor/github.com/emersion/go-sasl/login.go new file mode 100644 index 00000000..3847ee14 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/login.go @@ -0,0 +1,89 @@ +package sasl + +import ( + "bytes" +) + +// The LOGIN mechanism name. +const Login = "LOGIN" + +var expectedChallenge = []byte("Password:") + +type loginClient struct { + Username string + Password string +} + +func (a *loginClient) Start() (mech string, ir []byte, err error) { + mech = "LOGIN" + ir = []byte(a.Username) + return +} + +func (a *loginClient) Next(challenge []byte) (response []byte, err error) { + if bytes.Compare(challenge, expectedChallenge) != 0 { + return nil, ErrUnexpectedServerChallenge + } else { + return []byte(a.Password), nil + } +} + +// A client implementation of the LOGIN authentication mechanism for SMTP, +// as described in http://www.iana.org/go/draft-murchison-sasl-login +// +// It is considered obsolete, and should not be used when other mechanisms are +// available. For plaintext password authentication use PLAIN mechanism. +func NewLoginClient(username, password string) Client { + return &loginClient{username, password} +} + +// Authenticates users with an username and a password. +type LoginAuthenticator func(username, password string) error + +type loginState int + +const ( + loginNotStarted loginState = iota + loginWaitingUsername + loginWaitingPassword +) + +type loginServer struct { + state loginState + username, password string + authenticate LoginAuthenticator +} + +// A server implementation of the LOGIN authentication mechanism, as described +// in https://tools.ietf.org/html/draft-murchison-sasl-login-00. +// +// LOGIN is obsolete and should only be enabled for legacy clients that cannot +// be updated to use PLAIN. +func NewLoginServer(authenticator LoginAuthenticator) Server { + return &loginServer{authenticate: authenticator} +} + +func (a *loginServer) Next(response []byte) (challenge []byte, done bool, err error) { + switch a.state { + case loginNotStarted: + // Check for initial response field, as per RFC4422 section 3 + if response == nil { + challenge = []byte("Username:") + break + } + a.state++ + fallthrough + case loginWaitingUsername: + a.username = string(response) + challenge = []byte("Password:") + case loginWaitingPassword: + a.password = string(response) + err = a.authenticate(a.username, a.password) + done = true + default: + err = ErrUnexpectedClientResponse + } + + a.state++ + return +} diff --git a/vendor/github.com/emersion/go-sasl/oauthbearer.go b/vendor/github.com/emersion/go-sasl/oauthbearer.go new file mode 100644 index 00000000..a0639b19 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/oauthbearer.go @@ -0,0 +1,191 @@ +package sasl + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "strconv" + "strings" +) + +// The OAUTHBEARER mechanism name. +const OAuthBearer = "OAUTHBEARER" + +type OAuthBearerError struct { + Status string `json:"status"` + Schemes string `json:"schemes"` + Scope string `json:"scope"` +} + +type OAuthBearerOptions struct { + Username string + Token string + Host string + Port int +} + +// Implements error +func (err *OAuthBearerError) Error() string { + return fmt.Sprintf("OAUTHBEARER authentication error (%v)", err.Status) +} + +type oauthBearerClient struct { + OAuthBearerOptions +} + +func (a *oauthBearerClient) Start() (mech string, ir []byte, err error) { + mech = OAuthBearer + var str = "n,a=" + a.Username + "," + + if a.Host != "" { + str += "\x01host=" + a.Host + } + + if a.Port != 0 { + str += "\x01port=" + strconv.Itoa(a.Port) + } + str += "\x01auth=Bearer " + a.Token + "\x01\x01" + ir = []byte(str) + return +} + +func (a *oauthBearerClient) Next(challenge []byte) ([]byte, error) { + authBearerErr := &OAuthBearerError{} + if err := json.Unmarshal(challenge, authBearerErr); err != nil { + return nil, err + } else { + return nil, authBearerErr + } +} + +// An implementation of the OAUTHBEARER authentication mechanism, as +// described in RFC 7628. +func NewOAuthBearerClient(opt *OAuthBearerOptions) Client { + return &oauthBearerClient{*opt} +} + +type OAuthBearerAuthenticator func(opts OAuthBearerOptions) *OAuthBearerError + +type oauthBearerServer struct { + done bool + failErr error + authenticate OAuthBearerAuthenticator +} + +func (a *oauthBearerServer) fail(descr string) ([]byte, bool, error) { + blob, err := json.Marshal(OAuthBearerError{ + Status: "invalid_request", + Schemes: "bearer", + }) + if err != nil { + panic(err) // wtf + } + a.failErr = errors.New(descr) + return blob, false, nil +} + +func (a *oauthBearerServer) Next(response []byte) (challenge []byte, done bool, err error) { + // Per RFC, we cannot just send an error, we need to return JSON-structured + // value as a challenge and then after getting dummy response from the + // client stop the exchange. + if a.failErr != nil { + // Server libraries (go-smtp, go-imap) will not call Next on + // protocol-specific SASL cancel response ('*'). However, GS2 (and + // indirectly OAUTHBEARER) defines a protocol-independent way to do so + // using 0x01. + if len(response) != 1 && response[0] != 0x01 { + return nil, true, errors.New("unexpected response") + } + return nil, true, a.failErr + } + + if a.done { + err = ErrUnexpectedClientResponse + return + } + + // Generate empty challenge. + if response == nil { + return []byte{}, false, nil + } + + a.done = true + + // Cut n,a=username,\x01host=...\x01auth=... + // into + // n + // a=username + // \x01host=...\x01auth=...\x01\x01 + parts := bytes.SplitN(response, []byte{','}, 3) + if len(parts) != 3 { + return a.fail("Invalid response") + } + if !bytes.Equal(parts[0], []byte{'n'}) { + return a.fail("Invalid response, missing 'n'") + } + opts := OAuthBearerOptions{} + if !bytes.HasPrefix(parts[1], []byte("a=")) { + return a.fail("Invalid response, missing 'a'") + } + opts.Username = string(bytes.TrimPrefix(parts[1], []byte("a="))) + + // Cut \x01host=...\x01auth=...\x01\x01 + // into + // *empty* + // host=... + // auth=... + // *empty* + // + // Note that this code does not do a lot of checks to make sure the input + // follows the exact format specified by RFC. + params := bytes.Split(parts[2], []byte{0x01}) + for _, p := range params { + // Skip empty fields (one at start and end). + if len(p) == 0 { + continue + } + + pParts := bytes.SplitN(p, []byte{'='}, 2) + if len(pParts) != 2 { + return a.fail("Invalid response, missing '='") + } + + switch string(pParts[0]) { + case "host": + opts.Host = string(pParts[1]) + case "port": + port, err := strconv.ParseUint(string(pParts[1]), 10, 16) + if err != nil { + return a.fail("Invalid response, malformed 'port' value") + } + opts.Port = int(port) + case "auth": + const prefix = "bearer " + strValue := string(pParts[1]) + // Token type is case-insensitive. + if !strings.HasPrefix(strings.ToLower(strValue), prefix) { + return a.fail("Unsupported token type") + } + opts.Token = strValue[len(prefix):] + default: + return a.fail("Invalid response, unknown parameter: " + string(pParts[0])) + } + } + + authzErr := a.authenticate(opts) + if authzErr != nil { + blob, err := json.Marshal(authzErr) + if err != nil { + panic(err) // wtf + } + a.failErr = authzErr + return blob, false, nil + } + + return nil, true, nil +} + +func NewOAuthBearerServer(auth OAuthBearerAuthenticator) Server { + return &oauthBearerServer{authenticate: auth} +} diff --git a/vendor/github.com/emersion/go-sasl/plain.go b/vendor/github.com/emersion/go-sasl/plain.go new file mode 100644 index 00000000..344ed170 --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/plain.go @@ -0,0 +1,77 @@ +package sasl + +import ( + "bytes" + "errors" +) + +// The PLAIN mechanism name. +const Plain = "PLAIN" + +type plainClient struct { + Identity string + Username string + Password string +} + +func (a *plainClient) Start() (mech string, ir []byte, err error) { + mech = "PLAIN" + ir = []byte(a.Identity + "\x00" + a.Username + "\x00" + a.Password) + return +} + +func (a *plainClient) Next(challenge []byte) (response []byte, err error) { + return nil, ErrUnexpectedServerChallenge +} + +// A client implementation of the PLAIN authentication mechanism, as described +// in RFC 4616. Authorization identity may be left blank to indicate that it is +// the same as the username. +func NewPlainClient(identity, username, password string) Client { + return &plainClient{identity, username, password} +} + +// Authenticates users with an identity, a username and a password. If the +// identity is left blank, it indicates that it is the same as the username. +// If identity is not empty and the server doesn't support it, an error must be +// returned. +type PlainAuthenticator func(identity, username, password string) error + +type plainServer struct { + done bool + authenticate PlainAuthenticator +} + +func (a *plainServer) Next(response []byte) (challenge []byte, done bool, err error) { + if a.done { + err = ErrUnexpectedClientResponse + return + } + + // No initial response, send an empty challenge + if response == nil { + return []byte{}, false, nil + } + + a.done = true + + parts := bytes.Split(response, []byte("\x00")) + if len(parts) != 3 { + err = errors.New("Invalid response") + return + } + + identity := string(parts[0]) + username := string(parts[1]) + password := string(parts[2]) + + err = a.authenticate(identity, username, password) + done = true + return +} + +// A server implementation of the PLAIN authentication mechanism, as described +// in RFC 4616. +func NewPlainServer(authenticator PlainAuthenticator) Server { + return &plainServer{authenticate: authenticator} +} diff --git a/vendor/github.com/emersion/go-sasl/sasl.go b/vendor/github.com/emersion/go-sasl/sasl.go new file mode 100644 index 00000000..c209144c --- /dev/null +++ b/vendor/github.com/emersion/go-sasl/sasl.go @@ -0,0 +1,45 @@ +// Library for Simple Authentication and Security Layer (SASL) defined in RFC 4422. +package sasl + +// Note: +// Most of this code was copied, with some modifications, from net/smtp. It +// would be better if Go provided a standard package (e.g. crypto/sasl) that +// could be shared by SMTP, IMAP, and other packages. + +import ( + "errors" +) + +// Common SASL errors. +var ( + ErrUnexpectedClientResponse = errors.New("sasl: unexpected client response") + ErrUnexpectedServerChallenge = errors.New("sasl: unexpected server challenge") +) + +// Client interface to perform challenge-response authentication. +type Client interface { + // Begins SASL authentication with the server. It returns the + // authentication mechanism name and "initial response" data (if required by + // the selected mechanism). A non-nil error causes the client to abort the + // authentication attempt. + // + // A nil ir value is different from a zero-length value. The nil value + // indicates that the selected mechanism does not use an initial response, + // while a zero-length value indicates an empty initial response, which must + // be sent to the server. + Start() (mech string, ir []byte, err error) + + // Continues challenge-response authentication. A non-nil error causes + // the client to abort the authentication attempt. + Next(challenge []byte) (response []byte, err error) +} + +// Server interface to perform challenge-response authentication. +type Server interface { + // Begins or continues challenge-response authentication. If the client + // supplies an initial response, response is non-nil. + // + // If the authentication is finished, done is set to true. If the + // authentication has failed, an error is returned. + Next(response []byte) (challenge []byte, done bool, err error) +} diff --git a/vendor/github.com/emersion/go-textwrapper/.gitignore b/vendor/github.com/emersion/go-textwrapper/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/vendor/github.com/emersion/go-textwrapper/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/emersion/go-textwrapper/.travis.yml b/vendor/github.com/emersion/go-textwrapper/.travis.yml new file mode 100644 index 00000000..4f2ee4d9 --- /dev/null +++ b/vendor/github.com/emersion/go-textwrapper/.travis.yml @@ -0,0 +1 @@ +language: go diff --git a/vendor/github.com/emersion/go-textwrapper/LICENSE b/vendor/github.com/emersion/go-textwrapper/LICENSE new file mode 100644 index 00000000..dc1922e4 --- /dev/null +++ b/vendor/github.com/emersion/go-textwrapper/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 emersion + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/emersion/go-textwrapper/README.md b/vendor/github.com/emersion/go-textwrapper/README.md new file mode 100644 index 00000000..84f6fb0a --- /dev/null +++ b/vendor/github.com/emersion/go-textwrapper/README.md @@ -0,0 +1,27 @@ +# go-textwrapper + +[![GoDoc](https://godoc.org/github.com/emersion/go-textwrapper?status.svg)](https://godoc.org/github.com/emersion/go-textwrapper) +[![Build Status](https://travis-ci.org/emersion/go-textwrapper.svg?branch=master)](https://travis-ci.org/emersion/go-textwrapper) + +A writer that wraps long text lines to a specified length + +## Usage + +```go +import ( + "os" + + "github.com/emersion/go-textwrapper" +) + +func main() { + w := textwrapper.New(os.Stdout, "/", 5) + + w.Write([]byte("helloworldhelloworldhelloworld")) + // Output: hello/world/hello/world/hello/world +} +``` + +## License + +MIT diff --git a/vendor/github.com/emersion/go-textwrapper/wrapper.go b/vendor/github.com/emersion/go-textwrapper/wrapper.go new file mode 100644 index 00000000..43b26e7a --- /dev/null +++ b/vendor/github.com/emersion/go-textwrapper/wrapper.go @@ -0,0 +1,61 @@ +// A writer that wraps long text lines to a specified length. +package textwrapper + +import ( + "io" +) + +type writer struct { + Len int + + sepBytes []byte + w io.Writer + i int +} + +func (w *writer) Write(b []byte) (N int, err error) { + to := w.Len - w.i + + for len(b) > to { + var n int + n, err = w.w.Write(b[:to]) + if err != nil { + return + } + N += n + b = b[to:] + + _, err = w.w.Write(w.sepBytes) + if err != nil { + return + } + + w.i = 0 + to = w.Len + } + + w.i += len(b) + + n, err := w.w.Write(b) + if err != nil { + return + } + N += n + + return +} + +// Returns a writer that splits its input into multiple parts that have the same +// length and adds a separator between these parts. +func New(w io.Writer, sep string, l int) io.Writer { + return &writer{ + Len: l, + sepBytes: []byte(sep), + w: w, + } +} + +// Creates a RFC822 text wrapper. It adds a CRLF (ie. \r\n) each 76 characters. +func NewRFC822(w io.Writer) io.Writer { + return New(w, "\r\n", 76) +} diff --git a/vendor/github.com/sashabaranov/go-gpt3/README.md b/vendor/github.com/sashabaranov/go-gpt3/README.md deleted file mode 100644 index 7f8b016b..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# go-gpt3 -[![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/sashabaranov/go-gpt3) -[![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-gpt3)](https://goreportcard.com/report/github.com/sashabaranov/go-gpt3) - - -[OpenAI ChatGPT and GPT-3](https://platform.openai.com/) API client for Go - -Installation: -``` -go get github.com/sashabaranov/go-gpt3 -``` - - -Example usage: - -```go -package main - -import ( - "context" - "fmt" - gogpt "github.com/sashabaranov/go-gpt3" -) - -func main() { - c := gogpt.NewClient("your token") - ctx := context.Background() - - req := gogpt.CompletionRequest{ - Model: gogpt.GPT3Ada, - MaxTokens: 5, - Prompt: "Lorem ipsum", - } - resp, err := c.CreateCompletion(ctx, req) - if err != nil { - return - } - fmt.Println(resp.Choices[0].Text) -} -``` - -Streaming response example: - -```go -package main - -import ( - "errors" - "context" - "fmt" - "io" - gogpt "github.com/sashabaranov/go-gpt3" -) - -func main() { - c := gogpt.NewClient("your token") - ctx := context.Background() - - req := gogpt.CompletionRequest{ - Model: gogpt.GPT3Ada, - MaxTokens: 5, - Prompt: "Lorem ipsum", - Stream: true, - } - stream, err := c.CreateCompletionStream(ctx, req) - if err != nil { - return - } - defer stream.Close() - - for { - response, err := stream.Recv() - if errors.Is(err, io.EOF) { - fmt.Println("Stream finished") - return - } - - if err != nil { - fmt.Printf("Stream error: %v\n", err) - return - } - - - fmt.Printf("Stream response: %v\n", response) - } -} -``` diff --git a/vendor/github.com/sashabaranov/go-gpt3/answers.go b/vendor/github.com/sashabaranov/go-gpt3/answers.go deleted file mode 100644 index 5a990782..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/answers.go +++ /dev/null @@ -1,50 +0,0 @@ -package gogpt - -import ( - "bytes" - "context" - "encoding/json" - "net/http" -) - -type AnswerRequest struct { - Documents []string `json:"documents,omitempty"` - File string `json:"file,omitempty"` - Question string `json:"question"` - SearchModel string `json:"search_model,omitempty"` - Model string `json:"model"` - ExamplesContext string `json:"examples_context"` - Examples [][]string `json:"examples"` - MaxTokens int `json:"max_tokens,omitempty"` - Stop []string `json:"stop,omitempty"` - Temperature *float64 `json:"temperature,omitempty"` -} - -type AnswerResponse struct { - Answers []string `json:"answers"` - Completion string `json:"completion"` - Model string `json:"model"` - Object string `json:"object"` - SearchModel string `json:"search_model"` - SelectedDocuments []struct { - Document int `json:"document"` - Text string `json:"text"` - } `json:"selected_documents"` -} - -// Search — perform a semantic search api call over a list of documents. -func (c *Client) Answers(ctx context.Context, request AnswerRequest) (response AnswerResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { - return - } - - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL("/answers"), bytes.NewBuffer(reqBytes)) - if err != nil { - return - } - - err = c.sendRequest(req, &response) - return -} diff --git a/vendor/github.com/sashabaranov/go-gpt3/api.go b/vendor/github.com/sashabaranov/go-gpt3/api.go deleted file mode 100644 index 715c9dd7..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/api.go +++ /dev/null @@ -1,81 +0,0 @@ -package gogpt - -import ( - "encoding/json" - "fmt" - "net/http" -) - -// Client is OpenAI GPT-3 API client. -type Client struct { - config ClientConfig -} - -// NewClient creates new OpenAI API client. -func NewClient(authToken string) *Client { - config := DefaultConfig(authToken) - return &Client{config} -} - -// NewClientWithConfig creates new OpenAI API client for specified config. -func NewClientWithConfig(config ClientConfig) *Client { - return &Client{config} -} - -// NewOrgClient creates new OpenAI API client for specified Organization ID. -// -// Deprecated: Please use NewClientWithConfig. -func NewOrgClient(authToken, org string) *Client { - config := DefaultConfig(authToken) - config.OrgID = org - return &Client{config} -} - -func (c *Client) sendRequest(req *http.Request, v interface{}) error { - req.Header.Set("Accept", "application/json; charset=utf-8") - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.config.authToken)) - - // Check whether Content-Type is already set, Upload Files API requires - // Content-Type == multipart/form-data - contentType := req.Header.Get("Content-Type") - if contentType == "" { - req.Header.Set("Content-Type", "application/json; charset=utf-8") - } - - if len(c.config.OrgID) > 0 { - req.Header.Set("OpenAI-Organization", c.config.OrgID) - } - - res, err := c.config.HTTPClient.Do(req) - if err != nil { - return err - } - - defer res.Body.Close() - - if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest { - var errRes ErrorResponse - err = json.NewDecoder(res.Body).Decode(&errRes) - if err != nil || errRes.Error == nil { - reqErr := RequestError{ - StatusCode: res.StatusCode, - Err: err, - } - return fmt.Errorf("error, %w", &reqErr) - } - errRes.Error.StatusCode = res.StatusCode - return fmt.Errorf("error, status code: %d, message: %w", res.StatusCode, errRes.Error) - } - - if v != nil { - if err = json.NewDecoder(res.Body).Decode(&v); err != nil { - return err - } - } - - return nil -} - -func (c *Client) fullURL(suffix string) string { - return fmt.Sprintf("%s%s", c.config.BaseURL, suffix) -} diff --git a/vendor/github.com/sashabaranov/go-gpt3/config.go b/vendor/github.com/sashabaranov/go-gpt3/config.go deleted file mode 100644 index 561962e8..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/config.go +++ /dev/null @@ -1,33 +0,0 @@ -package gogpt - -import ( - "net/http" -) - -const ( - apiURLv1 = "https://api.openai.com/v1" - defaultEmptyMessagesLimit uint = 300 -) - -// ClientConfig is a configuration of a client. -type ClientConfig struct { - authToken string - - HTTPClient *http.Client - - BaseURL string - OrgID string - - EmptyMessagesLimit uint -} - -func DefaultConfig(authToken string) ClientConfig { - return ClientConfig{ - HTTPClient: &http.Client{}, - BaseURL: apiURLv1, - OrgID: "", - authToken: authToken, - - EmptyMessagesLimit: defaultEmptyMessagesLimit, - } -} diff --git a/vendor/github.com/sashabaranov/go-gpt3/error.go b/vendor/github.com/sashabaranov/go-gpt3/error.go deleted file mode 100644 index 927fafd4..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/error.go +++ /dev/null @@ -1,37 +0,0 @@ -package gogpt - -import "fmt" - -// APIError provides error information returned by the OpenAI API. -type APIError struct { - Code *string `json:"code,omitempty"` - Message string `json:"message"` - Param *string `json:"param,omitempty"` - Type string `json:"type"` - StatusCode int `json:"-"` -} - -// RequestError provides informations about generic request errors. -type RequestError struct { - StatusCode int - Err error -} - -type ErrorResponse struct { - Error *APIError `json:"error,omitempty"` -} - -func (e *APIError) Error() string { - return e.Message -} - -func (e *RequestError) Error() string { - if e.Err != nil { - return e.Err.Error() - } - return fmt.Sprintf("status code %d", e.StatusCode) -} - -func (e *RequestError) Unwrap() error { - return e.Err -} diff --git a/vendor/github.com/sashabaranov/go-gpt3/image.go b/vendor/github.com/sashabaranov/go-gpt3/image.go deleted file mode 100644 index 07ecaa77..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/image.go +++ /dev/null @@ -1,121 +0,0 @@ -package gogpt - -import ( - "bytes" - "context" - "encoding/json" - "io" - "mime/multipart" - "net/http" - "os" - "strconv" -) - -// Image sizes defined by the OpenAI API. -const ( - CreateImageSize256x256 = "256x256" - CreateImageSize512x512 = "512x512" - CreateImageSize1024x1024 = "1024x1024" -) - -const ( - CreateImageResponseFormatURL = "url" - CreateImageResponseFormatB64JSON = "b64_json" -) - -// ImageRequest represents the request structure for the image API. -type ImageRequest struct { - Prompt string `json:"prompt,omitempty"` - N int `json:"n,omitempty"` - Size string `json:"size,omitempty"` - ResponseFormat string `json:"response_format,omitempty"` - User string `json:"user,omitempty"` -} - -// ImageResponse represents a response structure for image API. -type ImageResponse struct { - Created int64 `json:"created,omitempty"` - Data []ImageResponseDataInner `json:"data,omitempty"` -} - -// ImageResponseData represents a response data structure for image API. -type ImageResponseDataInner struct { - URL string `json:"url,omitempty"` - B64JSON string `json:"b64_json,omitempty"` -} - -// CreateImage - API call to create an image. This is the main endpoint of the DALL-E API. -func (c *Client) CreateImage(ctx context.Context, request ImageRequest) (response ImageResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { - return - } - - urlSuffix := "/images/generations" - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes)) - if err != nil { - return - } - - err = c.sendRequest(req, &response) - return -} - -// ImageEditRequest represents the request structure for the image API. -type ImageEditRequest struct { - Image *os.File `json:"image,omitempty"` - Mask *os.File `json:"mask,omitempty"` - Prompt string `json:"prompt,omitempty"` - N int `json:"n,omitempty"` - Size string `json:"size,omitempty"` -} - -// CreateEditImage - API call to create an image. This is the main endpoint of the DALL-E API. -func (c *Client) CreateEditImage(ctx context.Context, request ImageEditRequest) (response ImageResponse, err error) { - body := &bytes.Buffer{} - writer := multipart.NewWriter(body) - - // image - image, err := writer.CreateFormFile("image", request.Image.Name()) - if err != nil { - return - } - _, err = io.Copy(image, request.Image) - if err != nil { - return - } - - // mask - mask, err := writer.CreateFormFile("mask", request.Mask.Name()) - if err != nil { - return - } - _, err = io.Copy(mask, request.Mask) - if err != nil { - return - } - - err = writer.WriteField("prompt", request.Prompt) - if err != nil { - return - } - err = writer.WriteField("n", strconv.Itoa(request.N)) - if err != nil { - return - } - err = writer.WriteField("size", request.Size) - if err != nil { - return - } - writer.Close() - urlSuffix := "/images/edits" - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), body) - if err != nil { - return - } - - req.Header.Set("Content-Type", writer.FormDataContentType()) - err = c.sendRequest(req, &response) - return -} diff --git a/vendor/github.com/sashabaranov/go-gpt3/stream.go b/vendor/github.com/sashabaranov/go-gpt3/stream.go deleted file mode 100644 index d1bdf486..00000000 --- a/vendor/github.com/sashabaranov/go-gpt3/stream.go +++ /dev/null @@ -1,104 +0,0 @@ -package gogpt - -import ( - "bufio" - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" -) - -var ( - ErrTooManyEmptyStreamMessages = errors.New("stream has sent too many empty messages") -) - -type CompletionStream struct { - emptyMessagesLimit uint - isFinished bool - - reader *bufio.Reader - response *http.Response -} - -func (stream *CompletionStream) Recv() (response CompletionResponse, err error) { - if stream.isFinished { - err = io.EOF - return - } - - var emptyMessagesCount uint - -waitForData: - line, err := stream.reader.ReadBytes('\n') - if err != nil { - return - } - - var headerData = []byte("data: ") - line = bytes.TrimSpace(line) - if !bytes.HasPrefix(line, headerData) { - emptyMessagesCount++ - if emptyMessagesCount > stream.emptyMessagesLimit { - err = ErrTooManyEmptyStreamMessages - return - } - - goto waitForData - } - - line = bytes.TrimPrefix(line, headerData) - if string(line) == "[DONE]" { - stream.isFinished = true - err = io.EOF - return - } - - err = json.Unmarshal(line, &response) - return -} - -func (stream *CompletionStream) Close() { - stream.response.Body.Close() -} - -// CreateCompletionStream — API call to create a completion w/ streaming -// support. It sets whether to stream back partial progress. If set, tokens will be -// sent as data-only server-sent events as they become available, with the -// stream terminated by a data: [DONE] message. -func (c *Client) CreateCompletionStream( - ctx context.Context, - request CompletionRequest, -) (stream *CompletionStream, err error) { - request.Stream = true - reqBytes, err := json.Marshal(request) - if err != nil { - return - } - - urlSuffix := "/completions" - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes)) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("Accept", "text/event-stream") - req.Header.Set("Cache-Control", "no-cache") - req.Header.Set("Connection", "keep-alive") - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.config.authToken)) - if err != nil { - return - } - - resp, err := c.config.HTTPClient.Do(req) //nolint:bodyclose // body is closed in stream.Close() - if err != nil { - return - } - - stream = &CompletionStream{ - emptyMessagesLimit: c.config.EmptyMessagesLimit, - - reader: bufio.NewReader(resp.Body), - response: resp, - } - return -} diff --git a/vendor/github.com/sashabaranov/go-gpt3/.gitignore b/vendor/github.com/sashabaranov/go-openai/.gitignore similarity index 100% rename from vendor/github.com/sashabaranov/go-gpt3/.gitignore rename to vendor/github.com/sashabaranov/go-openai/.gitignore diff --git a/vendor/github.com/sashabaranov/go-gpt3/.golangci.yml b/vendor/github.com/sashabaranov/go-openai/.golangci.yml similarity index 100% rename from vendor/github.com/sashabaranov/go-gpt3/.golangci.yml rename to vendor/github.com/sashabaranov/go-openai/.golangci.yml diff --git a/vendor/github.com/sashabaranov/go-gpt3/LICENSE b/vendor/github.com/sashabaranov/go-openai/LICENSE similarity index 100% rename from vendor/github.com/sashabaranov/go-gpt3/LICENSE rename to vendor/github.com/sashabaranov/go-openai/LICENSE diff --git a/vendor/github.com/sashabaranov/go-gpt3/Makefile b/vendor/github.com/sashabaranov/go-openai/Makefile similarity index 100% rename from vendor/github.com/sashabaranov/go-gpt3/Makefile rename to vendor/github.com/sashabaranov/go-openai/Makefile diff --git a/vendor/github.com/sashabaranov/go-openai/README.md b/vendor/github.com/sashabaranov/go-openai/README.md new file mode 100644 index 00000000..7526ea33 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/README.md @@ -0,0 +1,464 @@ +# Go OpenAI +[![Go Reference](https://pkg.go.dev/badge/github.com/sashabaranov/go-openai.svg)](https://pkg.go.dev/github.com/sashabaranov/go-openai) +[![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-openai)](https://goreportcard.com/report/github.com/sashabaranov/go-openai) +[![codecov](https://codecov.io/gh/sashabaranov/go-openai/branch/master/graph/badge.svg?token=bCbIfHLIsW)](https://codecov.io/gh/sashabaranov/go-openai) + +This library provides Go clients for [OpenAI API](https://platform.openai.com/). We support: + +* ChatGPT +* GPT-3, GPT-4 +* DALL·E 2 +* Whisper + +Installation: +``` +go get github.com/sashabaranov/go-openai +``` + + +ChatGPT example usage: + +```go +package main + +import ( + "context" + "fmt" + openai "github.com/sashabaranov/go-openai" +) + +func main() { + client := openai.NewClient("your token") + resp, err := client.CreateChatCompletion( + context.Background(), + openai.ChatCompletionRequest{ + Model: openai.GPT3Dot5Turbo, + Messages: []openai.ChatCompletionMessage{ + { + Role: openai.ChatMessageRoleUser, + Content: "Hello!", + }, + }, + }, + ) + + if err != nil { + fmt.Printf("ChatCompletion error: %v\n", err) + return + } + + fmt.Println(resp.Choices[0].Message.Content) +} + +``` + + + +Other examples: + +
+ChatGPT streaming completion + +```go +package main + +import ( + "context" + "errors" + "fmt" + "io" + openai "github.com/sashabaranov/go-openai" +) + +func main() { + c := openai.NewClient("your token") + ctx := context.Background() + + req := openai.ChatCompletionRequest{ + Model: openai.GPT3Dot5Turbo, + MaxTokens: 20, + Messages: []openai.ChatCompletionMessage{ + { + Role: openai.ChatMessageRoleUser, + Content: "Lorem ipsum", + }, + }, + Stream: true, + } + stream, err := c.CreateChatCompletionStream(ctx, req) + if err != nil { + fmt.Printf("ChatCompletionStream error: %v\n", err) + return + } + defer stream.Close() + + fmt.Printf("Stream response: ") + for { + response, err := stream.Recv() + if errors.Is(err, io.EOF) { + fmt.Println("\nStream finished") + return + } + + if err != nil { + fmt.Printf("\nStream error: %v\n", err) + return + } + + fmt.Printf(response.Choices[0].Delta.Content) + } +} +``` +
+ +
+GPT-3 completion + +```go +package main + +import ( + "context" + "fmt" + openai "github.com/sashabaranov/go-openai" +) + +func main() { + c := openai.NewClient("your token") + ctx := context.Background() + + req := openai.CompletionRequest{ + Model: openai.GPT3Ada, + MaxTokens: 5, + Prompt: "Lorem ipsum", + } + resp, err := c.CreateCompletion(ctx, req) + if err != nil { + fmt.Printf("Completion error: %v\n", err) + return + } + fmt.Println(resp.Choices[0].Text) +} +``` +
+ +
+GPT-3 streaming completion + +```go +package main + +import ( + "errors" + "context" + "fmt" + "io" + openai "github.com/sashabaranov/go-openai" +) + +func main() { + c := openai.NewClient("your token") + ctx := context.Background() + + req := openai.CompletionRequest{ + Model: openai.GPT3Ada, + MaxTokens: 5, + Prompt: "Lorem ipsum", + Stream: true, + } + stream, err := c.CreateCompletionStream(ctx, req) + if err != nil { + fmt.Printf("CompletionStream error: %v\n", err) + return + } + defer stream.Close() + + for { + response, err := stream.Recv() + if errors.Is(err, io.EOF) { + fmt.Println("Stream finished") + return + } + + if err != nil { + fmt.Printf("Stream error: %v\n", err) + return + } + + + fmt.Printf("Stream response: %v\n", response) + } +} +``` +
+ +
+Audio Speech-To-Text + +```go +package main + +import ( + "context" + "fmt" + + openai "github.com/sashabaranov/go-openai" +) + +func main() { + c := openai.NewClient("your token") + ctx := context.Background() + + req := openai.AudioRequest{ + Model: openai.Whisper1, + FilePath: "recording.mp3", + } + resp, err := c.CreateTranscription(ctx, req) + if err != nil { + fmt.Printf("Transcription error: %v\n", err) + return + } + fmt.Println(resp.Text) +} +``` +
+ +
+Audio Captions + +```go +package main + +import ( + "context" + "fmt" + "os" + + openai "github.com/sashabaranov/go-openai" +) + +func main() { + c := openai.NewClient(os.Getenv("OPENAI_KEY")) + + req := openai.AudioRequest{ + Model: openai.Whisper1, + FilePath: os.Args[1], + Format: openai.AudioResponseFormatSRT, + } + resp, err := c.CreateTranscription(context.Background(), req) + if err != nil { + fmt.Printf("Transcription error: %v\n", err) + return + } + f, err := os.Create(os.Args[1] + ".srt") + if err != nil { + fmt.Printf("Could not open file: %v\n", err) + return + } + defer f.Close() + if _, err := f.WriteString(resp.Text); err != nil { + fmt.Printf("Error writing to file: %v\n", err) + return + } +} +``` +
+ +
+DALL-E 2 image generation + +```go +package main + +import ( + "bytes" + "context" + "encoding/base64" + "fmt" + openai "github.com/sashabaranov/go-openai" + "image/png" + "os" +) + +func main() { + c := openai.NewClient("your token") + ctx := context.Background() + + // Sample image by link + reqUrl := openai.ImageRequest{ + Prompt: "Parrot on a skateboard performs a trick, cartoon style, natural light, high detail", + Size: openai.CreateImageSize256x256, + ResponseFormat: openai.CreateImageResponseFormatURL, + N: 1, + } + + respUrl, err := c.CreateImage(ctx, reqUrl) + if err != nil { + fmt.Printf("Image creation error: %v\n", err) + return + } + fmt.Println(respUrl.Data[0].URL) + + // Example image as base64 + reqBase64 := openai.ImageRequest{ + Prompt: "Portrait of a humanoid parrot in a classic costume, high detail, realistic light, unreal engine", + Size: openai.CreateImageSize256x256, + ResponseFormat: openai.CreateImageResponseFormatB64JSON, + N: 1, + } + + respBase64, err := c.CreateImage(ctx, reqBase64) + if err != nil { + fmt.Printf("Image creation error: %v\n", err) + return + } + + imgBytes, err := base64.StdEncoding.DecodeString(respBase64.Data[0].B64JSON) + if err != nil { + fmt.Printf("Base64 decode error: %v\n", err) + return + } + + r := bytes.NewReader(imgBytes) + imgData, err := png.Decode(r) + if err != nil { + fmt.Printf("PNG decode error: %v\n", err) + return + } + + file, err := os.Create("example.png") + if err != nil { + fmt.Printf("File creation error: %v\n", err) + return + } + defer file.Close() + + if err := png.Encode(file, imgData); err != nil { + fmt.Printf("PNG encode error: %v\n", err) + return + } + + fmt.Println("The image was saved as example.png") +} + +``` +
+ +
+Configuring proxy + +```go +config := openai.DefaultConfig("token") +proxyUrl, err := url.Parse("http://localhost:{port}") +if err != nil { + panic(err) +} +transport := &http.Transport{ + Proxy: http.ProxyURL(proxyUrl), +} +config.HTTPClient = &http.Client{ + Transport: transport, +} + +c := openai.NewClientWithConfig(config) +``` + +See also: https://pkg.go.dev/github.com/sashabaranov/go-openai#ClientConfig +
+ +
+ChatGPT support context + +```go +package main + +import ( + "bufio" + "context" + "fmt" + "os" + "strings" + + "github.com/sashabaranov/go-openai" +) + +func main() { + client := openai.NewClient("your token") + messages := make([]openai.ChatCompletionMessage, 0) + reader := bufio.NewReader(os.Stdin) + fmt.Println("Conversation") + fmt.Println("---------------------") + + for { + fmt.Print("-> ") + text, _ := reader.ReadString('\n') + // convert CRLF to LF + text = strings.Replace(text, "\n", "", -1) + messages = append(messages, openai.ChatCompletionMessage{ + Role: openai.ChatMessageRoleUser, + Content: text, + }) + + resp, err := client.CreateChatCompletion( + context.Background(), + openai.ChatCompletionRequest{ + Model: openai.GPT3Dot5Turbo, + Messages: messages, + }, + ) + + if err != nil { + fmt.Printf("ChatCompletion error: %v\n", err) + continue + } + + content := resp.Choices[0].Message.Content + messages = append(messages, openai.ChatCompletionMessage{ + Role: openai.ChatMessageRoleAssistant, + Content: content, + }) + fmt.Println(content) + } +} +``` +
+ +
+Azure OpenAI ChatGPT + +```go +package main + +import ( + "context" + "fmt" + + openai "github.com/sashabaranov/go-openai" +) + +func main() { + + config := openai.DefaultAzureConfig("your Azure OpenAI Key", "https://your Azure OpenAI Endpoint ", "your Model deployment name") + client := openai.NewClientWithConfig(config) + resp, err := client.CreateChatCompletion( + context.Background(), + openai.ChatCompletionRequest{ + Model: openai.GPT3Dot5Turbo, + Messages: []openai.ChatCompletionMessage{ + { + Role: openai.ChatMessageRoleUser, + Content: "Hello Azure OpenAI!", + }, + }, + }, + ) + + if err != nil { + fmt.Printf("ChatCompletion error: %v\n", err) + return + } + + fmt.Println(resp.Choices[0].Message.Content) +} +``` +
diff --git a/vendor/github.com/sashabaranov/go-openai/audio.go b/vendor/github.com/sashabaranov/go-openai/audio.go new file mode 100644 index 00000000..46c37112 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/audio.go @@ -0,0 +1,145 @@ +package openai + +import ( + "bytes" + "context" + "fmt" + "net/http" + "os" +) + +// Whisper Defines the models provided by OpenAI to use when processing audio with OpenAI. +const ( + Whisper1 = "whisper-1" +) + +// Response formats; Whisper uses AudioResponseFormatJSON by default. +type AudioResponseFormat string + +const ( + AudioResponseFormatJSON AudioResponseFormat = "json" + AudioResponseFormatSRT AudioResponseFormat = "srt" + AudioResponseFormatVTT AudioResponseFormat = "vtt" +) + +// AudioRequest represents a request structure for audio API. +// ResponseFormat is not supported for now. We only return JSON text, which may be sufficient. +type AudioRequest struct { + Model string + FilePath string + Prompt string // For translation, it should be in English + Temperature float32 + Language string // For translation, just do not use it. It seems "en" works, not confirmed... + Format AudioResponseFormat +} + +// AudioResponse represents a response structure for audio API. +type AudioResponse struct { + Text string `json:"text"` +} + +// CreateTranscription — API call to create a transcription. Returns transcribed text. +func (c *Client) CreateTranscription( + ctx context.Context, + request AudioRequest, +) (response AudioResponse, err error) { + response, err = c.callAudioAPI(ctx, request, "transcriptions") + return +} + +// CreateTranslation — API call to translate audio into English. +func (c *Client) CreateTranslation( + ctx context.Context, + request AudioRequest, +) (response AudioResponse, err error) { + response, err = c.callAudioAPI(ctx, request, "translations") + return +} + +// callAudioAPI — API call to an audio endpoint. +func (c *Client) callAudioAPI( + ctx context.Context, + request AudioRequest, + endpointSuffix string, +) (response AudioResponse, err error) { + var formBody bytes.Buffer + builder := c.createFormBuilder(&formBody) + + if err = audioMultipartForm(request, builder); err != nil { + return + } + + urlSuffix := fmt.Sprintf("/audio/%s", endpointSuffix) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), &formBody) + if err != nil { + return + } + req.Header.Add("Content-Type", builder.formDataContentType()) + + if request.HasJSONResponse() { + err = c.sendRequest(req, &response) + } else { + err = c.sendRequest(req, &response.Text) + } + return +} + +// HasJSONResponse returns true if the response format is JSON. +func (r AudioRequest) HasJSONResponse() bool { + return r.Format == "" || r.Format == AudioResponseFormatJSON +} + +// audioMultipartForm creates a form with audio file contents and the name of the model to use for +// audio processing. +func audioMultipartForm(request AudioRequest, b formBuilder) error { + f, err := os.Open(request.FilePath) + if err != nil { + return fmt.Errorf("opening audio file: %w", err) + } + defer f.Close() + + err = b.createFormFile("file", f) + if err != nil { + return fmt.Errorf("creating form file: %w", err) + } + + err = b.writeField("model", request.Model) + if err != nil { + return fmt.Errorf("writing model name: %w", err) + } + + // Create a form field for the prompt (if provided) + if request.Prompt != "" { + err = b.writeField("prompt", request.Prompt) + if err != nil { + return fmt.Errorf("writing prompt: %w", err) + } + } + + // Create a form field for the format (if provided) + if request.Format != "" { + err = b.writeField("response_format", string(request.Format)) + if err != nil { + return fmt.Errorf("writing format: %w", err) + } + } + + // Create a form field for the temperature (if provided) + if request.Temperature != 0 { + err = b.writeField("temperature", fmt.Sprintf("%.2f", request.Temperature)) + if err != nil { + return fmt.Errorf("writing temperature: %w", err) + } + } + + // Create a form field for the language (if provided) + if request.Language != "" { + err = b.writeField("language", request.Language) + if err != nil { + return fmt.Errorf("writing language: %w", err) + } + } + + // Close the multipart writer + return b.close() +} diff --git a/vendor/github.com/sashabaranov/go-gpt3/chat.go b/vendor/github.com/sashabaranov/go-openai/chat.go similarity index 63% rename from vendor/github.com/sashabaranov/go-gpt3/chat.go rename to vendor/github.com/sashabaranov/go-openai/chat.go index 81e5a393..c09861c8 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/chat.go +++ b/vendor/github.com/sashabaranov/go-openai/chat.go @@ -1,20 +1,32 @@ -package gogpt +package openai import ( - "bytes" "context" - "encoding/json" "errors" "net/http" ) +// Chat message role defined by the OpenAI API. +const ( + ChatMessageRoleSystem = "system" + ChatMessageRoleUser = "user" + ChatMessageRoleAssistant = "assistant" +) + var ( - ErrChatCompletionInvalidModel = errors.New("currently, only gpt-3.5-turbo and gpt-3.5-turbo-0301 are supported") + ErrChatCompletionInvalidModel = errors.New("this model is not supported with this method, please use CreateCompletion client method instead") //nolint:lll + ErrChatCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateChatCompletionStream") //nolint:lll ) type ChatCompletionMessage struct { Role string `json:"role"` Content string `json:"content"` + + // This property isn't in the official documentation, but it's in + // the documentation for the official library for python: + // - https://github.com/openai/openai-python/blob/main/chatml.md + // - https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb + Name string `json:"name,omitempty"` } // ChatCompletionRequest represents a request structure for chat completion API. @@ -49,25 +61,23 @@ type ChatCompletionResponse struct { Usage Usage `json:"usage"` } -// CreateChatCompletion — API call to Creates a completion for the chat message. +// CreateChatCompletion — API call to Create a completion for the chat message. func (c *Client) CreateChatCompletion( ctx context.Context, request ChatCompletionRequest, ) (response ChatCompletionResponse, err error) { - model := request.Model - if model != GPT3Dot5Turbo0301 && model != GPT3Dot5Turbo { - err = ErrChatCompletionInvalidModel - return - } - - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { + if request.Stream { + err = ErrChatCompletionStreamNotSupported return } urlSuffix := "/chat/completions" - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes)) + if !checkEndpointSupportsModel(urlSuffix, request.Model) { + err = ErrChatCompletionInvalidModel + return + } + + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL(urlSuffix), request) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/chat_stream.go b/vendor/github.com/sashabaranov/go-openai/chat_stream.go new file mode 100644 index 00000000..b5257ccc --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/chat_stream.go @@ -0,0 +1,71 @@ +package openai + +import ( + "bufio" + "context" + "net/http" +) + +type ChatCompletionStreamChoiceDelta struct { + Content string `json:"content"` +} + +type ChatCompletionStreamChoice struct { + Index int `json:"index"` + Delta ChatCompletionStreamChoiceDelta `json:"delta"` + FinishReason string `json:"finish_reason"` +} + +type ChatCompletionStreamResponse struct { + ID string `json:"id"` + Object string `json:"object"` + Created int64 `json:"created"` + Model string `json:"model"` + Choices []ChatCompletionStreamChoice `json:"choices"` +} + +// ChatCompletionStream +// Note: Perhaps it is more elegant to abstract Stream using generics. +type ChatCompletionStream struct { + *streamReader[ChatCompletionStreamResponse] +} + +// CreateChatCompletionStream — API call to create a chat completion w/ streaming +// support. It sets whether to stream back partial progress. If set, tokens will be +// sent as data-only server-sent events as they become available, with the +// stream terminated by a data: [DONE] message. +func (c *Client) CreateChatCompletionStream( + ctx context.Context, + request ChatCompletionRequest, +) (stream *ChatCompletionStream, err error) { + urlSuffix := "/chat/completions" + if !checkEndpointSupportsModel(urlSuffix, request.Model) { + err = ErrChatCompletionInvalidModel + return + } + + request.Stream = true + req, err := c.newStreamRequest(ctx, "POST", urlSuffix, request) + if err != nil { + return + } + + resp, err := c.config.HTTPClient.Do(req) //nolint:bodyclose // body is closed in stream.Close() + if err != nil { + return + } + if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusBadRequest { + return nil, c.handleErrorResp(resp) + } + + stream = &ChatCompletionStream{ + streamReader: &streamReader[ChatCompletionStreamResponse]{ + emptyMessagesLimit: c.config.EmptyMessagesLimit, + reader: bufio.NewReader(resp.Body), + response: resp, + errAccumulator: newErrorAccumulator(), + unmarshaler: &jsonUnmarshaler{}, + }, + } + return +} diff --git a/vendor/github.com/sashabaranov/go-openai/client.go b/vendor/github.com/sashabaranov/go-openai/client.go new file mode 100644 index 00000000..500b3d56 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/client.go @@ -0,0 +1,158 @@ +package openai + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "strings" +) + +// Client is OpenAI GPT-3 API client. +type Client struct { + config ClientConfig + + requestBuilder requestBuilder + createFormBuilder func(io.Writer) formBuilder +} + +// NewClient creates new OpenAI API client. +func NewClient(authToken string) *Client { + config := DefaultConfig(authToken) + return NewClientWithConfig(config) +} + +// NewClientWithConfig creates new OpenAI API client for specified config. +func NewClientWithConfig(config ClientConfig) *Client { + return &Client{ + config: config, + requestBuilder: newRequestBuilder(), + createFormBuilder: func(body io.Writer) formBuilder { + return newFormBuilder(body) + }, + } +} + +// NewOrgClient creates new OpenAI API client for specified Organization ID. +// +// Deprecated: Please use NewClientWithConfig. +func NewOrgClient(authToken, org string) *Client { + config := DefaultConfig(authToken) + config.OrgID = org + return NewClientWithConfig(config) +} + +func (c *Client) sendRequest(req *http.Request, v any) error { + req.Header.Set("Accept", "application/json; charset=utf-8") + // Azure API Key authentication + if c.config.APIType == APITypeAzure { + req.Header.Set(AzureAPIKeyHeader, c.config.authToken) + } else { + // OpenAI or Azure AD authentication + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.config.authToken)) + } + + // Check whether Content-Type is already set, Upload Files API requires + // Content-Type == multipart/form-data + contentType := req.Header.Get("Content-Type") + if contentType == "" { + req.Header.Set("Content-Type", "application/json; charset=utf-8") + } + + if len(c.config.OrgID) > 0 { + req.Header.Set("OpenAI-Organization", c.config.OrgID) + } + + res, err := c.config.HTTPClient.Do(req) + if err != nil { + return err + } + + defer res.Body.Close() + + if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest { + return c.handleErrorResp(res) + } + + return decodeResponse(res.Body, v) +} + +func decodeResponse(body io.Reader, v any) error { + if v == nil { + return nil + } + + if result, ok := v.(*string); ok { + return decodeString(body, result) + } + return json.NewDecoder(body).Decode(v) +} + +func decodeString(body io.Reader, output *string) error { + b, err := io.ReadAll(body) + if err != nil { + return err + } + *output = string(b) + return nil +} + +func (c *Client) fullURL(suffix string) string { + // /openai/deployments/{engine}/chat/completions?api-version={api_version} + if c.config.APIType == APITypeAzure || c.config.APIType == APITypeAzureAD { + baseURL := c.config.BaseURL + baseURL = strings.TrimRight(baseURL, "/") + return fmt.Sprintf("%s/%s/%s/%s%s?api-version=%s", + baseURL, azureAPIPrefix, azureDeploymentsPrefix, c.config.Engine, suffix, c.config.APIVersion) + } + + // c.config.APIType == APITypeOpenAI || c.config.APIType == "" + return fmt.Sprintf("%s%s", c.config.BaseURL, suffix) +} + +func (c *Client) newStreamRequest( + ctx context.Context, + method string, + urlSuffix string, + body any) (*http.Request, error) { + req, err := c.requestBuilder.build(ctx, method, c.fullURL(urlSuffix), body) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Accept", "text/event-stream") + req.Header.Set("Cache-Control", "no-cache") + req.Header.Set("Connection", "keep-alive") + + // https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#authentication + // Azure API Key authentication + if c.config.APIType == APITypeAzure { + req.Header.Set(AzureAPIKeyHeader, c.config.authToken) + } else { + // OpenAI or Azure AD authentication + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.config.authToken)) + } + if c.config.OrgID != "" { + req.Header.Set("OpenAI-Organization", c.config.OrgID) + } + return req, nil +} + +func (c *Client) handleErrorResp(resp *http.Response) error { + var errRes ErrorResponse + err := json.NewDecoder(resp.Body).Decode(&errRes) + if err != nil || errRes.Error == nil { + reqErr := RequestError{ + HTTPStatusCode: resp.StatusCode, + Err: err, + } + if errRes.Error != nil { + reqErr.Err = errRes.Error + } + return fmt.Errorf("error, %w", &reqErr) + } + errRes.Error.HTTPStatusCode = resp.StatusCode + return fmt.Errorf("error, status code: %d, message: %w", resp.StatusCode, errRes.Error) +} diff --git a/vendor/github.com/sashabaranov/go-gpt3/common.go b/vendor/github.com/sashabaranov/go-openai/common.go similarity index 95% rename from vendor/github.com/sashabaranov/go-gpt3/common.go rename to vendor/github.com/sashabaranov/go-openai/common.go index 9fb01780..3b555a7b 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/common.go +++ b/vendor/github.com/sashabaranov/go-openai/common.go @@ -1,5 +1,5 @@ // common.go defines common types used throughout the OpenAI API. -package gogpt +package openai // Usage Represents the total token usage per request to OpenAI. type Usage struct { diff --git a/vendor/github.com/sashabaranov/go-gpt3/completion.go b/vendor/github.com/sashabaranov/go-openai/completion.go similarity index 63% rename from vendor/github.com/sashabaranov/go-gpt3/completion.go rename to vendor/github.com/sashabaranov/go-openai/completion.go index 74762c95..5eec88c2 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/completion.go +++ b/vendor/github.com/sashabaranov/go-openai/completion.go @@ -1,17 +1,26 @@ -package gogpt +package openai import ( - "bytes" "context" - "encoding/json" + "errors" "net/http" ) +var ( + ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll + ErrCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateCompletionStream") //nolint:lll + ErrCompletionRequestPromptTypeNotSupported = errors.New("the type of CompletionRequest.Prompt only supports string and []string") //nolint:lll +) + // GPT3 Defines the models provided by OpenAI to use when generating // completions from OpenAI. // GPT3 Models are designed for text-based tasks. For code-specific // tasks, please refer to the Codex series of models. const ( + GPT432K0314 = "gpt-4-32k-0314" + GPT432K = "gpt-4-32k" + GPT40314 = "gpt-4-0314" + GPT4 = "gpt-4" GPT3Dot5Turbo0301 = "gpt-3.5-turbo-0301" GPT3Dot5Turbo = "gpt-3.5-turbo" GPT3TextDavinci003 = "text-davinci-003" @@ -37,10 +46,48 @@ const ( CodexCodeDavinci001 = "code-davinci-001" ) +var disabledModelsForEndpoints = map[string]map[string]bool{ + "/completions": { + GPT3Dot5Turbo: true, + GPT3Dot5Turbo0301: true, + GPT4: true, + GPT40314: true, + GPT432K: true, + GPT432K0314: true, + }, + "/chat/completions": { + CodexCodeDavinci002: true, + CodexCodeCushman001: true, + CodexCodeDavinci001: true, + GPT3TextDavinci003: true, + GPT3TextDavinci002: true, + GPT3TextCurie001: true, + GPT3TextBabbage001: true, + GPT3TextAda001: true, + GPT3TextDavinci001: true, + GPT3DavinciInstructBeta: true, + GPT3Davinci: true, + GPT3CurieInstructBeta: true, + GPT3Curie: true, + GPT3Ada: true, + GPT3Babbage: true, + }, +} + +func checkEndpointSupportsModel(endpoint, model string) bool { + return !disabledModelsForEndpoints[endpoint][model] +} + +func checkPromptType(prompt any) bool { + _, isString := prompt.(string) + _, isStringSlice := prompt.([]string) + return isString || isStringSlice +} + // CompletionRequest represents a request structure for completion API. type CompletionRequest struct { Model string `json:"model"` - Prompt string `json:"prompt,omitempty"` + Prompt any `json:"prompt,omitempty"` Suffix string `json:"suffix,omitempty"` MaxTokens int `json:"max_tokens,omitempty"` Temperature float32 `json:"temperature,omitempty"` @@ -92,14 +139,23 @@ func (c *Client) CreateCompletion( ctx context.Context, request CompletionRequest, ) (response CompletionResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { + if request.Stream { + err = ErrCompletionStreamNotSupported return } urlSuffix := "/completions" - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes)) + if !checkEndpointSupportsModel(urlSuffix, request.Model) { + err = ErrCompletionUnsupportedModel + return + } + + if !checkPromptType(request.Prompt) { + err = ErrCompletionRequestPromptTypeNotSupported + return + } + + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL(urlSuffix), request) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/config.go b/vendor/github.com/sashabaranov/go-openai/config.go new file mode 100644 index 00000000..c800df15 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/config.go @@ -0,0 +1,70 @@ +package openai + +import ( + "net/http" +) + +const ( + openaiAPIURLv1 = "https://api.openai.com/v1" + defaultEmptyMessagesLimit uint = 300 + + azureAPIPrefix = "openai" + azureDeploymentsPrefix = "deployments" +) + +type APIType string + +const ( + APITypeOpenAI APIType = "OPEN_AI" + APITypeAzure APIType = "AZURE" + APITypeAzureAD APIType = "AZURE_AD" +) + +const AzureAPIKeyHeader = "api-key" + +// ClientConfig is a configuration of a client. +type ClientConfig struct { + authToken string + + BaseURL string + OrgID string + APIType APIType + APIVersion string // required when APIType is APITypeAzure or APITypeAzureAD + Engine string // required when APIType is APITypeAzure or APITypeAzureAD + + HTTPClient *http.Client + + EmptyMessagesLimit uint +} + +func DefaultConfig(authToken string) ClientConfig { + return ClientConfig{ + authToken: authToken, + BaseURL: openaiAPIURLv1, + APIType: APITypeOpenAI, + OrgID: "", + + HTTPClient: &http.Client{}, + + EmptyMessagesLimit: defaultEmptyMessagesLimit, + } +} + +func DefaultAzureConfig(apiKey, baseURL, engine string) ClientConfig { + return ClientConfig{ + authToken: apiKey, + BaseURL: baseURL, + OrgID: "", + APIType: APITypeAzure, + APIVersion: "2023-03-15-preview", + Engine: engine, + + HTTPClient: &http.Client{}, + + EmptyMessagesLimit: defaultEmptyMessagesLimit, + } +} + +func (ClientConfig) String() string { + return "" +} diff --git a/vendor/github.com/sashabaranov/go-gpt3/edits.go b/vendor/github.com/sashabaranov/go-openai/edits.go similarity index 81% rename from vendor/github.com/sashabaranov/go-gpt3/edits.go rename to vendor/github.com/sashabaranov/go-openai/edits.go index 8cfc21c0..858a8e53 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/edits.go +++ b/vendor/github.com/sashabaranov/go-openai/edits.go @@ -1,9 +1,7 @@ -package gogpt +package openai import ( - "bytes" "context" - "encoding/json" "net/http" ) @@ -33,13 +31,7 @@ type EditsResponse struct { // Perform an API call to the Edits endpoint. func (c *Client) Edits(ctx context.Context, request EditsRequest) (response EditsResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { - return - } - - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL("/edits"), bytes.NewBuffer(reqBytes)) + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL("/edits"), request) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-gpt3/embeddings.go b/vendor/github.com/sashabaranov/go-openai/embeddings.go similarity index 94% rename from vendor/github.com/sashabaranov/go-gpt3/embeddings.go rename to vendor/github.com/sashabaranov/go-openai/embeddings.go index bfdb802f..2deaccc3 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/embeddings.go +++ b/vendor/github.com/sashabaranov/go-openai/embeddings.go @@ -1,9 +1,7 @@ -package gogpt +package openai import ( - "bytes" "context" - "encoding/json" "net/http" ) @@ -103,7 +101,7 @@ var stringToEnum = map[string]EmbeddingModel{ // then their vector representations should also be similar. type Embedding struct { Object string `json:"object"` - Embedding []float64 `json:"embedding"` + Embedding []float32 `json:"embedding"` Index int `json:"index"` } @@ -134,14 +132,7 @@ type EmbeddingRequest struct { // CreateEmbeddings returns an EmbeddingResponse which will contain an Embedding for every item in |request.Input|. // https://beta.openai.com/docs/api-reference/embeddings/create func (c *Client) CreateEmbeddings(ctx context.Context, request EmbeddingRequest) (resp EmbeddingResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { - return - } - - urlSuffix := "/embeddings" - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), bytes.NewBuffer(reqBytes)) + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL("/embeddings"), request) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-gpt3/engines.go b/vendor/github.com/sashabaranov/go-openai/engines.go similarity index 83% rename from vendor/github.com/sashabaranov/go-gpt3/engines.go rename to vendor/github.com/sashabaranov/go-openai/engines.go index 2805f153..bb6a66ce 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/engines.go +++ b/vendor/github.com/sashabaranov/go-openai/engines.go @@ -1,4 +1,4 @@ -package gogpt +package openai import ( "context" @@ -22,7 +22,7 @@ type EnginesList struct { // ListEngines Lists the currently available engines, and provides basic // information about each option such as the owner and availability. func (c *Client) ListEngines(ctx context.Context) (engines EnginesList, err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.fullURL("/engines"), nil) + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL("/engines"), nil) if err != nil { return } @@ -38,7 +38,7 @@ func (c *Client) GetEngine( engineID string, ) (engine Engine, err error) { urlSuffix := fmt.Sprintf("/engines/%s", engineID) - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.fullURL(urlSuffix), nil) + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL(urlSuffix), nil) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/error.go b/vendor/github.com/sashabaranov/go-openai/error.go new file mode 100644 index 00000000..86b75f4b --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/error.go @@ -0,0 +1,78 @@ +package openai + +import ( + "encoding/json" + "fmt" +) + +// APIError provides error information returned by the OpenAI API. +type APIError struct { + Code any `json:"code,omitempty"` + Message string `json:"message"` + Param *string `json:"param,omitempty"` + Type string `json:"type"` + HTTPStatusCode int `json:"-"` +} + +// RequestError provides informations about generic request errors. +type RequestError struct { + HTTPStatusCode int + Err error +} + +type ErrorResponse struct { + Error *APIError `json:"error,omitempty"` +} + +func (e *APIError) Error() string { + return e.Message +} + +func (e *APIError) UnmarshalJSON(data []byte) (err error) { + var rawMap map[string]json.RawMessage + err = json.Unmarshal(data, &rawMap) + if err != nil { + return + } + + err = json.Unmarshal(rawMap["message"], &e.Message) + if err != nil { + return + } + + err = json.Unmarshal(rawMap["type"], &e.Type) + if err != nil { + return + } + + // optional fields + if _, ok := rawMap["param"]; ok { + err = json.Unmarshal(rawMap["param"], &e.Param) + if err != nil { + return + } + } + + if _, ok := rawMap["code"]; !ok { + return nil + } + + // if the api returned a number, we need to force an integer + // since the json package defaults to float64 + var intCode int + err = json.Unmarshal(rawMap["code"], &intCode) + if err == nil { + e.Code = intCode + return nil + } + + return json.Unmarshal(rawMap["code"], &e.Code) +} + +func (e *RequestError) Error() string { + return fmt.Sprintf("status code %d, message: %s", e.HTTPStatusCode, e.Err) +} + +func (e *RequestError) Unwrap() error { + return e.Err +} diff --git a/vendor/github.com/sashabaranov/go-openai/error_accumulator.go b/vendor/github.com/sashabaranov/go-openai/error_accumulator.go new file mode 100644 index 00000000..ca6cec6e --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/error_accumulator.go @@ -0,0 +1,51 @@ +package openai + +import ( + "bytes" + "fmt" + "io" +) + +type errorAccumulator interface { + write(p []byte) error + unmarshalError() *ErrorResponse +} + +type errorBuffer interface { + io.Writer + Len() int + Bytes() []byte +} + +type defaultErrorAccumulator struct { + buffer errorBuffer + unmarshaler unmarshaler +} + +func newErrorAccumulator() errorAccumulator { + return &defaultErrorAccumulator{ + buffer: &bytes.Buffer{}, + unmarshaler: &jsonUnmarshaler{}, + } +} + +func (e *defaultErrorAccumulator) write(p []byte) error { + _, err := e.buffer.Write(p) + if err != nil { + return fmt.Errorf("error accumulator write error, %w", err) + } + return nil +} + +func (e *defaultErrorAccumulator) unmarshalError() (errResp *ErrorResponse) { + if e.buffer.Len() == 0 { + return + } + + err := e.unmarshaler.unmarshal(e.buffer.Bytes(), &errResp) + if err != nil { + errResp = nil + } + + return +} diff --git a/vendor/github.com/sashabaranov/go-gpt3/files.go b/vendor/github.com/sashabaranov/go-openai/files.go similarity index 56% rename from vendor/github.com/sashabaranov/go-gpt3/files.go rename to vendor/github.com/sashabaranov/go-openai/files.go index 385bb529..b701b945 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/files.go +++ b/vendor/github.com/sashabaranov/go-openai/files.go @@ -1,13 +1,10 @@ -package gogpt +package openai import ( "bytes" "context" "fmt" - "io" - "mime/multipart" "net/http" - "net/url" "os" ) @@ -33,77 +30,38 @@ type FilesList struct { Files []File `json:"data"` } -// isUrl is a helper function that determines whether the given FilePath -// is a remote URL or a local file path. -func isURL(path string) bool { - _, err := url.ParseRequestURI(path) - if err != nil { - return false - } - - u, err := url.Parse(path) - if err != nil || u.Scheme == "" || u.Host == "" { - return false - } - - return true -} - // CreateFile uploads a jsonl file to GPT3 -// FilePath can be either a local file path or a URL. +// FilePath must be a local file path. func (c *Client) CreateFile(ctx context.Context, request FileRequest) (file File, err error) { var b bytes.Buffer - w := multipart.NewWriter(&b) + builder := c.createFormBuilder(&b) - var fw io.Writer - - err = w.WriteField("purpose", request.Purpose) + err = builder.writeField("purpose", request.Purpose) if err != nil { return } - fw, err = w.CreateFormFile("file", request.FileName) + fileData, err := os.Open(request.FilePath) if err != nil { return } - var fileData io.ReadCloser - if isURL(request.FilePath) { - var remoteFile *http.Response - remoteFile, err = http.Get(request.FilePath) - if err != nil { - return - } - - defer remoteFile.Body.Close() - - // Check server response - if remoteFile.StatusCode != http.StatusOK { - err = fmt.Errorf("error, status code: %d, message: failed to fetch file", remoteFile.StatusCode) - return - } - - fileData = remoteFile.Body - } else { - fileData, err = os.Open(request.FilePath) - if err != nil { - return - } - } - - _, err = io.Copy(fw, fileData) + err = builder.createFormFile("file", fileData) if err != nil { return } - w.Close() + err = builder.close() + if err != nil { + return + } req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL("/files"), &b) if err != nil { return } - req.Header.Set("Content-Type", w.FormDataContentType()) + req.Header.Set("Content-Type", builder.formDataContentType()) err = c.sendRequest(req, &file) @@ -112,7 +70,7 @@ func (c *Client) CreateFile(ctx context.Context, request FileRequest) (file File // DeleteFile deletes an existing file. func (c *Client) DeleteFile(ctx context.Context, fileID string) (err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodDelete, c.fullURL("/files/"+fileID), nil) + req, err := c.requestBuilder.build(ctx, http.MethodDelete, c.fullURL("/files/"+fileID), nil) if err != nil { return } @@ -124,7 +82,7 @@ func (c *Client) DeleteFile(ctx context.Context, fileID string) (err error) { // ListFiles Lists the currently available files, // and provides basic information about each file such as the file name and purpose. func (c *Client) ListFiles(ctx context.Context) (files FilesList, err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.fullURL("/files"), nil) + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL("/files"), nil) if err != nil { return } @@ -137,7 +95,7 @@ func (c *Client) ListFiles(ctx context.Context) (files FilesList, err error) { // such as the file name and purpose. func (c *Client) GetFile(ctx context.Context, fileID string) (file File, err error) { urlSuffix := fmt.Sprintf("/files/%s", fileID) - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.fullURL(urlSuffix), nil) + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL(urlSuffix), nil) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/fine_tunes.go b/vendor/github.com/sashabaranov/go-openai/fine_tunes.go new file mode 100644 index 00000000..a1218670 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/fine_tunes.go @@ -0,0 +1,130 @@ +package openai + +import ( + "context" + "fmt" + "net/http" +) + +type FineTuneRequest struct { + TrainingFile string `json:"training_file"` + ValidationFile string `json:"validation_file,omitempty"` + Model string `json:"model,omitempty"` + Epochs int `json:"n_epochs,omitempty"` + BatchSize int `json:"batch_size,omitempty"` + LearningRateMultiplier float32 `json:"learning_rate_multiplier,omitempty"` + PromptLossRate float32 `json:"prompt_loss_rate,omitempty"` + ComputeClassificationMetrics bool `json:"compute_classification_metrics,omitempty"` + ClassificationClasses int `json:"classification_n_classes,omitempty"` + ClassificationPositiveClass string `json:"classification_positive_class,omitempty"` + ClassificationBetas []float32 `json:"classification_betas,omitempty"` + Suffix string `json:"suffix,omitempty"` +} + +type FineTune struct { + ID string `json:"id"` + Object string `json:"object"` + Model string `json:"model"` + CreatedAt int64 `json:"created_at"` + FineTuneEventList []FineTuneEvent `json:"events,omitempty"` + FineTunedModel string `json:"fine_tuned_model"` + HyperParams FineTuneHyperParams `json:"hyperparams"` + OrganizationID string `json:"organization_id"` + ResultFiles []File `json:"result_files"` + Status string `json:"status"` + ValidationFiles []File `json:"validation_files"` + TrainingFiles []File `json:"training_files"` + UpdatedAt int64 `json:"updated_at"` +} + +type FineTuneEvent struct { + Object string `json:"object"` + CreatedAt int64 `json:"created_at"` + Level string `json:"level"` + Message string `json:"message"` +} + +type FineTuneHyperParams struct { + BatchSize int `json:"batch_size"` + LearningRateMultiplier float64 `json:"learning_rate_multiplier"` + Epochs int `json:"n_epochs"` + PromptLossWeight float64 `json:"prompt_loss_weight"` +} + +type FineTuneList struct { + Object string `json:"object"` + Data []FineTune `json:"data"` +} +type FineTuneEventList struct { + Object string `json:"object"` + Data []FineTuneEvent `json:"data"` +} + +type FineTuneDeleteResponse struct { + ID string `json:"id"` + Object string `json:"object"` + Deleted bool `json:"deleted"` +} + +func (c *Client) CreateFineTune(ctx context.Context, request FineTuneRequest) (response FineTune, err error) { + urlSuffix := "/fine-tunes" + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL(urlSuffix), request) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} + +// CancelFineTune cancel a fine-tune job. +func (c *Client) CancelFineTune(ctx context.Context, fineTuneID string) (response FineTune, err error) { + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL("/fine-tunes/"+fineTuneID+"/cancel"), nil) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} + +func (c *Client) ListFineTunes(ctx context.Context) (response FineTuneList, err error) { + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL("/fine-tunes"), nil) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} + +func (c *Client) GetFineTune(ctx context.Context, fineTuneID string) (response FineTune, err error) { + urlSuffix := fmt.Sprintf("/fine-tunes/%s", fineTuneID) + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL(urlSuffix), nil) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} + +func (c *Client) DeleteFineTune(ctx context.Context, fineTuneID string) (response FineTuneDeleteResponse, err error) { + req, err := c.requestBuilder.build(ctx, http.MethodDelete, c.fullURL("/fine-tunes/"+fineTuneID), nil) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} + +func (c *Client) ListFineTuneEvents(ctx context.Context, fineTuneID string) (response FineTuneEventList, err error) { + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL("/fine-tunes/"+fineTuneID+"/events"), nil) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} diff --git a/vendor/github.com/sashabaranov/go-openai/form_builder.go b/vendor/github.com/sashabaranov/go-openai/form_builder.go new file mode 100644 index 00000000..7fbb1643 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/form_builder.go @@ -0,0 +1,49 @@ +package openai + +import ( + "io" + "mime/multipart" + "os" +) + +type formBuilder interface { + createFormFile(fieldname string, file *os.File) error + writeField(fieldname, value string) error + close() error + formDataContentType() string +} + +type defaultFormBuilder struct { + writer *multipart.Writer +} + +func newFormBuilder(body io.Writer) *defaultFormBuilder { + return &defaultFormBuilder{ + writer: multipart.NewWriter(body), + } +} + +func (fb *defaultFormBuilder) createFormFile(fieldname string, file *os.File) error { + fieldWriter, err := fb.writer.CreateFormFile(fieldname, file.Name()) + if err != nil { + return err + } + + _, err = io.Copy(fieldWriter, file) + if err != nil { + return err + } + return nil +} + +func (fb *defaultFormBuilder) writeField(fieldname, value string) error { + return fb.writer.WriteField(fieldname, value) +} + +func (fb *defaultFormBuilder) close() error { + return fb.writer.Close() +} + +func (fb *defaultFormBuilder) formDataContentType() string { + return fb.writer.FormDataContentType() +} diff --git a/vendor/github.com/sashabaranov/go-openai/image.go b/vendor/github.com/sashabaranov/go-openai/image.go new file mode 100644 index 00000000..21703bda --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/image.go @@ -0,0 +1,171 @@ +package openai + +import ( + "bytes" + "context" + "net/http" + "os" + "strconv" +) + +// Image sizes defined by the OpenAI API. +const ( + CreateImageSize256x256 = "256x256" + CreateImageSize512x512 = "512x512" + CreateImageSize1024x1024 = "1024x1024" +) + +const ( + CreateImageResponseFormatURL = "url" + CreateImageResponseFormatB64JSON = "b64_json" +) + +// ImageRequest represents the request structure for the image API. +type ImageRequest struct { + Prompt string `json:"prompt,omitempty"` + N int `json:"n,omitempty"` + Size string `json:"size,omitempty"` + ResponseFormat string `json:"response_format,omitempty"` + User string `json:"user,omitempty"` +} + +// ImageResponse represents a response structure for image API. +type ImageResponse struct { + Created int64 `json:"created,omitempty"` + Data []ImageResponseDataInner `json:"data,omitempty"` +} + +// ImageResponseDataInner represents a response data structure for image API. +type ImageResponseDataInner struct { + URL string `json:"url,omitempty"` + B64JSON string `json:"b64_json,omitempty"` +} + +// CreateImage - API call to create an image. This is the main endpoint of the DALL-E API. +func (c *Client) CreateImage(ctx context.Context, request ImageRequest) (response ImageResponse, err error) { + urlSuffix := "/images/generations" + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL(urlSuffix), request) + if err != nil { + return + } + + err = c.sendRequest(req, &response) + return +} + +// ImageEditRequest represents the request structure for the image API. +type ImageEditRequest struct { + Image *os.File `json:"image,omitempty"` + Mask *os.File `json:"mask,omitempty"` + Prompt string `json:"prompt,omitempty"` + N int `json:"n,omitempty"` + Size string `json:"size,omitempty"` + ResponseFormat string `json:"response_format,omitempty"` +} + +// CreateEditImage - API call to create an image. This is the main endpoint of the DALL-E API. +func (c *Client) CreateEditImage(ctx context.Context, request ImageEditRequest) (response ImageResponse, err error) { + body := &bytes.Buffer{} + builder := c.createFormBuilder(body) + + // image + err = builder.createFormFile("image", request.Image) + if err != nil { + return + } + + // mask, it is optional + if request.Mask != nil { + err = builder.createFormFile("mask", request.Mask) + if err != nil { + return + } + } + + err = builder.writeField("prompt", request.Prompt) + if err != nil { + return + } + + err = builder.writeField("n", strconv.Itoa(request.N)) + if err != nil { + return + } + + err = builder.writeField("size", request.Size) + if err != nil { + return + } + + err = builder.writeField("response_format", request.ResponseFormat) + if err != nil { + return + } + + err = builder.close() + if err != nil { + return + } + + urlSuffix := "/images/edits" + req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), body) + if err != nil { + return + } + + req.Header.Set("Content-Type", builder.formDataContentType()) + err = c.sendRequest(req, &response) + return +} + +// ImageVariRequest represents the request structure for the image API. +type ImageVariRequest struct { + Image *os.File `json:"image,omitempty"` + N int `json:"n,omitempty"` + Size string `json:"size,omitempty"` + ResponseFormat string `json:"response_format,omitempty"` +} + +// CreateVariImage - API call to create an image variation. This is the main endpoint of the DALL-E API. +// Use abbreviations(vari for variation) because ci-lint has a single-line length limit ... +func (c *Client) CreateVariImage(ctx context.Context, request ImageVariRequest) (response ImageResponse, err error) { + body := &bytes.Buffer{} + builder := c.createFormBuilder(body) + + // image + err = builder.createFormFile("image", request.Image) + if err != nil { + return + } + + err = builder.writeField("n", strconv.Itoa(request.N)) + if err != nil { + return + } + + err = builder.writeField("size", request.Size) + if err != nil { + return + } + + err = builder.writeField("response_format", request.ResponseFormat) + if err != nil { + return + } + + err = builder.close() + if err != nil { + return + } + + //https://platform.openai.com/docs/api-reference/images/create-variation + urlSuffix := "/images/variations" + req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL(urlSuffix), body) + if err != nil { + return + } + + req.Header.Set("Content-Type", builder.formDataContentType()) + err = c.sendRequest(req, &response) + return +} diff --git a/vendor/github.com/sashabaranov/go-openai/marshaller.go b/vendor/github.com/sashabaranov/go-openai/marshaller.go new file mode 100644 index 00000000..308ccd15 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/marshaller.go @@ -0,0 +1,15 @@ +package openai + +import ( + "encoding/json" +) + +type marshaller interface { + marshal(value any) ([]byte, error) +} + +type jsonMarshaller struct{} + +func (jm *jsonMarshaller) marshal(value any) ([]byte, error) { + return json.Marshal(value) +} diff --git a/vendor/github.com/sashabaranov/go-gpt3/models.go b/vendor/github.com/sashabaranov/go-openai/models.go similarity index 88% rename from vendor/github.com/sashabaranov/go-gpt3/models.go rename to vendor/github.com/sashabaranov/go-openai/models.go index c18e502a..2be91aad 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/models.go +++ b/vendor/github.com/sashabaranov/go-openai/models.go @@ -1,4 +1,4 @@ -package gogpt +package openai import ( "context" @@ -7,7 +7,7 @@ import ( // Model struct represents an OpenAPI model. type Model struct { - CreatedAt int64 `json:"created_at"` + CreatedAt int64 `json:"created"` ID string `json:"id"` Object string `json:"object"` OwnedBy string `json:"owned_by"` @@ -18,7 +18,7 @@ type Model struct { // Permission struct represents an OpenAPI permission. type Permission struct { - CreatedAt int64 `json:"created_at"` + CreatedAt int64 `json:"created"` ID string `json:"id"` Object string `json:"object"` AllowCreateEngine bool `json:"allow_create_engine"` @@ -40,7 +40,7 @@ type ModelsList struct { // ListModels Lists the currently available models, // and provides basic information about each model such as the model id and parent. func (c *Client) ListModels(ctx context.Context) (models ModelsList, err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.fullURL("/models"), nil) + req, err := c.requestBuilder.build(ctx, http.MethodGet, c.fullURL("/models"), nil) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-gpt3/moderation.go b/vendor/github.com/sashabaranov/go-openai/moderation.go similarity index 65% rename from vendor/github.com/sashabaranov/go-gpt3/moderation.go rename to vendor/github.com/sashabaranov/go-openai/moderation.go index 1849e106..b386ddb9 100644 --- a/vendor/github.com/sashabaranov/go-gpt3/moderation.go +++ b/vendor/github.com/sashabaranov/go-openai/moderation.go @@ -1,16 +1,27 @@ -package gogpt +package openai import ( - "bytes" "context" - "encoding/json" "net/http" ) +// The moderation endpoint is a tool you can use to check whether content complies with OpenAI's usage policies. +// Developers can thus identify content that our usage policies prohibits and take action, for instance by filtering it. + +// The default is text-moderation-latest which will be automatically upgraded over time. +// This ensures you are always using our most accurate model. +// If you use text-moderation-stable, we will provide advanced notice before updating the model. +// Accuracy of text-moderation-stable may be slightly lower than for text-moderation-latest. +const ( + ModerationTextStable = "text-moderation-stable" + ModerationTextLatest = "text-moderation-latest" + ModerationText001 = "text-moderation-001" +) + // ModerationRequest represents a request structure for moderation API. type ModerationRequest struct { - Input string `json:"input,omitempty"` - Model *string `json:"model,omitempty"` + Input string `json:"input,omitempty"` + Model string `json:"model,omitempty"` } // Result represents one of possible moderation results. @@ -52,13 +63,7 @@ type ModerationResponse struct { // Moderations — perform a moderation api call over a string. // Input can be an array or slice but a string will reduce the complexity. func (c *Client) Moderations(ctx context.Context, request ModerationRequest) (response ModerationResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { - return - } - - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL("/moderations"), bytes.NewBuffer(reqBytes)) + req, err := c.requestBuilder.build(ctx, http.MethodPost, c.fullURL("/moderations"), request) if err != nil { return } diff --git a/vendor/github.com/sashabaranov/go-openai/request_builder.go b/vendor/github.com/sashabaranov/go-openai/request_builder.go new file mode 100644 index 00000000..f0cef10f --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/request_builder.go @@ -0,0 +1,40 @@ +package openai + +import ( + "bytes" + "context" + "net/http" +) + +type requestBuilder interface { + build(ctx context.Context, method, url string, request any) (*http.Request, error) +} + +type httpRequestBuilder struct { + marshaller marshaller +} + +func newRequestBuilder() *httpRequestBuilder { + return &httpRequestBuilder{ + marshaller: &jsonMarshaller{}, + } +} + +func (b *httpRequestBuilder) build(ctx context.Context, method, url string, request any) (*http.Request, error) { + if request == nil { + return http.NewRequestWithContext(ctx, method, url, nil) + } + + var reqBytes []byte + reqBytes, err := b.marshaller.marshal(request) + if err != nil { + return nil, err + } + + return http.NewRequestWithContext( + ctx, + method, + url, + bytes.NewBuffer(reqBytes), + ) +} diff --git a/vendor/github.com/sashabaranov/go-openai/stream.go b/vendor/github.com/sashabaranov/go-openai/stream.go new file mode 100644 index 00000000..95662db6 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/stream.go @@ -0,0 +1,61 @@ +package openai + +import ( + "bufio" + "context" + "errors" + "net/http" +) + +var ( + ErrTooManyEmptyStreamMessages = errors.New("stream has sent too many empty messages") +) + +type CompletionStream struct { + *streamReader[CompletionResponse] +} + +// CreateCompletionStream — API call to create a completion w/ streaming +// support. It sets whether to stream back partial progress. If set, tokens will be +// sent as data-only server-sent events as they become available, with the +// stream terminated by a data: [DONE] message. +func (c *Client) CreateCompletionStream( + ctx context.Context, + request CompletionRequest, +) (stream *CompletionStream, err error) { + urlSuffix := "/completions" + if !checkEndpointSupportsModel(urlSuffix, request.Model) { + err = ErrCompletionUnsupportedModel + return + } + + if !checkPromptType(request.Prompt) { + err = ErrCompletionRequestPromptTypeNotSupported + return + } + + request.Stream = true + req, err := c.newStreamRequest(ctx, "POST", urlSuffix, request) + if err != nil { + return + } + + resp, err := c.config.HTTPClient.Do(req) //nolint:bodyclose // body is closed in stream.Close() + if err != nil { + return + } + if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusBadRequest { + return nil, c.handleErrorResp(resp) + } + + stream = &CompletionStream{ + streamReader: &streamReader[CompletionResponse]{ + emptyMessagesLimit: c.config.EmptyMessagesLimit, + reader: bufio.NewReader(resp.Body), + response: resp, + errAccumulator: newErrorAccumulator(), + unmarshaler: &jsonUnmarshaler{}, + }, + } + return +} diff --git a/vendor/github.com/sashabaranov/go-openai/stream_reader.go b/vendor/github.com/sashabaranov/go-openai/stream_reader.go new file mode 100644 index 00000000..aa06f00a --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/stream_reader.go @@ -0,0 +1,72 @@ +package openai + +import ( + "bufio" + "bytes" + "fmt" + "io" + "net/http" +) + +type streamable interface { + ChatCompletionStreamResponse | CompletionResponse +} + +type streamReader[T streamable] struct { + emptyMessagesLimit uint + isFinished bool + + reader *bufio.Reader + response *http.Response + errAccumulator errorAccumulator + unmarshaler unmarshaler +} + +func (stream *streamReader[T]) Recv() (response T, err error) { + if stream.isFinished { + err = io.EOF + return + } + + var emptyMessagesCount uint + +waitForData: + line, err := stream.reader.ReadBytes('\n') + if err != nil { + respErr := stream.errAccumulator.unmarshalError() + if respErr != nil { + err = fmt.Errorf("error, %w", respErr.Error) + } + return + } + + var headerData = []byte("data: ") + line = bytes.TrimSpace(line) + if !bytes.HasPrefix(line, headerData) { + if writeErr := stream.errAccumulator.write(line); writeErr != nil { + err = writeErr + return + } + emptyMessagesCount++ + if emptyMessagesCount > stream.emptyMessagesLimit { + err = ErrTooManyEmptyStreamMessages + return + } + + goto waitForData + } + + line = bytes.TrimPrefix(line, headerData) + if string(line) == "[DONE]" { + stream.isFinished = true + err = io.EOF + return + } + + err = stream.unmarshaler.unmarshal(line, &response) + return +} + +func (stream *streamReader[T]) Close() { + stream.response.Body.Close() +} diff --git a/vendor/github.com/sashabaranov/go-openai/unmarshaler.go b/vendor/github.com/sashabaranov/go-openai/unmarshaler.go new file mode 100644 index 00000000..05218f76 --- /dev/null +++ b/vendor/github.com/sashabaranov/go-openai/unmarshaler.go @@ -0,0 +1,15 @@ +package openai + +import ( + "encoding/json" +) + +type unmarshaler interface { + unmarshal(data []byte, v any) error +} + +type jsonUnmarshaler struct{} + +func (jm *jsonUnmarshaler) unmarshal(data []byte, v any) error { + return json.Unmarshal(data, v) +} diff --git a/vendor/github.com/toorop/go-dkim/.gitignore b/vendor/github.com/toorop/go-dkim/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/toorop/go-dkim/LICENSE b/vendor/github.com/toorop/go-dkim/LICENSE new file mode 100644 index 00000000..f1afb74f --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Stéphane Depierrepont + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/github.com/toorop/go-dkim/README.md b/vendor/github.com/toorop/go-dkim/README.md new file mode 100644 index 00000000..49567395 --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/README.md @@ -0,0 +1,56 @@ +# go-dkim +DKIM package for Golang + +[![GoDoc](https://godoc.org/github.com/toorop/go-dkim?status.svg)](https://godoc.org/github.com/toorop/go-dkim) + +## Getting started + +### Install +``` + go get github.com/toorop/go-dkim +``` +Warning: you need to use Go 1.4.2-master or 1.4.3 (when it will be available) +see https://github.com/golang/go/issues/10482 fro more info. + +### Sign email + +```go +import ( + dkim "github.com/toorop/go-dkim" +) + +func main(){ + // email is the email to sign (byte slice) + // privateKey the private key (pem encoded, byte slice ) + options := dkim.NewSigOptions() + options.PrivateKey = privateKey + options.Domain = "mydomain.tld" + options.Selector = "myselector" + options.SignatureExpireIn = 3600 + options.BodyLength = 50 + options.Headers = []string{"from", "date", "mime-version", "received", "received"} + options.AddSignatureTimestamp = true + options.Canonicalization = "relaxed/relaxed" + err := dkim.Sign(&email, options) + // handle err.. + + // And... that's it, 'email' is signed ! Amazing© !!! +} +``` + +### Verify +```go +import ( + dkim "github.com/toorop/go-dkim" +) + +func main(){ + // email is the email to verify (byte slice) + status, err := Verify(&email) + // handle status, err (see godoc for status) +} +``` + +## Todo + +- [ ] handle z tag (copied header fields used for diagnostic use) diff --git a/vendor/github.com/toorop/go-dkim/dkim.go b/vendor/github.com/toorop/go-dkim/dkim.go new file mode 100644 index 00000000..3ed5c88f --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/dkim.go @@ -0,0 +1,564 @@ +// Package dkim provides tools for signing and verify a email according to RFC 6376 +package dkim + +import ( + "bytes" + "container/list" + "crypto" + "crypto/rand" + "crypto/rsa" + "crypto/sha1" + "crypto/sha256" + "crypto/x509" + "encoding/base64" + "encoding/pem" + "hash" + "regexp" + "strings" + "time" +) + +const ( + CRLF = "\r\n" + TAB = " " + FWS = CRLF + TAB + MaxHeaderLineLength = 70 +) + +type verifyOutput int + +const ( + SUCCESS verifyOutput = 1 + iota + PERMFAIL + TEMPFAIL + NOTSIGNED + TESTINGSUCCESS + TESTINGPERMFAIL + TESTINGTEMPFAIL +) + +// sigOptions represents signing options +type SigOptions struct { + + // DKIM version (default 1) + Version uint + + // Private key used for signing (required) + PrivateKey []byte + + // Domain (required) + Domain string + + // Selector (required) + Selector string + + // The Agent of User IDentifier + Auid string + + // Message canonicalization (plain-text; OPTIONAL, default is + // "simple/simple"). This tag informs the Verifier of the type of + // canonicalization used to prepare the message for signing. + Canonicalization string + + // The algorithm used to generate the signature + //"rsa-sha1" or "rsa-sha256" + Algo string + + // Signed header fields + Headers []string + + // Body length count( if set to 0 this tag is ommited in Dkim header) + BodyLength uint + + // Query Methods used to retrieve the public key + QueryMethods []string + + // Add a signature timestamp + AddSignatureTimestamp bool + + // Time validity of the signature (0=never) + SignatureExpireIn uint64 + + // CopiedHeaderFileds + CopiedHeaderFields []string +} + +// NewSigOptions returns new sigoption with some defaults value +func NewSigOptions() SigOptions { + return SigOptions{ + Version: 1, + Canonicalization: "simple/simple", + Algo: "rsa-sha256", + Headers: []string{"from"}, + BodyLength: 0, + QueryMethods: []string{"dns/txt"}, + AddSignatureTimestamp: true, + SignatureExpireIn: 0, + } +} + +// Sign signs an email +func Sign(email *[]byte, options SigOptions) error { + var privateKey *rsa.PrivateKey + var err error + + // PrivateKey + if len(options.PrivateKey) == 0 { + return ErrSignPrivateKeyRequired + } + d, _ := pem.Decode(options.PrivateKey) + if d == nil { + return ErrCandNotParsePrivateKey + } + + // try to parse it as PKCS1 otherwise try PKCS8 + if key, err := x509.ParsePKCS1PrivateKey(d.Bytes); err != nil { + if key, err := x509.ParsePKCS8PrivateKey(d.Bytes); err != nil { + return ErrCandNotParsePrivateKey + } else { + privateKey = key.(*rsa.PrivateKey) + } + } else { + privateKey = key + } + + // Domain required + if options.Domain == "" { + return ErrSignDomainRequired + } + + // Selector required + if options.Selector == "" { + return ErrSignSelectorRequired + } + + // Canonicalization + options.Canonicalization, err = validateCanonicalization(strings.ToLower(options.Canonicalization)) + if err != nil { + return err + } + + // Algo + options.Algo = strings.ToLower(options.Algo) + if options.Algo != "rsa-sha1" && options.Algo != "rsa-sha256" { + return ErrSignBadAlgo + } + + // Header must contain "from" + hasFrom := false + for i, h := range options.Headers { + h = strings.ToLower(h) + options.Headers[i] = h + if h == "from" { + hasFrom = true + } + } + if !hasFrom { + return ErrSignHeaderShouldContainsFrom + } + + // Normalize + headers, body, err := canonicalize(email, options.Canonicalization, options.Headers) + if err != nil { + return err + } + + signHash := strings.Split(options.Algo, "-") + + // hash body + bodyHash, err := getBodyHash(&body, signHash[1], options.BodyLength) + if err != nil { + return err + } + + // Get dkim header base + dkimHeader := newDkimHeaderBySigOptions(options) + dHeader := dkimHeader.getHeaderBaseForSigning(bodyHash) + + canonicalizations := strings.Split(options.Canonicalization, "/") + dHeaderCanonicalized, err := canonicalizeHeader(dHeader, canonicalizations[0]) + if err != nil { + return err + } + headers = append(headers, []byte(dHeaderCanonicalized)...) + headers = bytes.TrimRight(headers, " \r\n") + + // sign + sig, err := getSignature(&headers, privateKey, signHash[1]) + + // add to DKIM-Header + subh := "" + l := len(subh) + for _, c := range sig { + subh += string(c) + l++ + if l >= MaxHeaderLineLength { + dHeader += subh + FWS + subh = "" + l = 0 + } + } + dHeader += subh + CRLF + *email = append([]byte(dHeader), *email...) + return nil +} + +// Verify verifies an email an return +// state: SUCCESS or PERMFAIL or TEMPFAIL, TESTINGSUCCESS, TESTINGPERMFAIL +// TESTINGTEMPFAIL or NOTSIGNED +// error: if an error occurs during verification +func Verify(email *[]byte, opts ...DNSOpt) (verifyOutput, error) { + // parse email + dkimHeader, err := GetHeader(email) + if err != nil { + if err == ErrDkimHeaderNotFound { + return NOTSIGNED, ErrDkimHeaderNotFound + } + return PERMFAIL, err + } + + // we do not set query method because if it's others, validation failed earlier + pubKey, verifyOutputOnError, err := NewPubKeyRespFromDNS(dkimHeader.Selector, dkimHeader.Domain, opts...) + if err != nil { + // fix https://github.com/toorop/go-dkim/issues/1 + //return getVerifyOutput(verifyOutputOnError, err, pubKey.FlagTesting) + return verifyOutputOnError, err + } + + // Normalize + headers, body, err := canonicalize(email, dkimHeader.MessageCanonicalization, dkimHeader.Headers) + if err != nil { + return getVerifyOutput(PERMFAIL, err, pubKey.FlagTesting) + } + sigHash := strings.Split(dkimHeader.Algorithm, "-") + // check if hash algo are compatible + compatible := false + for _, algo := range pubKey.HashAlgo { + if sigHash[1] == algo { + compatible = true + break + } + } + if !compatible { + return getVerifyOutput(PERMFAIL, ErrVerifyInappropriateHashAlgo, pubKey.FlagTesting) + } + + // expired ? + if !dkimHeader.SignatureExpiration.IsZero() && dkimHeader.SignatureExpiration.Second() < time.Now().Second() { + return getVerifyOutput(PERMFAIL, ErrVerifySignatureHasExpired, pubKey.FlagTesting) + + } + + //println("|" + string(body) + "|") + // get body hash + bodyHash, err := getBodyHash(&body, sigHash[1], dkimHeader.BodyLength) + if err != nil { + return getVerifyOutput(PERMFAIL, err, pubKey.FlagTesting) + } + //println(bodyHash) + if bodyHash != dkimHeader.BodyHash { + return getVerifyOutput(PERMFAIL, ErrVerifyBodyHash, pubKey.FlagTesting) + } + + // compute sig + dkimHeaderCano, err := canonicalizeHeader(dkimHeader.rawForSign, strings.Split(dkimHeader.MessageCanonicalization, "/")[0]) + if err != nil { + return getVerifyOutput(TEMPFAIL, err, pubKey.FlagTesting) + } + toSignStr := string(headers) + dkimHeaderCano + toSign := bytes.TrimRight([]byte(toSignStr), " \r\n") + + err = verifySignature(toSign, dkimHeader.SignatureData, &pubKey.PubKey, sigHash[1]) + if err != nil { + return getVerifyOutput(PERMFAIL, err, pubKey.FlagTesting) + } + return SUCCESS, nil +} + +// getVerifyOutput returns output of verify fct according to the testing flag +func getVerifyOutput(status verifyOutput, err error, flagTesting bool) (verifyOutput, error) { + if !flagTesting { + return status, err + } + switch status { + case SUCCESS: + return TESTINGSUCCESS, err + case PERMFAIL: + return TESTINGPERMFAIL, err + case TEMPFAIL: + return TESTINGTEMPFAIL, err + } + // should never happen but compilator sream whithout return + return status, err +} + +// canonicalize returns canonicalized version of header and body +func canonicalize(email *[]byte, cano string, h []string) (headers, body []byte, err error) { + body = []byte{} + rxReduceWS := regexp.MustCompile(`[ \t]+`) + + rawHeaders, rawBody, err := getHeadersBody(email) + if err != nil { + return nil, nil, err + } + + canonicalizations := strings.Split(cano, "/") + + // canonicalyze header + headersList, err := getHeadersList(&rawHeaders) + + // pour chaque header a conserver on traverse tous les headers dispo + // If multi instance of a field we must keep it from the bottom to the top + var match *list.Element + headersToKeepList := list.New() + + for _, headerToKeep := range h { + match = nil + headerToKeepToLower := strings.ToLower(headerToKeep) + for e := headersList.Front(); e != nil; e = e.Next() { + //fmt.Printf("|%s|\n", e.Value.(string)) + t := strings.Split(e.Value.(string), ":") + if strings.ToLower(t[0]) == headerToKeepToLower { + match = e + } + } + if match != nil { + headersToKeepList.PushBack(match.Value.(string) + "\r\n") + headersList.Remove(match) + } + } + + //if canonicalizations[0] == "simple" { + for e := headersToKeepList.Front(); e != nil; e = e.Next() { + cHeader, err := canonicalizeHeader(e.Value.(string), canonicalizations[0]) + if err != nil { + return headers, body, err + } + headers = append(headers, []byte(cHeader)...) + } + // canonicalyze body + if canonicalizations[1] == "simple" { + // simple + // The "simple" body canonicalization algorithm ignores all empty lines + // at the end of the message body. An empty line is a line of zero + // length after removal of the line terminator. If there is no body or + // no trailing CRLF on the message body, a CRLF is added. It makes no + // other changes to the message body. In more formal terms, the + // "simple" body canonicalization algorithm converts "*CRLF" at the end + // of the body to a single "CRLF". + // Note that a completely empty or missing body is canonicalized as a + // single "CRLF"; that is, the canonicalized length will be 2 octets. + body = bytes.TrimRight(rawBody, "\r\n") + body = append(body, []byte{13, 10}...) + } else { + // relaxed + // Ignore all whitespace at the end of lines. Implementations + // MUST NOT remove the CRLF at the end of the line. + // Reduce all sequences of WSP within a line to a single SP + // character. + // Ignore all empty lines at the end of the message body. "Empty + // line" is defined in Section 3.4.3. If the body is non-empty but + // does not end with a CRLF, a CRLF is added. (For email, this is + // only possible when using extensions to SMTP or non-SMTP transport + // mechanisms.) + rawBody = rxReduceWS.ReplaceAll(rawBody, []byte(" ")) + for _, line := range bytes.SplitAfter(rawBody, []byte{10}) { + line = bytes.TrimRight(line, " \r\n") + body = append(body, line...) + body = append(body, []byte{13, 10}...) + } + body = bytes.TrimRight(body, "\r\n") + body = append(body, []byte{13, 10}...) + + } + return +} + +// canonicalizeHeader returns canonicalized version of header +func canonicalizeHeader(header string, algo string) (string, error) { + //rxReduceWS := regexp.MustCompile(`[ \t]+`) + if algo == "simple" { + // The "simple" header canonicalization algorithm does not change header + // fields in any way. Header fields MUST be presented to the signing or + // verification algorithm exactly as they are in the message being + // signed or verified. In particular, header field names MUST NOT be + // case folded and whitespace MUST NOT be changed. + return header, nil + } else if algo == "relaxed" { + // The "relaxed" header canonicalization algorithm MUST apply the + // following steps in order: + + // Convert all header field names (not the header field values) to + // lowercase. For example, convert "SUBJect: AbC" to "subject: AbC". + + // Unfold all header field continuation lines as described in + // [RFC5322]; in particular, lines with terminators embedded in + // continued header field values (that is, CRLF sequences followed by + // WSP) MUST be interpreted without the CRLF. Implementations MUST + // NOT remove the CRLF at the end of the header field value. + + // Convert all sequences of one or more WSP characters to a single SP + // character. WSP characters here include those before and after a + // line folding boundary. + + // Delete all WSP characters at the end of each unfolded header field + // value. + + // Delete any WSP characters remaining before and after the colon + // separating the header field name from the header field value. The + // colon separator MUST be retained. + kv := strings.SplitN(header, ":", 2) + if len(kv) != 2 { + return header, ErrBadMailFormatHeaders + } + k := strings.ToLower(kv[0]) + k = strings.TrimSpace(k) + v := removeFWS(kv[1]) + //v = rxReduceWS.ReplaceAllString(v, " ") + //v = strings.TrimSpace(v) + return k + ":" + v + CRLF, nil + } + return header, ErrSignBadCanonicalization +} + +// getBodyHash return the hash (bas64encoded) of the body +func getBodyHash(body *[]byte, algo string, bodyLength uint) (string, error) { + var h hash.Hash + if algo == "sha1" { + h = sha1.New() + } else { + h = sha256.New() + } + toH := *body + // if l tag (body length) + if bodyLength != 0 { + if uint(len(toH)) < bodyLength { + return "", ErrBadDKimTagLBodyTooShort + } + toH = toH[0:bodyLength] + } + + h.Write(toH) + return base64.StdEncoding.EncodeToString(h.Sum(nil)), nil +} + +// getSignature return signature of toSign using key +func getSignature(toSign *[]byte, key *rsa.PrivateKey, algo string) (string, error) { + var h1 hash.Hash + var h2 crypto.Hash + switch algo { + case "sha1": + h1 = sha1.New() + h2 = crypto.SHA1 + break + case "sha256": + h1 = sha256.New() + h2 = crypto.SHA256 + break + default: + return "", ErrVerifyInappropriateHashAlgo + } + + // sign + h1.Write(*toSign) + sig, err := rsa.SignPKCS1v15(rand.Reader, key, h2, h1.Sum(nil)) + if err != nil { + return "", err + } + return base64.StdEncoding.EncodeToString(sig), nil +} + +// verifySignature verify signature from pubkey +func verifySignature(toSign []byte, sig64 string, key *rsa.PublicKey, algo string) error { + var h1 hash.Hash + var h2 crypto.Hash + switch algo { + case "sha1": + h1 = sha1.New() + h2 = crypto.SHA1 + break + case "sha256": + h1 = sha256.New() + h2 = crypto.SHA256 + break + default: + return ErrVerifyInappropriateHashAlgo + } + + h1.Write(toSign) + sig, err := base64.StdEncoding.DecodeString(sig64) + if err != nil { + return err + } + return rsa.VerifyPKCS1v15(key, h2, h1.Sum(nil), sig) +} + +// removeFWS removes all FWS from string +func removeFWS(in string) string { + rxReduceWS := regexp.MustCompile(`[ \t]+`) + out := strings.Replace(in, "\n", "", -1) + out = strings.Replace(out, "\r", "", -1) + out = rxReduceWS.ReplaceAllString(out, " ") + return strings.TrimSpace(out) +} + +// validateCanonicalization validate canonicalization (c flag) +func validateCanonicalization(cano string) (string, error) { + p := strings.Split(cano, "/") + if len(p) > 2 { + return "", ErrSignBadCanonicalization + } + if len(p) == 1 { + cano = cano + "/simple" + } + for _, c := range p { + if c != "simple" && c != "relaxed" { + return "", ErrSignBadCanonicalization + } + } + return cano, nil +} + +// getHeadersList returns headers as list +func getHeadersList(rawHeader *[]byte) (*list.List, error) { + headersList := list.New() + currentHeader := []byte{} + for _, line := range bytes.SplitAfter(*rawHeader, []byte{10}) { + if line[0] == 32 || line[0] == 9 { + if len(currentHeader) == 0 { + return headersList, ErrBadMailFormatHeaders + } + currentHeader = append(currentHeader, line...) + } else { + // New header, save current if exists + if len(currentHeader) != 0 { + headersList.PushBack(string(bytes.TrimRight(currentHeader, "\r\n"))) + currentHeader = []byte{} + } + currentHeader = append(currentHeader, line...) + } + } + headersList.PushBack(string(currentHeader)) + return headersList, nil +} + +// getHeadersBody return headers and body +func getHeadersBody(email *[]byte) ([]byte, []byte, error) { + substitutedEmail := *email + + // only replace \n with \r\n when \r\n\r\n not exists + if bytes.Index(*email, []byte{13, 10, 13, 10}) < 0 { + // \n -> \r\n + substitutedEmail = bytes.Replace(*email, []byte{10}, []byte{13, 10}, -1) + } + + parts := bytes.SplitN(substitutedEmail, []byte{13, 10, 13, 10}, 2) + if len(parts) != 2 { + return []byte{}, []byte{}, ErrBadMailFormat + } + // Empty body + if len(parts[1]) == 0 { + parts[1] = []byte{13, 10} + } + return parts[0], parts[1], nil +} diff --git a/vendor/github.com/toorop/go-dkim/dkimHeader.go b/vendor/github.com/toorop/go-dkim/dkimHeader.go new file mode 100644 index 00000000..14a289ee --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/dkimHeader.go @@ -0,0 +1,545 @@ +package dkim + +import ( + "bytes" + "fmt" + "net/mail" + "net/textproto" + "strconv" + "strings" + "time" +) + +type DKIMHeader struct { + // Version This tag defines the version of DKIM + // specification that applies to the signature record. + // tag v + Version string + + // The algorithm used to generate the signature.. + // Verifiers MUST support "rsa-sha1" and "rsa-sha256"; + // Signers SHOULD sign using "rsa-sha256". + // tag a + Algorithm string + + // The signature data (base64). + // Whitespace is ignored in this value and MUST be + // ignored when reassembling the original signature. + // In particular, the signing process can safely insert + // FWS in this value in arbitrary places to conform to line-length + // limits. + // tag b + SignatureData string + + // The hash of the canonicalized body part of the message as + // limited by the "l=" tag (base64; REQUIRED). + // Whitespace is ignored in this value and MUST be ignored when reassembling the original + // signature. In particular, the signing process can safely insert + // FWS in this value in arbitrary places to conform to line-length + // limits. + // tag bh + BodyHash string + + // Message canonicalization (plain-text; OPTIONAL, default is + //"simple/simple"). This tag informs the Verifier of the type of + // canonicalization used to prepare the message for signing. It + // consists of two names separated by a "slash" (%d47) character, + // corresponding to the header and body canonicalization algorithms, + // respectively. These algorithms are described in Section 3.4. If + // only one algorithm is named, that algorithm is used for the header + // and "simple" is used for the body. For example, "c=relaxed" is + // treated the same as "c=relaxed/simple". + // tag c + MessageCanonicalization string + + // The SDID claiming responsibility for an introduction of a message + // into the mail stream (plain-text; REQUIRED). Hence, the SDID + // value is used to form the query for the public key. The SDID MUST + // correspond to a valid DNS name under which the DKIM key record is + // published. The conventions and semantics used by a Signer to + // create and use a specific SDID are outside the scope of this + // specification, as is any use of those conventions and semantics. + // When presented with a signature that does not meet these + // requirements, Verifiers MUST consider the signature invalid. + // Internationalized domain names MUST be encoded as A-labels, as + // described in Section 2.3 of [RFC5890]. + // tag d + Domain string + + // Signed header fields (plain-text, but see description; REQUIRED). + // A colon-separated list of header field names that identify the + // header fields presented to the signing algorithm. The field MUST + // contain the complete list of header fields in the order presented + // to the signing algorithm. The field MAY contain names of header + // fields that do not exist when signed; nonexistent header fields do + // not contribute to the signature computation (that is, they are + // treated as the null input, including the header field name, the + // separating colon, the header field value, and any CRLF + // terminator). The field MAY contain multiple instances of a header + // field name, meaning multiple occurrences of the corresponding + // header field are included in the header hash. The field MUST NOT + // include the DKIM-Signature header field that is being created or + // verified but may include others. Folding whitespace (FWS) MAY be + // included on either side of the colon separator. Header field + // names MUST be compared against actual header field names in a + // case-insensitive manner. This list MUST NOT be empty. See + // Section 5.4 for a discussion of choosing header fields to sign and + // Section 5.4.2 for requirements when signing multiple instances of + // a single field. + // tag h + Headers []string + + // The Agent or User Identifier (AUID) on behalf of which the SDID is + // taking responsibility (dkim-quoted-printable; OPTIONAL, default is + // an empty local-part followed by an "@" followed by the domain from + // the "d=" tag). + // The syntax is a standard email address where the local-part MAY be + // omitted. The domain part of the address MUST be the same as, or a + // subdomain of, the value of the "d=" tag. + // Internationalized domain names MUST be encoded as A-labels, as + // described in Section 2.3 of [RFC5890]. + // tag i + Auid string + + // Body length count (plain-text unsigned decimal integer; OPTIONAL, + // default is entire body). This tag informs the Verifier of the + // number of octets in the body of the email after canonicalization + // included in the cryptographic hash, starting from 0 immediately + // following the CRLF preceding the body. This value MUST NOT be + // larger than the actual number of octets in the canonicalized + // message body. See further discussion in Section 8.2. + // tag l + BodyLength uint + + // A colon-separated list of query methods used to retrieve the + // public key (plain-text; OPTIONAL, default is "dns/txt"). Each + // query method is of the form "type[/options]", where the syntax and + // semantics of the options depend on the type and specified options. + // If there are multiple query mechanisms listed, the choice of query + // mechanism MUST NOT change the interpretation of the signature. + // Implementations MUST use the recognized query mechanisms in the + // order presented. Unrecognized query mechanisms MUST be ignored. + // Currently, the only valid value is "dns/txt", which defines the + // DNS TXT resource record (RR) lookup algorithm described elsewhere + // in this document. The only option defined for the "dns" query + // type is "txt", which MUST be included. Verifiers and Signers MUST + // support "dns/txt". + // tag q + QueryMethods []string + + // The selector subdividing the namespace for the "d=" (domain) tag + // (plain-text; REQUIRED). + // Internationalized selector names MUST be encoded as A-labels, as + // described in Section 2.3 of [RFC5890]. + // tag s + Selector string + + // Signature Timestamp (plain-text unsigned decimal integer; + // RECOMMENDED, default is an unknown creation time). The time that + // this signature was created. The format is the number of seconds + // since 00:00:00 on January 1, 1970 in the UTC time zone. The value + // is expressed as an unsigned integer in decimal ASCII. This value + // is not constrained to fit into a 31- or 32-bit integer. + // Implementations SHOULD be prepared to handle values up to at least + // 10^12 (until approximately AD 200,000; this fits into 40 bits). + // To avoid denial-of-service attacks, implementations MAY consider + // any value longer than 12 digits to be infinite. Leap seconds are + // not counted. Implementations MAY ignore signatures that have a + // timestamp in the future. + // tag t + SignatureTimestamp time.Time + + // Signature Expiration (plain-text unsigned decimal integer; + // RECOMMENDED, default is no expiration). The format is the same as + // in the "t=" tag, represented as an absolute date, not as a time + // delta from the signing timestamp. The value is expressed as an + // unsigned integer in decimal ASCII, with the same constraints on + // the value in the "t=" tag. Signatures MAY be considered invalid + // if the verification time at the Verifier is past the expiration + // date. The verification time should be the time that the message + // was first received at the administrative domain of the Verifier if + // that time is reliably available; otherwise, the current time + // should be used. The value of the "x=" tag MUST be greater than + // the value of the "t=" tag if both are present. + //tag x + SignatureExpiration time.Time + + // Copied header fields (dkim-quoted-printable, but see description; + // OPTIONAL, default is null). A vertical-bar-separated list of + // selected header fields present when the message was signed, + // including both the field name and value. It is not required to + // include all header fields present at the time of signing. This + // field need not contain the same header fields listed in the "h=" + // tag. The header field text itself must encode the vertical bar + // ("|", %x7C) character (i.e., vertical bars in the "z=" text are + // meta-characters, and any actual vertical bar characters in a + // copied header field must be encoded). Note that all whitespace + // must be encoded, including whitespace between the colon and the + // header field value. After encoding, FWS MAY be added at arbitrary + // locations in order to avoid excessively long lines; such + // whitespace is NOT part of the value of the header field and MUST + // be removed before decoding. + // The header fields referenced by the "h=" tag refer to the fields + // in the [RFC5322] header of the message, not to any copied fields + // in the "z=" tag. Copied header field values are for diagnostic + // use. + // tag z + CopiedHeaderFields []string + + // HeaderMailFromDomain store the raw email address of the header Mail From + // used for verifying in case of multiple DKIM header (we will prioritise + // header with d = mail from domain) + //HeaderMailFromDomain string + + // RawForsign represents the raw part (without canonicalization) of the header + // used for computint sig in verify process + rawForSign string +} + +// NewDkimHeaderBySigOptions return a new DkimHeader initioalized with sigOptions value +func newDkimHeaderBySigOptions(options SigOptions) *DKIMHeader { + h := new(DKIMHeader) + h.Version = "1" + h.Algorithm = options.Algo + h.MessageCanonicalization = options.Canonicalization + h.Domain = options.Domain + h.Headers = options.Headers + h.Auid = options.Auid + h.BodyLength = options.BodyLength + h.QueryMethods = options.QueryMethods + h.Selector = options.Selector + if options.AddSignatureTimestamp { + h.SignatureTimestamp = time.Now() + } + if options.SignatureExpireIn > 0 { + h.SignatureExpiration = time.Now().Add(time.Duration(options.SignatureExpireIn) * time.Second) + } + h.CopiedHeaderFields = options.CopiedHeaderFields + return h +} + +// GetHeader return a new DKIMHeader by parsing an email +// Note: according to RFC 6376 an email can have multiple DKIM Header +// in this case we return the last inserted or the last with d== mail from +func GetHeader(email *[]byte) (*DKIMHeader, error) { + m, err := mail.ReadMessage(bytes.NewReader(*email)) + if err != nil { + return nil, err + } + + // DKIM header ? + if len(m.Header[textproto.CanonicalMIMEHeaderKey("DKIM-Signature")]) == 0 { + return nil, ErrDkimHeaderNotFound + } + + // Get mail from domain + mailFromDomain := "" + mailfrom, err := mail.ParseAddress(m.Header.Get(textproto.CanonicalMIMEHeaderKey("From"))) + if err != nil { + if err.Error() != "mail: no address" { + return nil, err + } + } else { + t := strings.SplitAfter(mailfrom.Address, "@") + if len(t) > 1 { + mailFromDomain = strings.ToLower(t[1]) + } + } + + // get raw dkim header + // we can't use m.header because header key will be converted with textproto.CanonicalMIMEHeaderKey + // ie if key in header is not DKIM-Signature but Dkim-Signature or DKIM-signature ot... other + // combination of case, verify will fail. + rawHeaders, _, err := getHeadersBody(email) + if err != nil { + return nil, ErrBadMailFormat + } + rawHeadersList, err := getHeadersList(&rawHeaders) + if err != nil { + return nil, err + } + dkHeaders := []string{} + for h := rawHeadersList.Front(); h != nil; h = h.Next() { + if strings.HasPrefix(strings.ToLower(h.Value.(string)), "dkim-signature") { + dkHeaders = append(dkHeaders, h.Value.(string)) + } + } + + var keep *DKIMHeader + var keepErr error + //for _, dk := range m.Header[textproto.CanonicalMIMEHeaderKey("DKIM-Signature")] { + for _, h := range dkHeaders { + parsed, err := parseDkHeader(h) + // if malformed dkim header try next + if err != nil { + keepErr = err + continue + } + // Keep first dkim headers + if keep == nil { + keep = parsed + } + // if d flag == domain keep this header and return + if mailFromDomain == parsed.Domain { + return parsed, nil + } + } + if keep == nil { + return nil, keepErr + } + return keep, nil +} + +// parseDkHeader parse raw dkim header +func parseDkHeader(header string) (dkh *DKIMHeader, err error) { + dkh = new(DKIMHeader) + + keyVal := strings.SplitN(header, ":", 2) + + t := strings.LastIndex(header, "b=") + if t == -1 { + return nil, ErrDkimHeaderBTagNotFound + } + dkh.rawForSign = header[0 : t+2] + p := strings.IndexByte(header[t:], ';') + if p != -1 { + dkh.rawForSign = dkh.rawForSign + header[t+p:] + } + + // Mandatory + mandatoryFlags := make(map[string]bool, 7) //(b'v', b'a', b'b', b'bh', b'd', b'h', b's') + mandatoryFlags["v"] = false + mandatoryFlags["a"] = false + mandatoryFlags["b"] = false + mandatoryFlags["bh"] = false + mandatoryFlags["d"] = false + mandatoryFlags["h"] = false + mandatoryFlags["s"] = false + + // default values + dkh.MessageCanonicalization = "simple/simple" + dkh.QueryMethods = []string{"dns/txt"} + + // unfold && clean + val := removeFWS(keyVal[1]) + val = strings.Replace(val, " ", "", -1) + + fs := strings.Split(val, ";") + for _, f := range fs { + if f == "" { + continue + } + flagData := strings.SplitN(f, "=", 2) + + // https://github.com/toorop/go-dkim/issues/2 + // if flag is not in the form key=value (eg doesn't have "=") + if len(flagData) != 2 { + return nil, ErrDkimHeaderBadFormat + } + flag := strings.ToLower(strings.TrimSpace(flagData[0])) + data := strings.TrimSpace(flagData[1]) + switch flag { + case "v": + if data != "1" { + return nil, ErrDkimVersionNotsupported + } + dkh.Version = data + mandatoryFlags["v"] = true + case "a": + dkh.Algorithm = strings.ToLower(data) + if dkh.Algorithm != "rsa-sha1" && dkh.Algorithm != "rsa-sha256" { + return nil, ErrSignBadAlgo + } + mandatoryFlags["a"] = true + case "b": + //dkh.SignatureData = removeFWS(data) + // remove all space + dkh.SignatureData = strings.Replace(removeFWS(data), " ", "", -1) + if len(dkh.SignatureData) != 0 { + mandatoryFlags["b"] = true + } + case "bh": + dkh.BodyHash = removeFWS(data) + if len(dkh.BodyHash) != 0 { + mandatoryFlags["bh"] = true + } + case "d": + dkh.Domain = strings.ToLower(data) + if len(dkh.Domain) != 0 { + mandatoryFlags["d"] = true + } + case "h": + data = strings.ToLower(data) + dkh.Headers = strings.Split(data, ":") + if len(dkh.Headers) != 0 { + mandatoryFlags["h"] = true + } + fromFound := false + for _, h := range dkh.Headers { + if h == "from" { + fromFound = true + } + } + if !fromFound { + return nil, ErrDkimHeaderNoFromInHTag + } + case "s": + dkh.Selector = strings.ToLower(data) + if len(dkh.Selector) != 0 { + mandatoryFlags["s"] = true + } + case "c": + dkh.MessageCanonicalization, err = validateCanonicalization(strings.ToLower(data)) + if err != nil { + return nil, err + } + case "i": + if data != "" { + if !strings.HasSuffix(data, dkh.Domain) { + return nil, ErrDkimHeaderDomainMismatch + } + dkh.Auid = data + } + case "l": + ui, err := strconv.ParseUint(data, 10, 32) + if err != nil { + return nil, err + } + dkh.BodyLength = uint(ui) + case "q": + dkh.QueryMethods = strings.Split(data, ":") + if len(dkh.QueryMethods) == 0 || strings.ToLower(dkh.QueryMethods[0]) != "dns/txt" { + return nil, errQueryMethodNotsupported + } + case "t": + ts, err := strconv.ParseInt(data, 10, 64) + if err != nil { + return nil, err + } + dkh.SignatureTimestamp = time.Unix(ts, 0) + + case "x": + ts, err := strconv.ParseInt(data, 10, 64) + if err != nil { + return nil, err + } + dkh.SignatureExpiration = time.Unix(ts, 0) + case "z": + dkh.CopiedHeaderFields = strings.Split(data, "|") + } + } + + // All mandatory flags are in ? + for _, p := range mandatoryFlags { + if !p { + return nil, ErrDkimHeaderMissingRequiredTag + } + } + + // default for i/Auid + if dkh.Auid == "" { + dkh.Auid = "@" + dkh.Domain + } + + // defaut for query method + if len(dkh.QueryMethods) == 0 { + dkh.QueryMethods = []string{"dns/text"} + } + + return dkh, nil + +} + +// GetHeaderBase return base header for signers +// Todo: some refactoring needed... +func (d *DKIMHeader) getHeaderBaseForSigning(bodyHash string) string { + h := "DKIM-Signature: v=" + d.Version + "; a=" + d.Algorithm + "; q=" + strings.Join(d.QueryMethods, ":") + "; c=" + d.MessageCanonicalization + ";" + CRLF + TAB + subh := "s=" + d.Selector + ";" + if len(subh)+len(d.Domain)+4 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += " d=" + d.Domain + ";" + + // Auid + if len(d.Auid) != 0 { + if len(subh)+len(d.Auid)+4 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += " i=" + d.Auid + ";" + } + + /*h := "DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tmail.io; i=@tmail.io;" + FWS + subh := "q=dns/txt; s=test;"*/ + + // signature timestamp + if !d.SignatureTimestamp.IsZero() { + ts := d.SignatureTimestamp.Unix() + if len(subh)+14 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += " t=" + fmt.Sprintf("%d", ts) + ";" + } + if len(subh)+len(d.Domain)+4 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + + // Expiration + if !d.SignatureExpiration.IsZero() { + ts := d.SignatureExpiration.Unix() + if len(subh)+14 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += " x=" + fmt.Sprintf("%d", ts) + ";" + } + + // body length + if d.BodyLength != 0 { + bodyLengthStr := fmt.Sprintf("%d", d.BodyLength) + if len(subh)+len(bodyLengthStr)+4 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += " l=" + bodyLengthStr + ";" + } + + // Headers + if len(subh)+len(d.Headers)+4 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += " h=" + for _, header := range d.Headers { + if len(subh)+len(header)+1 > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } + subh += header + ":" + } + subh = subh[:len(subh)-1] + ";" + + // BodyHash + if len(subh)+5+len(bodyHash) > MaxHeaderLineLength { + h += subh + FWS + subh = "" + } else { + subh += " " + } + subh += "bh=" + l := len(subh) + for _, c := range bodyHash { + subh += string(c) + l++ + if l >= MaxHeaderLineLength { + h += subh + FWS + subh = "" + l = 0 + } + } + h += subh + ";" + FWS + "b=" + return h +} diff --git a/vendor/github.com/toorop/go-dkim/errors.go b/vendor/github.com/toorop/go-dkim/errors.go new file mode 100644 index 00000000..80a99da3 --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/errors.go @@ -0,0 +1,94 @@ +package dkim + +import ( + "errors" +) + +var ( + // ErrSignPrivateKeyRequired when there not private key in config + ErrSignPrivateKeyRequired = errors.New("PrivateKey is required") + + // ErrSignDomainRequired when there is no domain defined in config + ErrSignDomainRequired = errors.New("Domain is required") + + // ErrSignSelectorRequired when there is no Selcteir defined in config + ErrSignSelectorRequired = errors.New("Selector is required") + + // ErrSignHeaderShouldContainsFrom If Headers is specified it should at least contain 'from' + ErrSignHeaderShouldContainsFrom = errors.New("header must contains 'from' field") + + // ErrSignBadCanonicalization If bad Canonicalization parameter + ErrSignBadCanonicalization = errors.New("bad Canonicalization parameter") + + // ErrCandNotParsePrivateKey when unable to parse private key + ErrCandNotParsePrivateKey = errors.New("can not parse private key, check format (pem) and validity") + + // ErrSignBadAlgo Bad algorithm + ErrSignBadAlgo = errors.New("bad algorithm. Only rsa-sha1 or rsa-sha256 are permitted") + + // ErrBadMailFormat unable to parse mail + ErrBadMailFormat = errors.New("bad mail format") + + // ErrBadMailFormatHeaders bad headers format (not DKIM Header) + ErrBadMailFormatHeaders = errors.New("bad mail format found in headers") + + // ErrBadDKimTagLBodyTooShort bad l tag + ErrBadDKimTagLBodyTooShort = errors.New("bad tag l or bodyLength option. Body length < l value") + + // ErrDkimHeaderBadFormat when errors found in DKIM header + ErrDkimHeaderBadFormat = errors.New("bad DKIM header format") + + // ErrDkimHeaderNotFound when there's no DKIM-Signature header in an email we have to verify + ErrDkimHeaderNotFound = errors.New("no DKIM-Signature header field found ") + + // ErrDkimHeaderBTagNotFound when there's no b tag + ErrDkimHeaderBTagNotFound = errors.New("no tag 'b' found in dkim header") + + // ErrDkimHeaderNoFromInHTag when from is missing in h tag + ErrDkimHeaderNoFromInHTag = errors.New("'from' header is missing in h tag") + + // ErrDkimHeaderMissingRequiredTag when a required tag is missing + ErrDkimHeaderMissingRequiredTag = errors.New("signature missing required tag") + + // ErrDkimHeaderDomainMismatch if i tag is not a sub domain of d tag + ErrDkimHeaderDomainMismatch = errors.New("domain mismatch") + + // ErrDkimVersionNotsupported version not supported + ErrDkimVersionNotsupported = errors.New("incompatible version") + + // Query method unsupported + errQueryMethodNotsupported = errors.New("query method not supported") + + // ErrVerifyBodyHash when body hash doesn't verify + ErrVerifyBodyHash = errors.New("body hash did not verify") + + // ErrVerifyNoKeyForSignature no key + ErrVerifyNoKeyForSignature = errors.New("no key for verify") + + // ErrVerifyKeyUnavailable when service (dns) is anavailable + ErrVerifyKeyUnavailable = errors.New("key unavailable") + + // ErrVerifyTagVMustBeTheFirst if present the v tag must be the firts in the record + ErrVerifyTagVMustBeTheFirst = errors.New("pub key syntax error: v tag must be the first") + + // ErrVerifyVersionMusBeDkim1 if présent flag v (version) must be DKIM1 + ErrVerifyVersionMusBeDkim1 = errors.New("flag v must be set to DKIM1") + + // ErrVerifyBadKeyType bad type for pub key (only rsa is accepted) + ErrVerifyBadKeyType = errors.New("bad type for key type") + + // ErrVerifyRevokedKey key(s) for this selector is revoked (p is empty) + ErrVerifyRevokedKey = errors.New("revoked key") + + // ErrVerifyBadKey when we can't parse pubkey + ErrVerifyBadKey = errors.New("unable to parse pub key") + + // ErrVerifyNoKey when no key is found on DNS record + ErrVerifyNoKey = errors.New("no public key found in DNS TXT") + + // ErrVerifySignatureHasExpired when signature has expired + ErrVerifySignatureHasExpired = errors.New("signature has expired") + + // ErrVerifyInappropriateHashAlgo when h tag in pub key doesn't contain hash algo from a tag of DKIM header + ErrVerifyInappropriateHashAlgo = errors.New("inappropriate has algorithm") +) diff --git a/vendor/github.com/toorop/go-dkim/pubKeyRep.go b/vendor/github.com/toorop/go-dkim/pubKeyRep.go new file mode 100644 index 00000000..7a3ecf6f --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/pubKeyRep.go @@ -0,0 +1,181 @@ +package dkim + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "io/ioutil" + "mime/quotedprintable" + "net" + "strings" +) + +// PubKeyRep represents a parsed version of public key record +type PubKeyRep struct { + Version string + HashAlgo []string + KeyType string + Note string + PubKey rsa.PublicKey + ServiceType []string + FlagTesting bool // flag y + FlagIMustBeD bool // flag i +} + +// DNSOptions holds settings for looking up DNS records +type DNSOptions struct { + netLookupTXT func(name string) ([]string, error) +} + +// DNSOpt represents an optional setting for looking up DNS records +type DNSOpt interface { + apply(*DNSOptions) +} + +type dnsOpt func(*DNSOptions) + +func (opt dnsOpt) apply(dnsOpts *DNSOptions) { + opt(dnsOpts) +} + +// DNSOptLookupTXT sets the function to use to lookup TXT records. +// +// This should probably only be used in tests. +func DNSOptLookupTXT(netLookupTXT func(name string) ([]string, error)) DNSOpt { + return dnsOpt(func(opts *DNSOptions) { + opts.netLookupTXT = netLookupTXT + }) +} + +// NewPubKeyRespFromDNS retrieves the TXT record from DNS based on the specified domain and selector +// and parses it. +func NewPubKeyRespFromDNS(selector, domain string, opts ...DNSOpt) (*PubKeyRep, verifyOutput, error) { + dnsOpts := DNSOptions{} + + for _, opt := range opts { + opt.apply(&dnsOpts) + } + + if dnsOpts.netLookupTXT == nil { + dnsOpts.netLookupTXT = net.LookupTXT + } + + txt, err := dnsOpts.netLookupTXT(selector + "._domainkey." + domain) + if err != nil { + if strings.HasSuffix(err.Error(), "no such host") { + return nil, PERMFAIL, ErrVerifyNoKeyForSignature + } + + return nil, TEMPFAIL, ErrVerifyKeyUnavailable + } + + // empty record + if len(txt) == 0 { + return nil, PERMFAIL, ErrVerifyNoKeyForSignature + } + + // parsing, we keep the first record + // TODO: if there is multiple record + + return NewPubKeyResp(txt[0]) +} + +// NewPubKeyResp parses DKIM record (usually from DNS) +func NewPubKeyResp(dkimRecord string) (*PubKeyRep, verifyOutput, error) { + pkr := new(PubKeyRep) + pkr.Version = "DKIM1" + pkr.HashAlgo = []string{"sha1", "sha256"} + pkr.KeyType = "rsa" + pkr.FlagTesting = false + pkr.FlagIMustBeD = false + + p := strings.Split(dkimRecord, ";") + for i, data := range p { + keyVal := strings.SplitN(data, "=", 2) + val := "" + if len(keyVal) > 1 { + val = strings.TrimSpace(keyVal[1]) + } + switch strings.ToLower(strings.TrimSpace(keyVal[0])) { + case "v": + // RFC: is this tag is specified it MUST be the first in the record + if i != 0 { + return nil, PERMFAIL, ErrVerifyTagVMustBeTheFirst + } + pkr.Version = val + if pkr.Version != "DKIM1" { + return nil, PERMFAIL, ErrVerifyVersionMusBeDkim1 + } + case "h": + p := strings.Split(strings.ToLower(val), ":") + pkr.HashAlgo = []string{} + for _, h := range p { + h = strings.TrimSpace(h) + if h == "sha1" || h == "sha256" { + pkr.HashAlgo = append(pkr.HashAlgo, h) + } + } + // if empty switch back to default + if len(pkr.HashAlgo) == 0 { + pkr.HashAlgo = []string{"sha1", "sha256"} + } + case "k": + if strings.ToLower(val) != "rsa" { + return nil, PERMFAIL, ErrVerifyBadKeyType + } + case "n": + qp, err := ioutil.ReadAll(quotedprintable.NewReader(strings.NewReader(val))) + if err == nil { + val = string(qp) + } + pkr.Note = val + case "p": + rawkey := val + if rawkey == "" { + return nil, PERMFAIL, ErrVerifyRevokedKey + } + un64, err := base64.StdEncoding.DecodeString(rawkey) + if err != nil { + return nil, PERMFAIL, ErrVerifyBadKey + } + pk, err := x509.ParsePKIXPublicKey(un64) + if pk, ok := pk.(*rsa.PublicKey); ok { + pkr.PubKey = *pk + } + case "s": + t := strings.Split(strings.ToLower(val), ":") + for _, tt := range t { + tt = strings.TrimSpace(tt) + switch tt { + case "*": + pkr.ServiceType = append(pkr.ServiceType, "all") + case "email": + pkr.ServiceType = append(pkr.ServiceType, tt) + } + } + case "t": + flags := strings.Split(strings.ToLower(val), ":") + for _, flag := range flags { + flag = strings.TrimSpace(flag) + switch flag { + case "y": + pkr.FlagTesting = true + case "s": + pkr.FlagIMustBeD = true + } + } + } + } + + // if no pubkey + if pkr.PubKey == (rsa.PublicKey{}) { + return nil, PERMFAIL, ErrVerifyNoKey + } + + // No service type + if len(pkr.ServiceType) == 0 { + pkr.ServiceType = []string{"all"} + } + + return pkr, SUCCESS, nil +} diff --git a/vendor/github.com/toorop/go-dkim/watch b/vendor/github.com/toorop/go-dkim/watch new file mode 100644 index 00000000..82b58445 --- /dev/null +++ b/vendor/github.com/toorop/go-dkim/watch @@ -0,0 +1,4 @@ +while true +do +inotifywait -q -r -e modify,attrib,close_write,move,create,delete . && echo "--------------" && go test -v +done \ No newline at end of file diff --git a/vendor/github.com/xhit/go-simple-mail/v2/.gitattributes b/vendor/github.com/xhit/go-simple-mail/v2/.gitattributes new file mode 100644 index 00000000..999ce656 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* -text + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/vendor/github.com/xhit/go-simple-mail/v2/.gitignore b/vendor/github.com/xhit/go-simple-mail/v2/.gitignore new file mode 100644 index 00000000..0928ac8d --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/.gitignore @@ -0,0 +1,28 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +# Eclipse Project files +.project +.settings \ No newline at end of file diff --git a/vendor/github.com/xhit/go-simple-mail/v2/.golangci.yml b/vendor/github.com/xhit/go-simple-mail/v2/.golangci.yml new file mode 100644 index 00000000..4726a867 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/.golangci.yml @@ -0,0 +1,59 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + concurrency: 4 + timeout: 10m + issues-exit-code: 1 + tests: true + +# output configuration options +output: + format: line-number + +# all available settings of specific linters +linters-settings: + govet: + # report about shadowed variables + check-shadowing: true + misspell: + locale: US + unused: + # treat code as a program (not a library) and report unused exported identifiers; default is false. + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations + # with golangci-lint call it on a directory with the changed file. + check-exported: false + +linters: + enable: + - asciicheck + - deadcode + - dogsled + - exportloopref + - golint + - gosimple + - govet + - ineffassign + - megacheck + - misspell + - nakedret + - nolintlint + - staticcheck + - structcheck + - typecheck + - unconvert + - unused + - varcheck + disable: + - errcheck + disable-all: false + fast: false + +issues: + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + max-issues-per-linter: 0 + + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + max-same-issues: 0 diff --git a/vendor/github.com/xhit/go-simple-mail/v2/LICENSE b/vendor/github.com/xhit/go-simple-mail/v2/LICENSE new file mode 100644 index 00000000..bf36b8d9 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Santiago De la Cruz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/xhit/go-simple-mail/v2/README.md b/vendor/github.com/xhit/go-simple-mail/v2/README.md new file mode 100644 index 00000000..ad237a03 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/README.md @@ -0,0 +1,270 @@ +# Go Simple Mail + +The best way to send emails in Go with SMTP Keep Alive and Timeout for Connect and Send. + +Go Report Card +go.dev + + +# IMPORTANT + +Examples in this README are for v2.2.0 and above. Examples for older versions +can be found [here](https://gist.github.com/xhit/54516917473420a8db1b6fff68a21c99). + +Go 1.13+ is required. + +Breaking change in 2.2.0: The signature of `SetBody` and `AddAlternative` used +to accept strings ("text/html" and "text/plain") and not require on of the +`contentType` constants (`TextHTML` or `TextPlain`). Upgrading, while not +quite following semantic versioning, is quite simple: + +```diff + email := mail.NewMSG() +- email.SetBody("text/html", htmlBody) +- email.AddAlternative("text/plain", plainBody) ++ email.SetBody(mail.TextHTML, htmlBody) ++ email.AddAlternative(mail.TextPlain, plainBody) +``` + +# Introduction + +Go Simple Mail is a simple and efficient package to send emails. It is well tested and +documented. + +Go Simple Mail can only send emails using an SMTP server. But the API is flexible and it +is easy to implement other methods for sending emails using a local Postfix, an API, etc. + +This package contains (and is based on) two packages by **Joe Grasse**: + +- https://github.com/joegrasse/mail (unmaintained since Jun 29, 2018), and +- https://github.com/joegrasse/mime (unmaintained since Oct 1, 2015). + +A lot of changes in Go Simple Mail were sent with not response. + +## Features + +Go Simple Mail supports: + +- Multiple Attachments with path +- Multiple Attachments in base64 +- Multiple Attachments from bytes (since v2.6.0) +- Inline attachments from file, base64 and bytes (bytes since v2.6.0) +- Multiple Recipients +- Priority +- Reply to +- Set sender +- Set from +- Allow sending mail with different envelope from (since v2.7.0) +- Embedded images +- HTML and text templates +- Automatic encoding of special characters +- SSL/TLS and STARTTLS +- Unencrypted connection (not recommended) +- Sending multiple emails with the same SMTP connection (Keep Alive or Persistent Connection) +- Timeout for connect to a SMTP Server +- Timeout for send an email +- Return Path +- Alternative Email Body +- CC and BCC +- Add Custom Headers in Message +- Send NOOP, RESET, QUIT and CLOSE to SMTP client +- PLAIN, LOGIN and CRAM-MD5 Authentication (since v2.3.0) +- Allow connect to SMTP without authentication (since v2.10.0) +- Custom TLS Configuration (since v2.5.0) +- Send a RFC822 formatted message (since v2.8.0) +- Send from localhost (yes, Go standard SMTP package cannot do that because... WTF Google!) +- Support text/calendar content type body (since v2.11.0) +- Support add a List-Unsubscribe header (since v2.11.0) +- Support to add a DKIM signarure (since v2.11.0) + +## Documentation + +https://pkg.go.dev/github.com/xhit/go-simple-mail/v2?tab=doc + +Note: by default duplicated recipients throws an error, from `v2.13.0` you can use `email.AllowDuplicateAddress = true` to avoid the check. + +## Download + +This package uses go modules. + +```console +$ go get github.com/xhit/go-simple-mail/v2 +``` + +# Usage + +```go +package main + +import ( + "log" + + "github.com/xhit/go-simple-mail/v2" + "github.com/toorop/go-dkim" +) + +const htmlBody = ` + + + Hello Gophers! + + +

This is the Go gopher.

+

Go gopher

+

Image created by Renee French

+ +` + +const privateKey = `-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAwGrscUxi9zEa9oMOJbS0kLVHZXNIW+EBjY7KFWIZSxuGAils +wBVl+s5mMRrR5VlkyLQNulAdNemg6OSeB0R+2+8/lkHiMrimqQckZ5ig8slBoZhZ +wUoL/ZkeQa1bacbdww5TuWkiVPD9kooT/+TZW1P/ugd6oYjpOI56ZjsXzJw5pz7r +DiwcIJJaaDIqvvc5C4iW94GZjwtmP5pxhvBZ5D6Uzmh7Okvi6z4QCKzdJQLdVmC0 +CMiFeh2FwqMkVpjZhNt3vtCo7Z51kwHVscel6vl51iQFq/laEzgzAWOUQ+ZEoQpL +uTaUiYzzNyEdGEzZ2CjMMoO8RgtXnUo2qX2FDQIDAQABAoIBAHWKW3kycloSMyhX +EnNSGeMz+bMtYwxNPMeebC/3xv+shoYXjAkiiTNWlfJ1MbbqjrhT1Pb1LYLbfqIF +1csWum/bjHpbMLRPO++RH1nxUJA/BMqT6HA8rWpy+JqiLW9GPf2DaP2gDYrZ0+yK +UIFG6MfzXgnju7OlkOItlvOQMY+Y501u/h6xnN2yTeRqXXJ1YlWFPRIeFdS6UOtL +J2wSxRVdymHbGwf+D7zet7ngMPwFBsbEN/83KGLRjkt8+dMQeUeob+nslsQofCZx +iokIAvByTugmqrB4JqhNkAlZhC0mqkRQh7zUFrxSj5UppMWlxLH+gPFZHKAsUJE5 +mqmylcECgYEA8I/f90cpF10uH4NPBCR4+eXq1PzYoD+NdXykN65bJTEDZVEy8rBO +phXRNfw030sc3R0waQaZVhFuSgshhRuryfG9c1FP6tQhqi/jiEj9IfCW7zN9V/P2 +r16pGjLuCK4SyxUC8H58Q9I0X2CQqFamtkLXC6Ogy86rZfIc8GcvZ9UCgYEAzMQZ +WAiLhRF2MEmMhKL+G3jm20r+dOzPYkfGxhIryluOXhuUhnxZWL8UZfiEqP5zH7Li +NeJvLz4pOL45rLw44qiNu6sHN0JNaKYvwNch1wPT/3/eDNZKKePqbAG4iamhjLy5 +gjO1KgA5FBbcNN3R6fuJAg1e4QJCOuo55eW6vFkCgYEA7UBIV72D5joM8iFzvZcn +BPdfqh2QnELxhaye3ReFZuG3AqaZg8akWqLryb1qe8q9tclC5GIQulTInBfsQDXx +MGLNQL0x/1ylsw417kRl+qIoidMTTLocUgse5erS3haoDEg1tPBaKB1Zb7NyF8QV ++W1kX2NKg5bZbdrh9asekt0CgYA6tUam7NxDrLv8IDo/lRPSAJn/6cKG95aGERo2 +k+MmQ5XP+Yxd+q0LOs24ZsZyRXHwdrNQy7khDGt5L2EN23Fb2wO3+NM6zrGu/WbX +nVbAdQKFUL3zZEUjOYtuqBemsJH27e0qHXUls6ap0dwU9DxJH6sqgXbggGtIxPsQ +pQsjEQKBgQC9gAqAj+ZtMXNG9exVPT8I15reox9kwxGuvJrRu/5eSi6jLR9z3x9P +2FrgxQ+GCB2ypoOUcliXrKesdSbolUilA8XQn/M113Lg8oA3gJXbAKqbTR/EgfUU +kvYaR/rTFnivF4SL/P4k/gABQoJuFUtSKdouELqefXB+e94g/G++Bg== +-----END RSA PRIVATE KEY-----` + +func main() { + server := mail.NewSMTPClient() + + // SMTP Server + server.Host = "smtp.example.com" + server.Port = 587 + server.Username = "test@example.com" + server.Password = "examplepass" + server.Encryption = mail.EncryptionSTARTTLS + + // Since v2.3.0 you can specified authentication type: + // - PLAIN (default) + // - LOGIN + // - CRAM-MD5 + // - None + // server.Authentication = mail.AuthPlain + + // Variable to keep alive connection + server.KeepAlive = false + + // Timeout for connect to SMTP Server + server.ConnectTimeout = 10 * time.Second + + // Timeout for send the data and wait respond + server.SendTimeout = 10 * time.Second + + // Set TLSConfig to provide custom TLS configuration. For example, + // to skip TLS verification (useful for testing): + server.TLSConfig = &tls.Config{InsecureSkipVerify: true} + + // SMTP client + smtpClient,err := server.Connect() + + if err != nil{ + log.Fatal(err) + } + + // New email simple html with inline and CC + email := mail.NewMSG() + email.SetFrom("From Example "). + AddTo("xhit@example.com"). + AddCc("otherto@example.com"). + SetSubject("New Go Email"). + SetListUnsubscribe("") + + email.SetBody(mail.TextHTML, htmlBody) + + // also you can add body from []byte with SetBodyData, example: + // email.SetBodyData(mail.TextHTML, []byte(htmlBody)) + // or alternative part + // email.AddAlternativeData(mail.TextHTML, []byte(htmlBody)) + + // add inline + email.Attach(&mail.File{FilePath: "/path/to/image.png", Name:"Gopher.png", Inline: true}) + + // you can add dkim signature to the email. + // to add dkim, you need a private key already created one. + if privateKey != "" { + options := dkim.NewSigOptions() + options.PrivateKey = []byte(privateKey) + options.Domain = "example.com" + options.Selector = "default" + options.SignatureExpireIn = 3600 + options.Headers = []string{"from", "date", "mime-version", "received", "received"} + options.AddSignatureTimestamp = true + options.Canonicalization = "relaxed/relaxed" + + email.SetDkim(options) + } + + // always check error after send + if email.Error != nil{ + log.Fatal(email.Error) + } + + // Call Send and pass the client + err = email.Send(smtpClient) + if err != nil { + log.Println(err) + } else { + log.Println("Email Sent") + } +} +``` + +## Send multiple emails in same connection + +```go + //Set your smtpClient struct to keep alive connection + server.KeepAlive = true + + for _, to := range []string{ + "to1@example1.com", + "to3@example2.com", + "to4@example3.com", + } { + // New email simple html with inline and CC + email := mail.NewMSG() + email.SetFrom("From Example "). + AddTo(to). + SetSubject("New Go Email") + + email.SetBody(mail.TextHTML, htmlBody) + + // add inline + email.Attach(&mail.File{FilePath: "/path/to/image.png", Name:"Gopher.png", Inline: true}) + + // always check error after send + if email.Error != nil{ + log.Fatal(email.Error) + } + + // Call Send and pass the client + err = email.Send(smtpClient) + if err != nil { + log.Println(err) + } else { + log.Println("Email Sent") + } + } +``` + +## More examples + +See [example/example_test.go](example/example_test.go). diff --git a/vendor/github.com/xhit/go-simple-mail/v2/attach.go b/vendor/github.com/xhit/go-simple-mail/v2/attach.go new file mode 100644 index 00000000..9aa48b6a --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/attach.go @@ -0,0 +1,157 @@ +package mail + +import ( + "encoding/base64" + "errors" + "io/ioutil" + "mime" + "path/filepath" +) + +// File represents the file that can be added to the email message. +// You can add attachment from file in path, from base64 string or from []byte. +// You can define if attachment is inline or not. +// Only one, Data, B64Data or FilePath is supported. If multiple are set, then +// the first in that order is used. +type File struct { + // FilePath is the path of the file to attach. + FilePath string + // Name is the name of file in attachment. Required for Data and B64Data. Optional for FilePath. + Name string + // MimeType of attachment. If empty then is obtained from Name (if not empty) or FilePath. If cannot obtained, application/octet-stream is set. + MimeType string + // B64Data is the base64 string to attach. + B64Data string + // Data is the []byte of file to attach. + Data []byte + // Inline defines if attachment is inline or not. + Inline bool +} + +type attachType int + +const ( + attachData attachType = iota + attachB64 + attachFile +) + +// Attach allows you to add an attachment to the email message. +// The attachment can be inlined +func (email *Email) Attach(file *File) *Email { + if email.Error != nil { + return email + } + + var name = file.Name + var mimeType = file.MimeType + + // if no alternative name was provided, get the filename + if len(name) == 0 && len(file.FilePath) > 0 { + _, name = filepath.Split(file.FilePath) + } + + // get the mimetype + if mimeType == "" { + mimeType = mime.TypeByExtension(filepath.Ext(name)) + if mimeType == "" { + mimeType = "application/octet-stream" + } + } + + attachTy, err := getAttachmentType(file) + if err != nil { + email.Error = errors.New("Mail Error: Failed to add attachment with following error: " + err.Error()) + return email + } + + file.Name = name + file.MimeType = mimeType + + switch attachTy { + case attachData: + email.attachData(file) + case attachB64: + email.Error = email.attachB64(file) + case attachFile: + email.Error = email.attachFile(file) + } + + return email +} + +func getAttachmentType(file *File) (attachType, error) { + // 1- data + // 2- base64 + // 3- file + + // first check if Data + if len(file.Data) > 0 { + // data requires a name + if len(file.Name) == 0 { + return 0, errors.New("attach from bytes requires a name") + } + return attachData, nil + } + + // check if base64 + if len(file.B64Data) > 0 { + // B64Data requires a name + if len(file.Name) == 0 { + return 0, errors.New("attach from base64 string requires a name") + } + return attachB64, nil + } + + // check if file + if len(file.FilePath) > 0 { + return attachFile, nil + } + + return 0, errors.New("empty attachment") +} + +// attachB64 does the low level attaching of the files but decoding base64 +func (email *Email) attachB64(file *File) error { + + // decode the string + dec, err := base64.StdEncoding.DecodeString(file.B64Data) + if err != nil { + return errors.New("Mail Error: Failed to decode base64 attachment with following error: " + err.Error()) + } + + email.attachData(&File{ + Name: file.Name, + MimeType: file.MimeType, + Data: dec, + Inline: file.Inline, + }) + + return nil +} + +func (email *Email) attachFile(file *File) error { + data, err := ioutil.ReadFile(file.FilePath) + if err != nil { + return errors.New("Mail Error: Failed to add file with following error: " + err.Error()) + } + + email.attachData(&File{ + Name: file.Name, + MimeType: file.MimeType, + Data: data, + Inline: file.Inline, + }) + + return nil +} + +// attachData does the low level attaching of the in-memory data +func (email *Email) attachData(file *File) { + // use inlines and attachments because is necessary to know if message has related parts and mixed parts + if file.Inline { + email.inlines = append(email.inlines, file) + } else { + email.attachments = append(email.attachments, file) + } +} diff --git a/vendor/github.com/xhit/go-simple-mail/v2/attach_old.go b/vendor/github.com/xhit/go-simple-mail/v2/attach_old.go new file mode 100644 index 00000000..53ee35cc --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/attach_old.go @@ -0,0 +1,69 @@ +package mail + +import ( + "errors" +) + +// TODO: Remove this file before launch v3 + +// AddAttachment. DEPRECATED. Use Attach method. Allows you to add an attachment to the email message. +// You can optionally provide a different name for the file. +func (email *Email) AddAttachment(file string, name ...string) *Email { + if email.Error != nil { + return email + } + + if len(name) > 1 { + email.Error = errors.New("Mail Error: Attach can only have a file and an optional name") + return email + } + + var nm string + if len(name) == 1 { + nm = name[0] + } + return email.Attach(&File{Name: nm, FilePath: file}) +} + +// AddAttachmentData. DEPRECATED. Use Attach method. Allows you to add an in-memory attachment to the email message. +func (email *Email) AddAttachmentData(data []byte, filename, mimeType string) *Email { + return email.Attach(&File{Data: data, Name: filename, MimeType: mimeType}) +} + +// AddAttachmentBase64. DEPRECATED. Use Attach method. Allows you to add an attachment in base64 to the email message. +// You need provide a name for the file. +func (email *Email) AddAttachmentBase64(b64File, name string) *Email { + return email.Attach(&File{B64Data: b64File, Name: name}) +} + +// AddInline. DEPRECATED. Use Attach method. Allows you to add an inline attachment to the email message. +// You can optionally provide a different name for the file. +func (email *Email) AddInline(file string, name ...string) *Email { + if email.Error != nil { + return email + } + + if len(name) > 1 { + email.Error = errors.New("Mail Error: Inline can only have a file and an optional name") + return email + } + + var nm string + if len(name) == 1 { + nm = name[0] + } + + return email.Attach(&File{Name: nm, FilePath: file, Inline: true}) +} + +// AddInlineData. DEPRECATED. Use Attach method. Allows you to add an inline in-memory attachment to the email message. +func (email *Email) AddInlineData(data []byte, filename, mimeType string) *Email { + return email.Attach(&File{Data: data, Name: filename, MimeType: mimeType, Inline: true}) +} + +// AddInlineBase64. DEPRECATED. Use Attach method. Allows you to add an inline in-memory base64 encoded attachment to the email message. +// You need provide a name for the file. If mimeType is an empty string, attachment mime type will be deduced +// from the file name extension and defaults to application/octet-stream. +func (email *Email) AddInlineBase64(b64File, name, mimeType string) *Email { + return email.Attach(&File{B64Data: b64File, Name: name, MimeType: mimeType, Inline: true}) +} diff --git a/vendor/github.com/xhit/go-simple-mail/v2/auth.go b/vendor/github.com/xhit/go-simple-mail/v2/auth.go new file mode 100644 index 00000000..695d1ecf --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/auth.go @@ -0,0 +1,145 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in https://raw.githubusercontent.com/golang/go/master/LICENSE +// auth.go file is a modification of smtp golang package what is frozen and is not accepting new features. + +package mail + +import ( + "crypto/hmac" + "crypto/md5" + "errors" + "fmt" + "strings" +) + +// auth is implemented by an SMTP authentication mechanism. +type auth interface { + // start begins an authentication with a server. + // It returns the name of the authentication protocol + // and optionally data to include in the initial AUTH message + // sent to the server. It can return proto == "" to indicate + // that the authentication should be skipped. + // If it returns a non-nil error, the SMTP client aborts + // the authentication attempt and closes the connection. + start(server *serverInfo) (proto string, toServer []byte, err error) + + // next continues the authentication. The server has just sent + // the fromServer data. If more is true, the server expects a + // response, which next should return as toServer; otherwise + // next should return toServer == nil. + // If next returns a non-nil error, the SMTP client aborts + // the authentication attempt and closes the connection. + next(fromServer []byte, more bool) (toServer []byte, err error) +} + +// serverInfo records information about an SMTP server. +type serverInfo struct { + name string // SMTP server name + tls bool // using TLS, with valid certificate for Name + auth []string // advertised authentication mechanisms +} + +type plainAuth struct { + identity, username, password string + host string +} + +// plainAuthfn returns an auth that implements the PLAIN authentication +// mechanism as defined in RFC 4616. The returned Auth uses the given +// username and password to authenticate to host and act as identity. +// Usually identity should be the empty string, to act as username. +// +// plainAuthfn will only send the credentials if the connection is using TLS +// or is connected to localhost. Otherwise authentication will fail with an +// error, without sending the credentials. +func plainAuthfn(identity, username, password, host string) auth { + return &plainAuth{identity, username, password, host} +} + +func (a *plainAuth) start(server *serverInfo) (string, []byte, error) { + // Must have TLS, or else localhost server. Unencrypted connection is permitted here too but is not recommended + // Note: If TLS is not true, then we can't trust ANYTHING in serverInfo. + // In particular, it doesn't matter if the server advertises PLAIN auth. + // That might just be the attacker saying + // "it's ok, you can trust me with your password." + if server.name != a.host { + return "", nil, errors.New("wrong host name") + } + resp := []byte(a.identity + "\x00" + a.username + "\x00" + a.password) + return "PLAIN", resp, nil +} + +func (a *plainAuth) next(fromServer []byte, more bool) ([]byte, error) { + if more { + // We've already sent everything. + return nil, errors.New("unexpected server challenge") + } + return nil, nil +} + +/* +loginAuthfn authentication implements LOGIN Authentication, is the same PLAIN +but username and password are sent in different commands +*/ + +type loginAuth struct { + identity, username, password string + host string +} + +func loginAuthfn(identity, username, password, host string) auth { + return &loginAuth{identity, username, password, host} +} + +func (a *loginAuth) start(server *serverInfo) (string, []byte, error) { + if server.name != a.host { + return "", nil, errors.New("wrong host name") + } + resp := []byte(a.username) + return "LOGIN", resp, nil +} + +func (a *loginAuth) next(fromServer []byte, more bool) ([]byte, error) { + if more { + if strings.Contains(string(fromServer), "Username") { + resp := []byte(a.username) + return resp, nil + } + + if strings.Contains(string(fromServer), "Password") { + resp := []byte(a.password) + return resp, nil + } + + // We've already sent everything. + return nil, errors.New("unexpected server challenge") + } + return nil, nil +} + +type cramMD5Auth struct { + username, secret string +} + +// cramMD5Authfn returns an Auth that implements the CRAM-MD5 authentication +// mechanism as defined in RFC 2195. +// The returned Auth uses the given username and secret to authenticate +// to the server using the challenge-response mechanism. +func cramMD5Authfn(username, secret string) auth { + return &cramMD5Auth{username, secret} +} + +func (a *cramMD5Auth) start(server *serverInfo) (string, []byte, error) { + return "CRAM-MD5", nil, nil +} + +func (a *cramMD5Auth) next(fromServer []byte, more bool) ([]byte, error) { + if more { + d := hmac.New(md5.New, []byte(a.secret)) + d.Write(fromServer) + s := make([]byte, 0, d.Size()) + return []byte(fmt.Sprintf("%s %x", a.username, d.Sum(s))), nil + } + return nil, nil +} diff --git a/vendor/github.com/xhit/go-simple-mail/v2/email.go b/vendor/github.com/xhit/go-simple-mail/v2/email.go new file mode 100644 index 00000000..4f9f6d12 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/email.go @@ -0,0 +1,946 @@ +package mail + +import ( + "bytes" + "crypto/tls" + "errors" + "fmt" + "net" + "net/mail" + "net/textproto" + "strconv" + "time" + + "github.com/toorop/go-dkim" +) + +// Email represents an email message. +type Email struct { + from string + sender string + replyTo string + returnPath string + recipients []string + headers textproto.MIMEHeader + parts []part + attachments []*File + inlines []*File + Charset string + Encoding encoding + Error error + SMTPServer *smtpClient + DkimMsg string + AllowDuplicateAddress bool +} + +/* +SMTPServer represents a SMTP Server +If authentication is CRAM-MD5 then the Password is the Secret +*/ +type SMTPServer struct { + Authentication AuthType + Encryption Encryption + Username string + Password string + Helo string + ConnectTimeout time.Duration + SendTimeout time.Duration + Host string + Port int + KeepAlive bool + TLSConfig *tls.Config +} + +// SMTPClient represents a SMTP Client for send email +type SMTPClient struct { + Client *smtpClient + KeepAlive bool + SendTimeout time.Duration +} + +// part represents the different content parts of an email body. +type part struct { + contentType string + body *bytes.Buffer +} + +// Encryption type to enum encryption types (None, SSL/TLS, STARTTLS) +type Encryption int + +// TODO: Remove EncryptionSSL and EncryptionTLS before launch v3 + +const ( + // EncryptionNone uses no encryption when sending email + EncryptionNone Encryption = iota + // EncryptionSSL: DEPRECATED. Use EncryptionSSLTLS. Sets encryption type to SSL/TLS when sending email + EncryptionSSL + // EncryptionTLS: DEPRECATED. Use EncryptionSTARTTLS. sets encryption type to STARTTLS when sending email + EncryptionTLS + // EncryptionSSLTLS sets encryption type to SSL/TLS when sending email + EncryptionSSLTLS + // EncryptionSTARTTLS sets encryption type to STARTTLS when sending email + EncryptionSTARTTLS +) + +// TODO: Remove last two indexes +var encryptionTypes = [...]string{"None", "SSL/TLS", "STARTTLS", "SSL/TLS", "STARTTLS"} + +func (encryption Encryption) String() string { + return encryptionTypes[encryption] +} + +type encoding int + +const ( + // EncodingNone turns off encoding on the message body + EncodingNone encoding = iota + // EncodingBase64 sets the message body encoding to base64 + EncodingBase64 + // EncodingQuotedPrintable sets the message body encoding to quoted-printable + EncodingQuotedPrintable +) + +var encodingTypes = [...]string{"binary", "base64", "quoted-printable"} + +func (encoding encoding) string() string { + return encodingTypes[encoding] +} + +type ContentType int + +const ( + // TextPlain sets body type to text/plain in message body + TextPlain ContentType = iota + // TextHTML sets body type to text/html in message body + TextHTML + // TextCalendar sets body type to text/calendar in message body + TextCalendar +) + +var contentTypes = [...]string{"text/plain", "text/html", "text/calendar"} + +func (contentType ContentType) string() string { + return contentTypes[contentType] +} + +type AuthType int + +const ( + // AuthPlain implements the PLAIN authentication + AuthPlain AuthType = iota + // AuthLogin implements the LOGIN authentication + AuthLogin + // AuthCRAMMD5 implements the CRAM-MD5 authentication + AuthCRAMMD5 + // AuthNone for SMTP servers without authentication + AuthNone +) + +// NewMSG creates a new email. It uses UTF-8 by default. All charsets: http://webcheatsheet.com/HTML/character_sets_list.php +func NewMSG() *Email { + email := &Email{ + headers: make(textproto.MIMEHeader), + Charset: "UTF-8", + Encoding: EncodingQuotedPrintable, + } + + email.AddHeader("MIME-Version", "1.0") + + return email +} + +// NewSMTPClient returns the client for send email +func NewSMTPClient() *SMTPServer { + server := &SMTPServer{ + Authentication: AuthPlain, + Encryption: EncryptionNone, + ConnectTimeout: 10 * time.Second, + SendTimeout: 10 * time.Second, + Helo: "localhost", + } + return server +} + +// GetEncryptionType returns the encryption type used to connect to SMTP server +func (server *SMTPServer) GetEncryptionType() Encryption { + return server.Encryption +} + +// GetError returns the first email error encountered +func (email *Email) GetError() error { + return email.Error +} + +// SetFrom sets the From address. +func (email *Email) SetFrom(address string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("From", address) + + return email +} + +// SetSender sets the Sender address. +func (email *Email) SetSender(address string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("Sender", address) + + return email +} + +// SetReplyTo sets the Reply-To address. +func (email *Email) SetReplyTo(address string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("Reply-To", address) + + return email +} + +// SetReturnPath sets the Return-Path address. This is most often used +// to send bounced emails to a different email address. +func (email *Email) SetReturnPath(address string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("Return-Path", address) + + return email +} + +// AddTo adds a To address. You can provide multiple +// addresses at the same time. +func (email *Email) AddTo(addresses ...string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("To", addresses...) + + return email +} + +// AddCc adds a Cc address. You can provide multiple +// addresses at the same time. +func (email *Email) AddCc(addresses ...string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("Cc", addresses...) + + return email +} + +// AddBcc adds a Bcc address. You can provide multiple +// addresses at the same time. +func (email *Email) AddBcc(addresses ...string) *Email { + if email.Error != nil { + return email + } + + email.AddAddresses("Bcc", addresses...) + + return email +} + +// AddAddresses allows you to add addresses to the specified address header. +func (email *Email) AddAddresses(header string, addresses ...string) *Email { + if email.Error != nil { + return email + } + + found := false + + // check for a valid address header + for _, h := range []string{"To", "Cc", "Bcc", "From", "Sender", "Reply-To", "Return-Path"} { + if header == h { + found = true + } + } + + if !found { + email.Error = errors.New("Mail Error: Invalid address header; Header: [" + header + "]") + return email + } + + // check to see if the addresses are valid + for i := range addresses { + var address = new(mail.Address) + var err error + + // ignore parse the address if empty + if len(addresses[i]) > 0 { + address, err = mail.ParseAddress(addresses[i]) + if err != nil { + email.Error = errors.New("Mail Error: " + err.Error() + "; Header: [" + header + "] Address: [" + addresses[i] + "]") + return email + } + } else { + continue + } + + // check for more than one address + switch { + case header == "Sender" && len(email.sender) > 0: + fallthrough + case header == "Reply-To" && len(email.replyTo) > 0: + fallthrough + case header == "Return-Path" && len(email.returnPath) > 0: + email.Error = errors.New("Mail Error: There can only be one \"" + header + "\" address; Header: [" + header + "] Address: [" + addresses[i] + "]") + return email + default: + // other address types can have more than one address + } + + // save the address + switch header { + case "From": + // delete the current "From" to set the new + // when "From" need to be changed in the message + if len(email.from) > 0 && header == "From" { + email.headers.Del("From") + } + email.from = address.Address + case "Sender": + email.sender = address.Address + case "Reply-To": + email.replyTo = address.Address + case "Return-Path": + email.returnPath = address.Address + default: + // check that the address was added to the recipients list + email.recipients, err = addAddress(email.recipients, address.Address, email.AllowDuplicateAddress) + if err != nil { + email.Error = errors.New("Mail Error: " + err.Error() + "; Header: [" + header + "] Address: [" + addresses[i] + "]") + return email + } + } + + // make sure the from and sender addresses are different + if email.from != "" && email.sender != "" && email.from == email.sender { + email.sender = "" + email.headers.Del("Sender") + email.Error = errors.New("Mail Error: From and Sender should not be set to the same address") + return email + } + + // add all addresses to the headers except for Bcc and Return-Path + if header != "Bcc" && header != "Return-Path" { + // add the address to the headers + email.headers.Add(header, address.String()) + } + } + + return email +} + +// addAddress adds an address to the address list if it hasn't already been added +func addAddress(addressList []string, address string, allowDuplicateAddress bool) ([]string, error) { + if !allowDuplicateAddress { + // loop through the address list to check for dups + for _, a := range addressList { + if address == a { + return addressList, errors.New("Mail Error: Address: [" + address + "] has already been added") + } + } + } + + return append(addressList, address), nil +} + +type priority int + +const ( + // PriorityLow sets the email priority to Low + PriorityLow priority = iota + // PriorityHigh sets the email priority to High + PriorityHigh +) + +// SetPriority sets the email message priority. Use with +// either "High" or "Low". +func (email *Email) SetPriority(priority priority) *Email { + if email.Error != nil { + return email + } + + switch priority { + case PriorityLow: + email.AddHeaders(textproto.MIMEHeader{ + "X-Priority": {"5 (Lowest)"}, + "X-MSMail-Priority": {"Low"}, + "Importance": {"Low"}, + }) + case PriorityHigh: + email.AddHeaders(textproto.MIMEHeader{ + "X-Priority": {"1 (Highest)"}, + "X-MSMail-Priority": {"High"}, + "Importance": {"High"}, + }) + default: + } + + return email +} + +// SetDate sets the date header to the provided date/time. +// The format of the string should be YYYY-MM-DD HH:MM:SS Time Zone. +// +// Example: SetDate("2015-04-28 10:32:00 CDT") +func (email *Email) SetDate(dateTime string) *Email { + if email.Error != nil { + return email + } + + const dateFormat = "2006-01-02 15:04:05 MST" + + // Try to parse the provided date/time + dt, err := time.Parse(dateFormat, dateTime) + if err != nil { + email.Error = errors.New("Mail Error: Setting date failed with: " + err.Error()) + return email + } + + email.headers.Set("Date", dt.Format(time.RFC1123Z)) + + return email +} + +// SetSubject sets the subject of the email message. +func (email *Email) SetSubject(subject string) *Email { + if email.Error != nil { + return email + } + + email.AddHeader("Subject", subject) + + return email +} + +// SetListUnsubscribe sets the Unsubscribe address. +func (email *Email) SetListUnsubscribe(address string) *Email { + if email.Error != nil { + return email + } + + email.AddHeader("List-Unsubscribe", address) + + return email +} + +// SetDkim adds DomainKey signature to the email message (header+body) +func (email *Email) SetDkim(options dkim.SigOptions) *Email { + if email.Error != nil { + return email + } + + msg := []byte(email.GetMessage()) + err := dkim.Sign(&msg, options) + + if err != nil { + email.Error = errors.New("Mail Error: cannot dkim sign message due: %s" + err.Error()) + return email + } + + email.DkimMsg = string(msg) + + return email +} + +// SetBody sets the body of the email message. +func (email *Email) SetBody(contentType ContentType, body string) *Email { + if email.Error != nil { + return email + } + + email.parts = []part{ + { + contentType: contentType.string(), + body: bytes.NewBufferString(body), + }, + } + + return email +} + +// SetBodyData sets the body of the email message from []byte +func (email *Email) SetBodyData(contentType ContentType, body []byte) *Email { + if email.Error != nil { + return email + } + + email.parts = []part{ + { + contentType: contentType.string(), + body: bytes.NewBuffer(body), + }, + } + + return email +} + +// AddHeader adds the given "header" with the passed "value". +func (email *Email) AddHeader(header string, values ...string) *Email { + if email.Error != nil { + return email + } + + // check that there is actually a value + if len(values) < 1 { + email.Error = errors.New("Mail Error: no value provided; Header: [" + header + "]") + return email + } + + if header != "MIME-Version" { + // Set header to correct canonical Mime + header = textproto.CanonicalMIMEHeaderKey(header) + } + + switch header { + case "Sender": + fallthrough + case "From": + fallthrough + case "To": + fallthrough + case "Bcc": + fallthrough + case "Cc": + fallthrough + case "Reply-To": + fallthrough + case "Return-Path": + email.AddAddresses(header, values...) + case "Date": + if len(values) > 1 { + email.Error = errors.New("Mail Error: To many dates provided") + return email + } + email.SetDate(values[0]) + case "List-Unsubscribe": + fallthrough + default: + email.headers[header] = values + } + + return email +} + +// AddHeaders is used to add multiple headers at once +func (email *Email) AddHeaders(headers textproto.MIMEHeader) *Email { + if email.Error != nil { + return email + } + + for header, values := range headers { + email.AddHeader(header, values...) + } + + return email +} + +// AddAlternative allows you to add alternative parts to the body +// of the email message. This is most commonly used to add an +// html version in addition to a plain text version that was +// already added with SetBody. +func (email *Email) AddAlternative(contentType ContentType, body string) *Email { + if email.Error != nil { + return email + } + + email.parts = append(email.parts, + part{ + contentType: contentType.string(), + body: bytes.NewBufferString(body), + }, + ) + + return email +} + +// AddAlternativeData allows you to add alternative parts to the body +// of the email message. This is most commonly used to add an +// html version in addition to a plain text version that was +// already added with SetBody. +func (email *Email) AddAlternativeData(contentType ContentType, body []byte) *Email { + if email.Error != nil { + return email + } + + email.parts = append(email.parts, + part{ + contentType: contentType.string(), + body: bytes.NewBuffer(body), + }, + ) + + return email +} + +// GetFrom returns the sender of the email, if any +func (email *Email) GetFrom() string { + from := email.returnPath + if from == "" { + from = email.sender + if from == "" { + from = email.from + if from == "" { + from = email.replyTo + } + } + } + + return from +} + +// GetRecipients returns a slice of recipients emails +func (email *Email) GetRecipients() []string { + return email.recipients +} + +func (email *Email) hasMixedPart() bool { + return (len(email.parts) > 0 && len(email.attachments) > 0) || len(email.attachments) > 1 +} + +func (email *Email) hasRelatedPart() bool { + return (len(email.parts) > 0 && len(email.inlines) > 0) || len(email.inlines) > 1 +} + +func (email *Email) hasAlternativePart() bool { + return len(email.parts) > 1 +} + +// GetMessage builds and returns the email message (RFC822 formatted message) +func (email *Email) GetMessage() string { + msg := newMessage(email) + + if email.hasMixedPart() { + msg.openMultipart("mixed") + } + + if email.hasRelatedPart() { + msg.openMultipart("related") + } + + if email.hasAlternativePart() { + msg.openMultipart("alternative") + } + + for _, part := range email.parts { + msg.addBody(part.contentType, part.body.Bytes()) + } + + if email.hasAlternativePart() { + msg.closeMultipart() + } + + msg.addFiles(email.inlines, true) + if email.hasRelatedPart() { + msg.closeMultipart() + } + + msg.addFiles(email.attachments, false) + if email.hasMixedPart() { + msg.closeMultipart() + } + + return msg.getHeaders() + msg.body.String() +} + +// Send sends the composed email +func (email *Email) Send(client *SMTPClient) error { + return email.SendEnvelopeFrom(email.from, client) +} + +// SendEnvelopeFrom sends the composed email with envelope +// sender. 'from' must be an email address. +func (email *Email) SendEnvelopeFrom(from string, client *SMTPClient) error { + if email.Error != nil { + return email.Error + } + + if from == "" { + from = email.from + } + + if len(email.recipients) < 1 { + return errors.New("Mail Error: No recipient specified") + } + + var msg string + if email.DkimMsg != "" { + msg = email.DkimMsg + } else { + msg = email.GetMessage() + } + + return send(from, email.recipients, msg, client) +} + +// dial connects to the smtp server with the request encryption type +func dial(host string, port string, encryption Encryption, config *tls.Config) (*smtpClient, error) { + var conn net.Conn + var err error + + address := host + ":" + port + + // do the actual dial + switch encryption { + // TODO: Remove EncryptionSSL check before launch v3 + case EncryptionSSL, EncryptionSSLTLS: + conn, err = tls.Dial("tcp", address, config) + default: + conn, err = net.Dial("tcp", address) + } + + if err != nil { + return nil, errors.New("Mail Error on dialing with encryption type " + encryption.String() + ": " + err.Error()) + } + + c, err := newClient(conn, host) + + if err != nil { + return nil, fmt.Errorf("Mail Error on smtp dial: %w", err) + } + + return c, err +} + +// smtpConnect connects to the smtp server and starts TLS and passes auth +// if necessary +func smtpConnect(host, port, helo string, a auth, at AuthType, encryption Encryption, config *tls.Config) (*smtpClient, error) { + // connect to the mail server + c, err := dial(host, port, encryption, config) + + if err != nil { + return nil, err + } + + if helo == "" { + helo = "localhost" + } + + // send Helo + if err = c.hi(helo); err != nil { + c.close() + return nil, fmt.Errorf("Mail Error on Hello: %w", err) + } + + // STARTTLS if necessary + // TODO: Remove EncryptionTLS check before launch v3 + if encryption == EncryptionTLS || encryption == EncryptionSTARTTLS { + if ok, _ := c.extension("STARTTLS"); ok { + if err = c.startTLS(config); err != nil { + c.close() + return nil, fmt.Errorf("Mail Error on STARTTLS: %w", err) + } + } + } + + // only pass authentication if defined + if at != AuthNone { + // pass the authentication if necessary + if a != nil { + if ok, _ := c.extension("AUTH"); ok { + if err = c.authenticate(a); err != nil { + c.close() + return nil, fmt.Errorf("Mail Error on Auth: %w", err) + } + } + } + } + + return c, nil +} + +// Connect returns the smtp client +func (server *SMTPServer) Connect() (*SMTPClient, error) { + + var a auth + + switch server.Authentication { + case AuthPlain: + if server.Username != "" || server.Password != "" { + a = plainAuthfn("", server.Username, server.Password, server.Host) + } + case AuthLogin: + if server.Username != "" || server.Password != "" { + a = loginAuthfn("", server.Username, server.Password, server.Host) + } + case AuthCRAMMD5: + if server.Username != "" || server.Password != "" { + a = cramMD5Authfn(server.Username, server.Password) + } + } + + var smtpConnectChannel chan error + var c *smtpClient + var err error + + tlsConfig := server.TLSConfig + if tlsConfig == nil { + tlsConfig = &tls.Config{ServerName: server.Host} + } + + // if there is a ConnectTimeout, setup the channel and do the connect under a goroutine + if server.ConnectTimeout != 0 { + smtpConnectChannel = make(chan error, 2) + go func() { + c, err = smtpConnect(server.Host, fmt.Sprintf("%d", server.Port), server.Helo, a, server.Authentication, server.Encryption, tlsConfig) + // send the result + smtpConnectChannel <- err + }() + // get the connect result or timeout result, which ever happens first + select { + case err = <-smtpConnectChannel: + if err != nil { + return nil, err + } + case <-time.After(server.ConnectTimeout): + return nil, errors.New("Mail Error: SMTP Connection timed out") + } + } else { + // no ConnectTimeout, just fire the connect + c, err = smtpConnect(server.Host, fmt.Sprintf("%d", server.Port), server.Helo, a, server.Authentication, server.Encryption, tlsConfig) + if err != nil { + return nil, err + } + } + + return &SMTPClient{ + Client: c, + KeepAlive: server.KeepAlive, + SendTimeout: server.SendTimeout, + }, nil +} + +// Reset send RSET command to smtp client +func (smtpClient *SMTPClient) Reset() error { + return smtpClient.Client.reset() +} + +// Noop send NOOP command to smtp client +func (smtpClient *SMTPClient) Noop() error { + return smtpClient.Client.noop() +} + +// Quit send QUIT command to smtp client +func (smtpClient *SMTPClient) Quit() error { + return smtpClient.Client.quit() +} + +// Close closes the connection +func (smtpClient *SMTPClient) Close() error { + return smtpClient.Client.close() +} + +// SendMessage sends a message (a RFC822 formatted message) +// 'from' must be an email address, recipients must be a slice of email address +func SendMessage(from string, recipients []string, msg string, client *SMTPClient) error { + if from == "" { + return errors.New("Mail Error: No From email specifier") + } + if len(recipients) < 1 { + return errors.New("Mail Error: No recipient specified") + } + + return send(from, recipients, msg, client) +} + +// send does the low level sending of the email +func send(from string, to []string, msg string, client *SMTPClient) error { + //Check if client struct is not nil + if client != nil { + + //Check if client is not nil + if client.Client != nil { + var smtpSendChannel chan error + + // if there is a SendTimeout, setup the channel and do the send under a goroutine + if client.SendTimeout != 0 { + smtpSendChannel = make(chan error, 1) + + go func(from string, to []string, msg string, c *smtpClient) { + smtpSendChannel <- sendMailProcess(from, to, msg, c) + }(from, to, msg, client.Client) + } + + if client.SendTimeout == 0 { + // no SendTimeout, just fire the sendMailProcess + return sendMailProcess(from, to, msg, client.Client) + } + + // get the send result or timeout result, which ever happens first + select { + case sendError := <-smtpSendChannel: + checkKeepAlive(client) + return sendError + case <-time.After(client.SendTimeout): + checkKeepAlive(client) + return errors.New("Mail Error: SMTP Send timed out") + } + + } + } + + return errors.New("Mail Error: No SMTP Client Provided") +} + +func sendMailProcess(from string, to []string, msg string, c *smtpClient) error { + + cmdArgs := make(map[string]string) + + if _, ok := c.ext["SIZE"]; ok { + cmdArgs["SIZE"] = strconv.Itoa(len(msg)) + } + + // Set the sender + if err := c.mail(from, cmdArgs); err != nil { + return err + } + + // Set the recipients + for _, address := range to { + if err := c.rcpt(address); err != nil { + return err + } + } + + // Send the data command + w, err := c.data() + if err != nil { + return err + } + + // write the message + _, err = fmt.Fprint(w, msg) + if err != nil { + return err + } + + err = w.Close() + if err != nil { + return err + } + + return nil +} + +// check if keepAlive for close or reset +func checkKeepAlive(client *SMTPClient) { + if client.KeepAlive { + client.Client.reset() + } else { + client.Client.quit() + client.Client.close() + } +} diff --git a/vendor/github.com/xhit/go-simple-mail/v2/header.go b/vendor/github.com/xhit/go-simple-mail/v2/header.go new file mode 100644 index 00000000..3b024a29 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/header.go @@ -0,0 +1,197 @@ +// headers.go implements "Q" encoding as specified by RFC 2047. +//Modified from https://github.com/joegrasse/mime to use with Go Simple Mail + +package mail + +import ( + "bufio" + "bytes" + "fmt" + "io" + "strings" + "unicode/utf8" +) + +type encoder struct { + w *bufio.Writer + charset string + usedChars int +} + +// newEncoder returns a new mime header encoder that writes to w. The c +// parameter specifies the name of the character set of the text that will be +// encoded. The u parameter indicates how many characters have been used +// already. +func newEncoder(w io.Writer, c string, u int) *encoder { + return &encoder{bufio.NewWriter(w), strings.ToUpper(c), u} +} + +// encode encodes p using the "Q" encoding and writes it to the underlying +// io.Writer. It limits line length to 75 characters. +func (e *encoder) encode(p []byte) (n int, err error) { + var output bytes.Buffer + allPrintable := true + + // some lines we encode end in " + //maxLineLength := 75 - 1 + maxLineLength := 76 + + // prevent header injection + p = secureHeader(p) + + // check to see if we have all printable characters + for _, c := range p { + if !isVchar(c) && !isWSP(c) { + allPrintable = false + break + } + } + + // all characters are printable. just do line folding + if allPrintable { + text := string(p) + words := strings.Split(text, " ") + + lineBuffer := "" + firstWord := true + + // split the line where necessary + for _, word := range words { + /*fmt.Println("Current Line:",lineBuffer) + fmt.Println("Here: Max:", maxLineLength ,"Buffer Length:", len(lineBuffer), "Used Chars:", e.usedChars, "Length Encoded Char:",len(word)) + fmt.Println("----------")*/ + + newWord := "" + if !firstWord { + newWord += " " + } + newWord += word + + // check line length + if (e.usedChars+len(lineBuffer)+len(newWord) /*+len(" ")+len(word)*/) > maxLineLength && (lineBuffer != "" || e.usedChars != 0) { + output.WriteString(lineBuffer + "\r\n") + + // first word on newline needs a space in front + if !firstWord { + lineBuffer = "" + } else { + lineBuffer = " " + } + + //firstLine = false + //firstWord = true + // reset since not on the first line anymore + e.usedChars = 0 + } + + /*if !firstWord { + lineBuffer += " " + }*/ + + lineBuffer += newWord /*word*/ + + firstWord = false + + // reset since not on the first line anymore + /*if !firstLine { + e.usedChars = 0 + }*/ + } + + output.WriteString(lineBuffer) + + } else { + firstLine := true + + // A single encoded word can not be longer than 75 characters + if e.usedChars == 0 { + maxLineLength = 75 + } + + wordBegin := "=?" + e.charset + "?Q?" + wordEnd := "?=" + + lineBuffer := wordBegin + + for i := 0; i < len(p); { + // encode the character + encodedChar, runeLength := encode(p, i) + + /*fmt.Println("Current Line:",lineBuffer) + fmt.Println("Here: Max:", maxLineLength ,"Buffer Length:", len(lineBuffer), "Used Chars:", e.usedChars, "Length Encoded Char:",len(encodedChar)) + fmt.Println("----------")*/ + + // Check line length + if len(lineBuffer)+e.usedChars+len(encodedChar) > (maxLineLength - len(wordEnd)) { + output.WriteString(lineBuffer + wordEnd + "\r\n") + lineBuffer = " " + wordBegin + firstLine = false + } + + lineBuffer += encodedChar + + i = i + runeLength + + // reset since not on the first line anymore + if !firstLine { + e.usedChars = 0 + maxLineLength = 76 + } + } + + output.WriteString(lineBuffer + wordEnd) + } + + e.w.Write(output.Bytes()) + e.w.Flush() + n = output.Len() + + return n, nil +} + +// encode takes a string and position in that string and encodes one utf-8 +// character. It then returns the encoded string and number of runes in the +// character. +func encode(text []byte, i int) (encodedString string, runeLength int) { + started := false + + for ; i < len(text) && (!utf8.RuneStart(text[i]) || !started); i++ { + switch c := text[i]; { + case c == ' ': + encodedString += "_" + case isVchar(c) && c != '=' && c != '?' && c != '_': + encodedString += string(c) + default: + encodedString += fmt.Sprintf("=%02X", c) + } + + runeLength++ + + started = true + } + + return +} + +// secureHeader removes all unnecessary values to prevent +// header injection +func secureHeader(text []byte) []byte { + secureValue := strings.TrimSpace(string(text)) + secureValue = strings.Replace(secureValue, "\r", "", -1) + secureValue = strings.Replace(secureValue, "\n", "", -1) + secureValue = strings.Replace(secureValue, "\t", "", -1) + + return []byte(secureValue) +} + +// isVchar returns true if c is an RFC 5322 VCHAR character. +func isVchar(c byte) bool { + // Visible (printing) characters. + return '!' <= c && c <= '~' +} + +// isWSP returns true if c is a WSP (white space). +// WSP is a space or horizontal tab (RFC5234 Appendix B). +func isWSP(c byte) bool { + return c == ' ' || c == '\t' +} diff --git a/vendor/github.com/xhit/go-simple-mail/v2/message.go b/vendor/github.com/xhit/go-simple-mail/v2/message.go new file mode 100644 index 00000000..98c4dfe8 --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/message.go @@ -0,0 +1,248 @@ +package mail + +import ( + "bytes" + "encoding/base64" + "io" + "mime/multipart" + "mime/quotedprintable" + "net/textproto" + "regexp" + "strconv" + "strings" + "time" +) + +type message struct { + headers textproto.MIMEHeader + body *bytes.Buffer + writers []*multipart.Writer + parts uint8 + cids map[string]string + charset string + encoding encoding +} + +func newMessage(email *Email) *message { + return &message{ + headers: email.headers, + body: new(bytes.Buffer), + cids: make(map[string]string), + charset: email.Charset, + encoding: email.Encoding} +} + +func encodeHeader(text string, charset string, usedChars int) string { + // create buffer + buf := new(bytes.Buffer) + + // encode + encoder := newEncoder(buf, charset, usedChars) + encoder.encode([]byte(text)) + + return buf.String() + + /* + switch encoding { + case EncodingBase64: + return mime.BEncoding.Encode(charset, text) + default: + return mime.QEncoding.Encode(charset, text) + } + */ +} + +// getHeaders returns the message headers +func (msg *message) getHeaders() (headers string) { + // if the date header isn't set, set it + if date := msg.headers.Get("Date"); date == "" { + msg.headers.Set("Date", time.Now().Format(time.RFC1123Z)) + } + + // encode and combine the headers + for header, values := range msg.headers { + headers += header + ": " + encodeHeader(strings.Join(values, ", "), msg.charset, len(header)+2) + "\r\n" + } + + headers = headers + "\r\n" + + return +} + +// getCID gets the generated CID for the provided text +func (msg *message) getCID(text string) (cid string) { + // set the date format to use + const dateFormat = "20060102.150405" + + // get the cid if we have one + cid, exists := msg.cids[text] + if !exists { + // generate a new cid + cid = time.Now().Format(dateFormat) + "." + strconv.Itoa(len(msg.cids)+1) + "@mail.0" + // save it + msg.cids[text] = cid + } + + return +} + +// replaceCIDs replaces the CIDs found in a text string +// with generated ones +func (msg *message) replaceCIDs(text string) string { + // regular expression to find cids + re := regexp.MustCompile(`(src|href)="cid:(.*?)"`) + // replace all of the found cids with generated ones + for _, matches := range re.FindAllStringSubmatch(text, -1) { + cid := msg.getCID(matches[2]) + text = strings.Replace(text, "cid:"+matches[2], "cid:"+cid, -1) + } + + return text +} + +// openMultipart creates a new part of a multipart message +func (msg *message) openMultipart(multipartType string) { + // create a new multipart writer + msg.writers = append(msg.writers, multipart.NewWriter(msg.body)) + // create the boundary + contentType := "multipart/" + multipartType + ";\n \tboundary=" + msg.writers[msg.parts].Boundary() + + // if no existing parts, add header to main header group + if msg.parts == 0 { + msg.headers.Set("Content-Type", contentType) + } else { // add header to multipart section + header := make(textproto.MIMEHeader) + header.Set("Content-Type", contentType) + msg.writers[msg.parts-1].CreatePart(header) + } + + msg.parts++ +} + +// closeMultipart closes a part of a multipart message +func (msg *message) closeMultipart() { + if msg.parts > 0 { + msg.writers[msg.parts-1].Close() + msg.parts-- + } +} + +// base64Encode base64 encodes the provided text with line wrapping +func base64Encode(text []byte) []byte { + // create buffer + buf := new(bytes.Buffer) + + // create base64 encoder that linewraps + encoder := base64.NewEncoder(base64.StdEncoding, &base64LineWrap{writer: buf}) + + // write the encoded text to buf + encoder.Write(text) + encoder.Close() + + return buf.Bytes() +} + +// qpEncode uses the quoted-printable encoding to encode the provided text +func qpEncode(text []byte) []byte { + // create buffer + buf := new(bytes.Buffer) + + encoder := quotedprintable.NewWriter(buf) + + encoder.Write(text) + encoder.Close() + + return buf.Bytes() +} + +const maxLineChars = 76 + +type base64LineWrap struct { + writer io.Writer + numLineChars int +} + +func (e *base64LineWrap) Write(p []byte) (n int, err error) { + n = 0 + // while we have more chars than are allowed + for len(p)+e.numLineChars > maxLineChars { + numCharsToWrite := maxLineChars - e.numLineChars + // write the chars we can + e.writer.Write(p[:numCharsToWrite]) + // write a line break + e.writer.Write([]byte("\r\n")) + // reset the line count + e.numLineChars = 0 + // remove the chars that have been written + p = p[numCharsToWrite:] + // set the num of chars written + n += numCharsToWrite + } + + // write what is left + e.writer.Write(p) + e.numLineChars += len(p) + n += len(p) + + return +} + +func (msg *message) write(header textproto.MIMEHeader, body []byte, encoding encoding) { + msg.writeHeader(header) + msg.writeBody(body, encoding) +} + +func (msg *message) writeHeader(headers textproto.MIMEHeader) { + // if there are no parts add header to main headers + if msg.parts == 0 { + for header, value := range headers { + msg.headers[header] = value + } + } else { // add header to multipart section + msg.writers[msg.parts-1].CreatePart(headers) + } +} + +func (msg *message) writeBody(body []byte, encoding encoding) { + // encode and write the body + switch encoding { + case EncodingQuotedPrintable: + msg.body.Write(qpEncode(body)) + case EncodingBase64: + msg.body.Write(base64Encode(body)) + default: + msg.body.Write(body) + } +} + +func (msg *message) addBody(contentType string, body []byte) { + body = []byte(msg.replaceCIDs(string(body))) + + header := make(textproto.MIMEHeader) + header.Set("Content-Type", contentType+"; charset="+msg.charset) + header.Set("Content-Transfer-Encoding", msg.encoding.string()) + msg.write(header, body, msg.encoding) +} + +var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"") + +func escapeQuotes(s string) string { + return quoteEscaper.Replace(s) +} + +func (msg *message) addFiles(files []*File, inline bool) { + encoding := EncodingBase64 + for _, file := range files { + header := make(textproto.MIMEHeader) + header.Set("Content-Type", file.MimeType+";\n \tname=\""+encodeHeader(escapeQuotes(file.Name), msg.charset, 6)+`"`) + header.Set("Content-Transfer-Encoding", encoding.string()) + if inline { + header.Set("Content-Disposition", "inline;\n \tfilename=\""+encodeHeader(escapeQuotes(file.Name), msg.charset, 10)+`"`) + header.Set("Content-ID", "<"+msg.getCID(file.Name)+">") + } else { + header.Set("Content-Disposition", "attachment;\n \tfilename=\""+encodeHeader(escapeQuotes(file.Name), msg.charset, 10)+`"`) + } + + msg.write(header, file.Data, encoding) + } +} diff --git a/vendor/github.com/xhit/go-simple-mail/v2/smtp.go b/vendor/github.com/xhit/go-simple-mail/v2/smtp.go new file mode 100644 index 00000000..b2187f3f --- /dev/null +++ b/vendor/github.com/xhit/go-simple-mail/v2/smtp.go @@ -0,0 +1,332 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in https://raw.githubusercontent.com/golang/go/master/LICENSE + +// Package mail implements the Simple Mail Transfer Protocol as defined in RFC 5321. +// It also implements the following extensions: +// 8BITMIME RFC 1652 +// SMTPUTF8 RFC 6531 +// AUTH RFC 2554 +// STARTTLS RFC 3207 +// SIZE RFC 1870 +// Additional extensions may be handled by clients using smtp.go in golang source code or pull request Go Simple Mail + +// smtp.go file is a modification of smtp golang package what is frozen and is not accepting new features. + +package mail + +import ( + "crypto/tls" + "encoding/base64" + "errors" + "fmt" + "io" + "net" + "net/textproto" + "strings" +) + +// A Client represents a client connection to an SMTP server. +type smtpClient struct { + // Text is the textproto.Conn used by the Client. + text *textproto.Conn + // keep a reference to the connection so it can be used to create a TLS + // connection later + conn net.Conn + // whether the Client is using TLS + tls bool + serverName string + // map of supported extensions + ext map[string]string + // supported auth mechanisms + a []string + localName string // the name to use in HELO/EHLO + didHello bool // whether we've said HELO/EHLO + helloError error // the error from the hello +} + +// newClient returns a new smtpClient using an existing connection and host as a +// server name to be used when authenticating. +func newClient(conn net.Conn, host string) (*smtpClient, error) { + text := textproto.NewConn(conn) + _, _, err := text.ReadResponse(220) + if err != nil { + text.Close() + return nil, err + } + c := &smtpClient{text: text, conn: conn, serverName: host, localName: "localhost"} + _, c.tls = conn.(*tls.Conn) + return c, nil +} + +// Close closes the connection. +func (c *smtpClient) close() error { + return c.text.Close() +} + +// hello runs a hello exchange if needed. +func (c *smtpClient) hello() error { + if !c.didHello { + c.didHello = true + err := c.ehlo() + if err != nil { + c.helloError = c.helo() + } + } + return c.helloError +} + +// hi sends a HELO or EHLO to the server as the given host name. +// Calling this method is only necessary if the client needs control +// over the host name used. The client will introduce itself as "localhost" +// automatically otherwise. If Hello is called, it must be called before +// any of the other methods. +func (c *smtpClient) hi(localName string) error { + if err := validateLine(localName); err != nil { + return err + } + if c.didHello { + return errors.New("smtp: Hello called after other methods") + } + c.localName = localName + return c.hello() +} + +// cmd is a convenience function that sends a command and returns the response +func (c *smtpClient) cmd(expectCode int, format string, args ...interface{}) (int, string, error) { + id, err := c.text.Cmd(format, args...) + if err != nil { + return 0, "", err + } + c.text.StartResponse(id) + defer c.text.EndResponse(id) + code, msg, err := c.text.ReadResponse(expectCode) + return code, msg, err +} + +// helo sends the HELO greeting to the server. It should be used only when the +// server does not support ehlo. +func (c *smtpClient) helo() error { + c.ext = nil + _, _, err := c.cmd(250, "HELO %s", c.localName) + return err +} + +// ehlo sends the EHLO (extended hello) greeting to the server. It +// should be the preferred greeting for servers that support it. +func (c *smtpClient) ehlo() error { + _, msg, err := c.cmd(250, "EHLO %s", c.localName) + if err != nil { + return err + } + ext := make(map[string]string) + extList := strings.Split(msg, "\n") + if len(extList) > 1 { + extList = extList[1:] + for _, line := range extList { + args := strings.SplitN(line, " ", 2) + if len(args) > 1 { + ext[args[0]] = args[1] + } else { + ext[args[0]] = "" + } + } + } + if mechs, ok := ext["AUTH"]; ok { + c.a = strings.Split(mechs, " ") + } + c.ext = ext + return err +} + +// startTLS sends the STARTTLS command and encrypts all further communication. +// Only servers that advertise the STARTTLS extension support this function. +func (c *smtpClient) startTLS(config *tls.Config) error { + if err := c.hello(); err != nil { + return err + } + _, _, err := c.cmd(220, "STARTTLS") + if err != nil { + return err + } + c.conn = tls.Client(c.conn, config) + c.text = textproto.NewConn(c.conn) + c.tls = true + return c.ehlo() +} + +// authenticate authenticates a client using the provided authentication mechanism. +// A failed authentication closes the connection. +// Only servers that advertise the AUTH extension support this function. +func (c *smtpClient) authenticate(a auth) error { + if err := c.hello(); err != nil { + return err + } + encoding := base64.StdEncoding + mech, resp, err := a.start(&serverInfo{c.serverName, c.tls, c.a}) + if err != nil { + c.quit() + return err + } + resp64 := make([]byte, encoding.EncodedLen(len(resp))) + encoding.Encode(resp64, resp) + code, msg64, err := c.cmd(0, strings.TrimSpace(fmt.Sprintf("AUTH %s %s", mech, resp64))) + for err == nil { + var msg []byte + switch code { + case 334: + msg, err = encoding.DecodeString(msg64) + case 235: + // the last message isn't base64 because it isn't a challenge + msg = []byte(msg64) + default: + err = &textproto.Error{Code: code, Msg: msg64} + } + if err == nil { + resp, err = a.next(msg, code == 334) + } + if err != nil { + // abort the AUTH + c.cmd(501, "*") + c.quit() + break + } + if resp == nil { + break + } + resp64 = make([]byte, encoding.EncodedLen(len(resp))) + encoding.Encode(resp64, resp) + code, msg64, err = c.cmd(0, string(resp64)) + } + return err +} + +// mail issues a MAIL command to the server using the provided email address. +// If the server supports the 8BITMIME extension, Mail adds the BODY=8BITMIME +// parameter. +// If the server supports the SMTPUTF8 extension, Mail adds the +// SMTPUTF8 parameter. +// This initiates a mail transaction and is followed by one or more Rcpt calls. +func (c *smtpClient) mail(from string, extArgs ...map[string]string) error { + var args []interface{} + var extMap map[string]string + + if len(extArgs) > 0 { + extMap = extArgs[0] + } + + if err := validateLine(from); err != nil { + return err + } + if err := c.hello(); err != nil { + return err + } + cmdStr := "MAIL FROM:<%s>" + if c.ext != nil { + if _, ok := c.ext["8BITMIME"]; ok { + cmdStr += " BODY=8BITMIME" + } + if _, ok := c.ext["SMTPUTF8"]; ok { + cmdStr += " SMTPUTF8" + } + if _, ok := c.ext["SIZE"]; ok { + if extMap["SIZE"] != "" { + cmdStr += " SIZE=%s" + args = append(args, extMap["SIZE"]) + } + } + } + args = append([]interface{}{from}, args...) + _, _, err := c.cmd(250, cmdStr, args...) + return err +} + +// rcpt issues a RCPT command to the server using the provided email address. +// A call to Rcpt must be preceded by a call to Mail and may be followed by +// a Data call or another Rcpt call. +func (c *smtpClient) rcpt(to string) error { + if err := validateLine(to); err != nil { + return err + } + _, _, err := c.cmd(25, "RCPT TO:<%s>", to) + return err +} + +type dataCloser struct { + c *smtpClient + io.WriteCloser +} + +func (d *dataCloser) Close() error { + d.WriteCloser.Close() + _, _, err := d.c.text.ReadResponse(250) + return err +} + +// data issues a DATA command to the server and returns a writer that +// can be used to write the mail headers and body. The caller should +// close the writer before calling any more methods on c. A call to +// Data must be preceded by one or more calls to Rcpt. +func (c *smtpClient) data() (io.WriteCloser, error) { + _, _, err := c.cmd(354, "DATA") + if err != nil { + return nil, err + } + return &dataCloser{c, c.text.DotWriter()}, nil +} + +// extension reports whether an extension is support by the server. +// The extension name is case-insensitive. If the extension is supported, +// extension also returns a string that contains any parameters the +// server specifies for the extension. +func (c *smtpClient) extension(ext string) (bool, string) { + if err := c.hello(); err != nil { + return false, "" + } + if c.ext == nil { + return false, "" + } + ext = strings.ToUpper(ext) + param, ok := c.ext[ext] + return ok, param +} + +// reset sends the RSET command to the server, aborting the current mail +// transaction. +func (c *smtpClient) reset() error { + if err := c.hello(); err != nil { + return err + } + _, _, err := c.cmd(250, "RSET") + return err +} + +// noop sends the NOOP command to the server. It does nothing but check +// that the connection to the server is okay. +func (c *smtpClient) noop() error { + if err := c.hello(); err != nil { + return err + } + _, _, err := c.cmd(250, "NOOP") + return err +} + +// quit sends the QUIT command and closes the connection to the server. +func (c *smtpClient) quit() error { + if err := c.hello(); err != nil { + return err + } + _, _, err := c.cmd(221, "QUIT") + if err != nil { + return err + } + return c.text.Close() +} + +// validateLine checks to see if a line has CR or LF as per RFC 5321 +func validateLine(line string) error { + if strings.ContainsAny(line, "\n\r") { + return errors.New("smtp: A line must not contain CR or LF") + } + return nil +} diff --git a/vendor/go.mau.fi/whatsmeow/README.md b/vendor/go.mau.fi/whatsmeow/README.md index 123239b5..b0d36ffb 100644 --- a/vendor/go.mau.fi/whatsmeow/README.md +++ b/vendor/go.mau.fi/whatsmeow/README.md @@ -27,12 +27,11 @@ Most core features are already present: * Joining via invite messages, using and creating invite links * Sending and receiving typing notifications * Sending and receiving delivery and read receipts -* Reading app state (contact list, chat pin/mute status, etc) +* Reading and writing app state (contact list, chat pin/mute status, etc) * Sending and handling retry receipts if message decryption fails * Sending status messages (experimental, may not work for large contact lists) Things that are not yet implemented: -* Writing app state (contact list, chat pin/mute status, etc) * Sending broadcast list messages (this is not supported on WhatsApp web either) * Calls diff --git a/vendor/go.mau.fi/whatsmeow/appstate.go b/vendor/go.mau.fi/whatsmeow/appstate.go index 7493a030..3c128db6 100644 --- a/vendor/go.mau.fi/whatsmeow/appstate.go +++ b/vendor/go.mau.fi/whatsmeow/appstate.go @@ -74,7 +74,7 @@ func (cli *Client) FetchAppState(name appstate.WAPatchName, fullSync, onlyIfNotS } } for _, mutation := range mutations { - cli.dispatchAppState(mutation, !fullSync || cli.EmitAppStateEventsOnFullSync) + cli.dispatchAppState(mutation, fullSync, cli.EmitAppStateEventsOnFullSync) } } if fullSync { @@ -105,7 +105,10 @@ func (cli *Client) filterContacts(mutations []appstate.Mutation) ([]appstate.Mut return filteredMutations, contacts } -func (cli *Client) dispatchAppState(mutation appstate.Mutation, dispatchEvts bool) { +func (cli *Client) dispatchAppState(mutation appstate.Mutation, fullSync bool, emitOnFullSync bool) { + + dispatchEvts := !fullSync || emitOnFullSync + if mutation.Operation != waProto.SyncdMutation_SET { return } @@ -118,87 +121,108 @@ func (cli *Client) dispatchAppState(mutation appstate.Mutation, dispatchEvts boo if len(mutation.Index) > 1 { jid, _ = types.ParseJID(mutation.Index[1]) } - ts := time.Unix(mutation.Action.GetTimestamp(), 0) + ts := time.UnixMilli(mutation.Action.GetTimestamp()) var storeUpdateError error var eventToDispatch interface{} switch mutation.Index[0] { - case "mute": + case appstate.IndexMute: act := mutation.Action.GetMuteAction() - eventToDispatch = &events.Mute{JID: jid, Timestamp: ts, Action: act} + eventToDispatch = &events.Mute{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync} var mutedUntil time.Time if act.GetMuted() { - mutedUntil = time.Unix(act.GetMuteEndTimestamp(), 0) + mutedUntil = time.UnixMilli(act.GetMuteEndTimestamp()) } if cli.Store.ChatSettings != nil { storeUpdateError = cli.Store.ChatSettings.PutMutedUntil(jid, mutedUntil) } - case "pin_v1": + case appstate.IndexPin: act := mutation.Action.GetPinAction() - eventToDispatch = &events.Pin{JID: jid, Timestamp: ts, Action: act} + eventToDispatch = &events.Pin{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync} if cli.Store.ChatSettings != nil { storeUpdateError = cli.Store.ChatSettings.PutPinned(jid, act.GetPinned()) } - case "archive": + case appstate.IndexArchive: act := mutation.Action.GetArchiveChatAction() - eventToDispatch = &events.Archive{JID: jid, Timestamp: ts, Action: act} + eventToDispatch = &events.Archive{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync} if cli.Store.ChatSettings != nil { storeUpdateError = cli.Store.ChatSettings.PutArchived(jid, act.GetArchived()) } - case "contact": + case appstate.IndexContact: act := mutation.Action.GetContactAction() - eventToDispatch = &events.Contact{JID: jid, Timestamp: ts, Action: act} + eventToDispatch = &events.Contact{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync} if cli.Store.Contacts != nil { storeUpdateError = cli.Store.Contacts.PutContactName(jid, act.GetFirstName(), act.GetFullName()) } - case "deleteChat": + case appstate.IndexClearChat: + act := mutation.Action.GetClearChatAction() + eventToDispatch = &events.ClearChat{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync} + case appstate.IndexDeleteChat: act := mutation.Action.GetDeleteChatAction() - eventToDispatch = &events.DeleteChat{JID: jid, Timestamp: ts, Action: act} - case "star": + eventToDispatch = &events.DeleteChat{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync} + case appstate.IndexStar: if len(mutation.Index) < 5 { return } evt := events.Star{ - ChatJID: jid, - MessageID: mutation.Index[2], - Timestamp: ts, - Action: mutation.Action.GetStarAction(), - IsFromMe: mutation.Index[3] == "1", + ChatJID: jid, + MessageID: mutation.Index[2], + Timestamp: ts, + Action: mutation.Action.GetStarAction(), + IsFromMe: mutation.Index[3] == "1", + FromFullSync: fullSync, } if mutation.Index[4] != "0" { evt.SenderJID, _ = types.ParseJID(mutation.Index[4]) } eventToDispatch = &evt - case "deleteMessageForMe": + case appstate.IndexDeleteMessageForMe: if len(mutation.Index) < 5 { return } evt := events.DeleteForMe{ - ChatJID: jid, - MessageID: mutation.Index[2], - Timestamp: ts, - Action: mutation.Action.GetDeleteMessageForMeAction(), - IsFromMe: mutation.Index[3] == "1", + ChatJID: jid, + MessageID: mutation.Index[2], + Timestamp: ts, + Action: mutation.Action.GetDeleteMessageForMeAction(), + IsFromMe: mutation.Index[3] == "1", + FromFullSync: fullSync, } if mutation.Index[4] != "0" { evt.SenderJID, _ = types.ParseJID(mutation.Index[4]) } eventToDispatch = &evt - case "markChatAsRead": + case appstate.IndexMarkChatAsRead: eventToDispatch = &events.MarkChatAsRead{ - JID: jid, - Timestamp: ts, - Action: mutation.Action.GetMarkChatAsReadAction(), + JID: jid, + Timestamp: ts, + Action: mutation.Action.GetMarkChatAsReadAction(), + FromFullSync: fullSync, + } + case appstate.IndexSettingPushName: + eventToDispatch = &events.PushNameSetting{ + Timestamp: ts, + Action: mutation.Action.GetPushNameSetting(), + FromFullSync: fullSync, } - case "setting_pushName": - eventToDispatch = &events.PushNameSetting{Timestamp: ts, Action: mutation.Action.GetPushNameSetting()} cli.Store.PushName = mutation.Action.GetPushNameSetting().GetName() err := cli.Store.Save() if err != nil { cli.Log.Errorf("Failed to save device store after updating push name: %v", err) } - case "setting_unarchiveChats": - eventToDispatch = &events.UnarchiveChatsSetting{Timestamp: ts, Action: mutation.Action.GetUnarchiveChatsSetting()} + case appstate.IndexSettingUnarchiveChats: + eventToDispatch = &events.UnarchiveChatsSetting{ + Timestamp: ts, + Action: mutation.Action.GetUnarchiveChatsSetting(), + FromFullSync: fullSync, + } + case appstate.IndexUserStatusMute: + eventToDispatch = &events.UserStatusMute{ + JID: jid, + Timestamp: ts, + Action: mutation.Action.GetUserStatusMuteAction(), + FromFullSync: fullSync, + } } if storeUpdateError != nil { cli.Log.Errorf("Failed to update device store after app state mutation: %v", storeUpdateError) @@ -280,3 +304,63 @@ func (cli *Client) requestAppStateKeys(ctx context.Context, rawKeyIDs [][]byte) cli.Log.Warnf("Failed to send app state key request: %v", err) } } + +// SendAppState sends the given app state patch, then resyncs that app state type from the server +// to update local caches and send events for the updates. +// +// You can use the Build methods in the appstate package to build the parameter for this method, e.g. +// +// cli.SendAppState(appstate.BuildMute(targetJID, true, 24 * time.Hour)) +func (cli *Client) SendAppState(patch appstate.PatchInfo) error { + version, hash, err := cli.Store.AppState.GetAppStateVersion(string(patch.Type)) + if err != nil { + return err + } + // TODO create new key instead of reusing the primary client's keys + latestKeyID, err := cli.Store.AppStateKeys.GetLatestAppStateSyncKeyID() + if err != nil { + return fmt.Errorf("failed to get latest app state key ID: %w", err) + } else if latestKeyID == nil { + return fmt.Errorf("no app state keys found, creating app state keys is not yet supported") + } + + state := appstate.HashState{Version: version, Hash: hash} + + encodedPatch, err := cli.appStateProc.EncodePatch(latestKeyID, state, patch) + if err != nil { + return err + } + + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:sync:app:state", + Type: iqSet, + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "sync", + Content: []waBinary.Node{{ + Tag: "collection", + Attrs: waBinary.Attrs{ + "name": string(patch.Type), + "version": version, + "return_snapshot": false, + }, + Content: []waBinary.Node{{ + Tag: "patch", + Content: encodedPatch, + }}, + }}, + }}, + }) + if err != nil { + return err + } + + respCollection := resp.GetChildByTag("sync", "collection") + respCollectionAttr := respCollection.AttrGetter() + if respCollectionAttr.OptionalString("type") == "error" { + // TODO parse error properly + return fmt.Errorf("%w: %s", ErrAppStateUpdate, respCollection.XMLString()) + } + + return cli.FetchAppState(patch.Type, false, false) +} diff --git a/vendor/go.mau.fi/whatsmeow/appstate/decode.go b/vendor/go.mau.fi/whatsmeow/appstate/decode.go index 5c895470..980c20de 100644 --- a/vendor/go.mau.fi/whatsmeow/appstate/decode.go +++ b/vendor/go.mau.fi/whatsmeow/appstate/decode.go @@ -290,7 +290,7 @@ func (proc *Processor) DecodePatches(list *PatchList, initialState HashState, va if err != nil { return } - patchMAC := generatePatchMAC(patch, list.Name, keys.PatchMAC) + patchMAC := generatePatchMAC(patch, list.Name, keys.PatchMAC, patch.GetVersion().GetVersion()) if !bytes.Equal(patchMAC, patch.GetPatchMac()) { err = fmt.Errorf("failed to verify patch v%d: %w", version, ErrMismatchingPatchMAC) return diff --git a/vendor/go.mau.fi/whatsmeow/appstate/encode.go b/vendor/go.mau.fi/whatsmeow/appstate/encode.go new file mode 100644 index 00000000..1cb7d659 --- /dev/null +++ b/vendor/go.mau.fi/whatsmeow/appstate/encode.go @@ -0,0 +1,200 @@ +package appstate + +import ( + "crypto/sha256" + "encoding/json" + "fmt" + "time" + + "google.golang.org/protobuf/proto" + + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/util/cbcutil" +) + +// MutationInfo contains information about a single mutation to the app state. +type MutationInfo struct { + // Index contains the thing being mutated (like `mute` or `pin_v1`), followed by parameters like the target JID. + Index []string + // Version is a static number that depends on the thing being mutated. + Version int32 + // Value contains the data for the mutation. + Value *waProto.SyncActionValue +} + +// PatchInfo contains information about a patch to the app state. +// A patch can contain multiple mutations, as long as all mutations are in the same app state type. +type PatchInfo struct { + // Timestamp is the time when the patch was created. This will be filled automatically in EncodePatch if it's zero. + Timestamp time.Time + // Type is the app state type being mutated. + Type WAPatchName + // Mutations contains the individual mutations to apply to the app state in this patch. + Mutations []MutationInfo +} + +// BuildMute builds an app state patch for muting or unmuting a chat. +// +// If mute is true and the mute duration is zero, the chat is muted forever. +func BuildMute(target types.JID, mute bool, muteDuration time.Duration) PatchInfo { + var muteEndTimestamp *int64 + if muteDuration > 0 { + muteEndTimestamp = proto.Int64(time.Now().Add(muteDuration).UnixMilli()) + } + + return PatchInfo{ + Type: WAPatchRegularHigh, + Mutations: []MutationInfo{{ + Index: []string{IndexMute, target.String()}, + Version: 2, + Value: &waProto.SyncActionValue{ + MuteAction: &waProto.MuteAction{ + Muted: proto.Bool(mute), + MuteEndTimestamp: muteEndTimestamp, + }, + }, + }}, + } +} + +func newPinMutationInfo(target types.JID, pin bool) MutationInfo { + return MutationInfo{ + Index: []string{IndexPin, target.String()}, + Version: 5, + Value: &waProto.SyncActionValue{ + PinAction: &waProto.PinAction{ + Pinned: &pin, + }, + }, + } +} + +// BuildPin builds an app state patch for pinning or unpinning a chat. +func BuildPin(target types.JID, pin bool) PatchInfo { + return PatchInfo{ + Type: WAPatchRegularLow, + Mutations: []MutationInfo{ + newPinMutationInfo(target, pin), + }, + } +} + +// BuildArchive builds an app state patch for archiving or unarchiving a chat. +// +// The last message timestamp and last message key are optional and can be set to zero values (`time.Time{}` and `nil`). +// +// Archiving a chat will also unpin it automatically. +func BuildArchive(target types.JID, archive bool, lastMessageTimestamp time.Time, lastMessageKey *waProto.MessageKey) PatchInfo { + if lastMessageTimestamp.IsZero() { + lastMessageTimestamp = time.Now() + } + archiveMutationInfo := MutationInfo{ + Index: []string{IndexArchive, target.String()}, + Version: 3, + Value: &waProto.SyncActionValue{ + ArchiveChatAction: &waProto.ArchiveChatAction{ + Archived: &archive, + MessageRange: &waProto.SyncActionMessageRange{ + LastMessageTimestamp: proto.Int64(lastMessageTimestamp.Unix()), + // TODO set LastSystemMessageTimestamp? + }, + }, + }, + } + + if lastMessageKey != nil { + archiveMutationInfo.Value.ArchiveChatAction.MessageRange.Messages = []*waProto.SyncActionMessage{{ + Key: lastMessageKey, + Timestamp: proto.Int64(lastMessageTimestamp.Unix()), + }} + } + + mutations := []MutationInfo{archiveMutationInfo} + if archive { + mutations = append(mutations, newPinMutationInfo(target, false)) + } + + result := PatchInfo{ + Type: WAPatchRegularLow, + Mutations: mutations, + } + + return result +} + +func (proc *Processor) EncodePatch(keyID []byte, state HashState, patchInfo PatchInfo) ([]byte, error) { + keys, err := proc.getAppStateKey(keyID) + if err != nil { + return nil, fmt.Errorf("failed to get app state key details with key ID %x: %w", keyID, err) + } + + if patchInfo.Timestamp.IsZero() { + patchInfo.Timestamp = time.Now() + } + + mutations := make([]*waProto.SyncdMutation, 0, len(patchInfo.Mutations)) + for _, mutationInfo := range patchInfo.Mutations { + mutationInfo.Value.Timestamp = proto.Int64(patchInfo.Timestamp.UnixMilli()) + + indexBytes, err := json.Marshal(mutationInfo.Index) + if err != nil { + return nil, fmt.Errorf("failed to marshal mutation index: %w", err) + } + + pbObj := &waProto.SyncActionData{ + Index: indexBytes, + Value: mutationInfo.Value, + Padding: []byte{}, + Version: &mutationInfo.Version, + } + + content, err := proto.Marshal(pbObj) + if err != nil { + return nil, fmt.Errorf("failed to marshal mutation: %w", err) + } + + encryptedContent, err := cbcutil.Encrypt(keys.ValueEncryption, nil, content) + if err != nil { + return nil, fmt.Errorf("failed to encrypt mutation: %w", err) + } + + valueMac := generateContentMAC(waProto.SyncdMutation_SET, encryptedContent, keyID, keys.ValueMAC) + indexMac := concatAndHMAC(sha256.New, keys.Index, indexBytes) + + mutations = append(mutations, &waProto.SyncdMutation{ + Operation: waProto.SyncdMutation_SET.Enum(), + Record: &waProto.SyncdRecord{ + Index: &waProto.SyncdIndex{Blob: indexMac}, + Value: &waProto.SyncdValue{Blob: append(encryptedContent, valueMac...)}, + KeyId: &waProto.KeyId{Id: keyID}, + }, + }) + } + + warn, err := state.updateHash(mutations, func(indexMAC []byte, _ int) ([]byte, error) { + return proc.Store.AppState.GetAppStateMutationMAC(string(patchInfo.Type), indexMAC) + }) + if len(warn) > 0 { + proc.Log.Warnf("Warnings while updating hash for %s (sending new app state): %+v", patchInfo.Type, warn) + } + if err != nil { + return nil, fmt.Errorf("failed to update state hash: %w", err) + } + + state.Version += 1 + + syncdPatch := &waProto.SyncdPatch{ + SnapshotMac: state.generateSnapshotMAC(patchInfo.Type, keys.SnapshotMAC), + KeyId: &waProto.KeyId{Id: keyID}, + Mutations: mutations, + } + syncdPatch.PatchMac = generatePatchMAC(syncdPatch, patchInfo.Type, keys.PatchMAC, state.Version) + + result, err := proto.Marshal(syncdPatch) + if err != nil { + return nil, fmt.Errorf("failed to marshal compiled patch: %w", err) + } + + return result, nil +} diff --git a/vendor/go.mau.fi/whatsmeow/appstate/hash.go b/vendor/go.mau.fi/whatsmeow/appstate/hash.go index bb17eeac..2bb0924a 100644 --- a/vendor/go.mau.fi/whatsmeow/appstate/hash.go +++ b/vendor/go.mau.fi/whatsmeow/appstate/hash.go @@ -77,14 +77,14 @@ func (hs *HashState) generateSnapshotMAC(name WAPatchName, key []byte) []byte { return concatAndHMAC(sha256.New, key, hs.Hash[:], uint64ToBytes(hs.Version), []byte(name)) } -func generatePatchMAC(patch *waProto.SyncdPatch, name WAPatchName, key []byte) []byte { +func generatePatchMAC(patch *waProto.SyncdPatch, name WAPatchName, key []byte, version uint64) []byte { dataToHash := make([][]byte, len(patch.GetMutations())+3) dataToHash[0] = patch.GetSnapshotMac() for i, mutation := range patch.Mutations { val := mutation.GetRecord().GetValue().GetBlob() dataToHash[i+1] = val[len(val)-32:] } - dataToHash[len(dataToHash)-2] = uint64ToBytes(patch.GetVersion().GetVersion()) + dataToHash[len(dataToHash)-2] = uint64ToBytes(version) dataToHash[len(dataToHash)-1] = []byte(name) return concatAndHMAC(sha256.New, key, dataToHash...) } diff --git a/vendor/go.mau.fi/whatsmeow/appstate/keys.go b/vendor/go.mau.fi/whatsmeow/appstate/keys.go index ec19dc26..95f7d134 100644 --- a/vendor/go.mau.fi/whatsmeow/appstate/keys.go +++ b/vendor/go.mau.fi/whatsmeow/appstate/keys.go @@ -35,6 +35,22 @@ const ( // AllPatchNames contains all currently known patch state names. var AllPatchNames = [...]WAPatchName{WAPatchCriticalBlock, WAPatchCriticalUnblockLow, WAPatchRegularHigh, WAPatchRegular, WAPatchRegularLow} +// Constants for the first part of app state indexes. +const ( + IndexMute = "mute" + IndexPin = "pin_v1" + IndexArchive = "archive" + IndexContact = "contact" + IndexClearChat = "clearChat" + IndexDeleteChat = "deleteChat" + IndexStar = "star" + IndexDeleteMessageForMe = "deleteMessageForMe" + IndexMarkChatAsRead = "markChatAsRead" + IndexSettingPushName = "setting_pushName" + IndexSettingUnarchiveChats = "setting_unarchiveChats" + IndexUserStatusMute = "userStatusMute" +) + type Processor struct { keyCache map[string]ExpandedAppStateKeys keyCacheLock sync.Mutex diff --git a/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go b/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go index 4ab7a2e4..f2a30515 100644 --- a/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go +++ b/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.12 // source: binary/proto/def.proto @@ -87,6 +87,8 @@ const ( PeerDataOperationRequestType_UPLOAD_STICKER PeerDataOperationRequestType = 0 PeerDataOperationRequestType_SEND_RECENT_STICKER_BOOTSTRAP PeerDataOperationRequestType = 1 PeerDataOperationRequestType_GENERATE_LINK_PREVIEW PeerDataOperationRequestType = 2 + PeerDataOperationRequestType_HISTORY_SYNC_ON_DEMAND PeerDataOperationRequestType = 3 + PeerDataOperationRequestType_PLACEHOLDER_MESSAGE_RESEND PeerDataOperationRequestType = 4 ) // Enum value maps for PeerDataOperationRequestType. @@ -95,11 +97,15 @@ var ( 0: "UPLOAD_STICKER", 1: "SEND_RECENT_STICKER_BOOTSTRAP", 2: "GENERATE_LINK_PREVIEW", + 3: "HISTORY_SYNC_ON_DEMAND", + 4: "PLACEHOLDER_MESSAGE_RESEND", } PeerDataOperationRequestType_value = map[string]int32{ "UPLOAD_STICKER": 0, "SEND_RECENT_STICKER_BOOTSTRAP": 1, "GENERATE_LINK_PREVIEW": 2, + "HISTORY_SYNC_ON_DEMAND": 3, + "PLACEHOLDER_MESSAGE_RESEND": 4, } ) @@ -202,20 +208,24 @@ func (MediaVisibility) EnumDescriptor() ([]byte, []int) { type DeviceProps_PlatformType int32 const ( - DeviceProps_UNKNOWN DeviceProps_PlatformType = 0 - DeviceProps_CHROME DeviceProps_PlatformType = 1 - DeviceProps_FIREFOX DeviceProps_PlatformType = 2 - DeviceProps_IE DeviceProps_PlatformType = 3 - DeviceProps_OPERA DeviceProps_PlatformType = 4 - DeviceProps_SAFARI DeviceProps_PlatformType = 5 - DeviceProps_EDGE DeviceProps_PlatformType = 6 - DeviceProps_DESKTOP DeviceProps_PlatformType = 7 - DeviceProps_IPAD DeviceProps_PlatformType = 8 - DeviceProps_ANDROID_TABLET DeviceProps_PlatformType = 9 - DeviceProps_OHANA DeviceProps_PlatformType = 10 - DeviceProps_ALOHA DeviceProps_PlatformType = 11 - DeviceProps_CATALINA DeviceProps_PlatformType = 12 - DeviceProps_TCL_TV DeviceProps_PlatformType = 13 + DeviceProps_UNKNOWN DeviceProps_PlatformType = 0 + DeviceProps_CHROME DeviceProps_PlatformType = 1 + DeviceProps_FIREFOX DeviceProps_PlatformType = 2 + DeviceProps_IE DeviceProps_PlatformType = 3 + DeviceProps_OPERA DeviceProps_PlatformType = 4 + DeviceProps_SAFARI DeviceProps_PlatformType = 5 + DeviceProps_EDGE DeviceProps_PlatformType = 6 + DeviceProps_DESKTOP DeviceProps_PlatformType = 7 + DeviceProps_IPAD DeviceProps_PlatformType = 8 + DeviceProps_ANDROID_TABLET DeviceProps_PlatformType = 9 + DeviceProps_OHANA DeviceProps_PlatformType = 10 + DeviceProps_ALOHA DeviceProps_PlatformType = 11 + DeviceProps_CATALINA DeviceProps_PlatformType = 12 + DeviceProps_TCL_TV DeviceProps_PlatformType = 13 + DeviceProps_IOS_PHONE DeviceProps_PlatformType = 14 + DeviceProps_IOS_CATALYST DeviceProps_PlatformType = 15 + DeviceProps_ANDROID_PHONE DeviceProps_PlatformType = 16 + DeviceProps_ANDROID_AMBIGUOUS DeviceProps_PlatformType = 17 ) // Enum value maps for DeviceProps_PlatformType. @@ -235,22 +245,30 @@ var ( 11: "ALOHA", 12: "CATALINA", 13: "TCL_TV", + 14: "IOS_PHONE", + 15: "IOS_CATALYST", + 16: "ANDROID_PHONE", + 17: "ANDROID_AMBIGUOUS", } DeviceProps_PlatformType_value = map[string]int32{ - "UNKNOWN": 0, - "CHROME": 1, - "FIREFOX": 2, - "IE": 3, - "OPERA": 4, - "SAFARI": 5, - "EDGE": 6, - "DESKTOP": 7, - "IPAD": 8, - "ANDROID_TABLET": 9, - "OHANA": 10, - "ALOHA": 11, - "CATALINA": 12, - "TCL_TV": 13, + "UNKNOWN": 0, + "CHROME": 1, + "FIREFOX": 2, + "IE": 3, + "OPERA": 4, + "SAFARI": 5, + "EDGE": 6, + "DESKTOP": 7, + "IPAD": 8, + "ANDROID_TABLET": 9, + "OHANA": 10, + "ALOHA": 11, + "CATALINA": 12, + "TCL_TV": 13, + "IOS_PHONE": 14, + "IOS_CATALYST": 15, + "ANDROID_PHONE": 16, + "ANDROID_AMBIGUOUS": 17, } ) @@ -350,7 +368,7 @@ func (x *PaymentInviteMessage_ServiceType) UnmarshalJSON(b []byte) error { // Deprecated: Use PaymentInviteMessage_ServiceType.Descriptor instead. func (PaymentInviteMessage_ServiceType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{7, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{6, 0} } type OrderMessage_OrderSurface int32 @@ -403,7 +421,7 @@ func (x *OrderMessage_OrderSurface) UnmarshalJSON(b []byte) error { // Deprecated: Use OrderMessage_OrderSurface.Descriptor instead. func (OrderMessage_OrderSurface) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{8, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{7, 0} } type OrderMessage_OrderStatus int32 @@ -456,7 +474,7 @@ func (x *OrderMessage_OrderStatus) UnmarshalJSON(b []byte) error { // Deprecated: Use OrderMessage_OrderStatus.Descriptor instead. func (OrderMessage_OrderStatus) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{8, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{7, 1} } type ListResponseMessage_ListType int32 @@ -512,7 +530,7 @@ func (x *ListResponseMessage_ListType) UnmarshalJSON(b []byte) error { // Deprecated: Use ListResponseMessage_ListType.Descriptor instead. func (ListResponseMessage_ListType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{10, 0} } type ListMessage_ListType int32 @@ -571,7 +589,7 @@ func (x *ListMessage_ListType) UnmarshalJSON(b []byte) error { // Deprecated: Use ListMessage_ListType.Descriptor instead. func (ListMessage_ListType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 0} } type InvoiceMessage_AttachmentType int32 @@ -627,7 +645,63 @@ func (x *InvoiceMessage_AttachmentType) UnmarshalJSON(b []byte) error { // Deprecated: Use InvoiceMessage_AttachmentType.Descriptor instead. func (InvoiceMessage_AttachmentType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{14, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 0} +} + +type InteractiveResponseMessage_Body_Format int32 + +const ( + InteractiveResponseMessage_Body_DEFAULT InteractiveResponseMessage_Body_Format = 0 + InteractiveResponseMessage_Body_EXTENSIONS_1 InteractiveResponseMessage_Body_Format = 1 +) + +// Enum value maps for InteractiveResponseMessage_Body_Format. +var ( + InteractiveResponseMessage_Body_Format_name = map[int32]string{ + 0: "DEFAULT", + 1: "EXTENSIONS_1", + } + InteractiveResponseMessage_Body_Format_value = map[string]int32{ + "DEFAULT": 0, + "EXTENSIONS_1": 1, + } +) + +func (x InteractiveResponseMessage_Body_Format) Enum() *InteractiveResponseMessage_Body_Format { + p := new(InteractiveResponseMessage_Body_Format) + *p = x + return p +} + +func (x InteractiveResponseMessage_Body_Format) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (InteractiveResponseMessage_Body_Format) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[10].Descriptor() +} + +func (InteractiveResponseMessage_Body_Format) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[10] +} + +func (x InteractiveResponseMessage_Body_Format) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *InteractiveResponseMessage_Body_Format) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = InteractiveResponseMessage_Body_Format(num) + return nil +} + +// Deprecated: Use InteractiveResponseMessage_Body_Format.Descriptor instead. +func (InteractiveResponseMessage_Body_Format) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{14, 1, 0} } type InteractiveMessage_ShopMessage_Surface int32 @@ -666,11 +740,11 @@ func (x InteractiveMessage_ShopMessage_Surface) String() string { } func (InteractiveMessage_ShopMessage_Surface) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[10].Descriptor() + return file_binary_proto_def_proto_enumTypes[11].Descriptor() } func (InteractiveMessage_ShopMessage_Surface) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[10] + return &file_binary_proto_def_proto_enumTypes[11] } func (x InteractiveMessage_ShopMessage_Surface) Number() protoreflect.EnumNumber { @@ -689,7 +763,7 @@ func (x *InteractiveMessage_ShopMessage_Surface) UnmarshalJSON(b []byte) error { // Deprecated: Use InteractiveMessage_ShopMessage_Surface.Descriptor instead. func (InteractiveMessage_ShopMessage_Surface) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 0, 0} } type HistorySyncNotification_HistorySyncType int32 @@ -701,6 +775,7 @@ const ( HistorySyncNotification_RECENT HistorySyncNotification_HistorySyncType = 3 HistorySyncNotification_PUSH_NAME HistorySyncNotification_HistorySyncType = 4 HistorySyncNotification_NON_BLOCKING_DATA HistorySyncNotification_HistorySyncType = 5 + HistorySyncNotification_ON_DEMAND HistorySyncNotification_HistorySyncType = 6 ) // Enum value maps for HistorySyncNotification_HistorySyncType. @@ -712,6 +787,7 @@ var ( 3: "RECENT", 4: "PUSH_NAME", 5: "NON_BLOCKING_DATA", + 6: "ON_DEMAND", } HistorySyncNotification_HistorySyncType_value = map[string]int32{ "INITIAL_BOOTSTRAP": 0, @@ -720,6 +796,7 @@ var ( "RECENT": 3, "PUSH_NAME": 4, "NON_BLOCKING_DATA": 5, + "ON_DEMAND": 6, } ) @@ -734,11 +811,11 @@ func (x HistorySyncNotification_HistorySyncType) String() string { } func (HistorySyncNotification_HistorySyncType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[11].Descriptor() + return file_binary_proto_def_proto_enumTypes[12].Descriptor() } func (HistorySyncNotification_HistorySyncType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[11] + return &file_binary_proto_def_proto_enumTypes[12] } func (x HistorySyncNotification_HistorySyncType) Number() protoreflect.EnumNumber { @@ -757,7 +834,7 @@ func (x *HistorySyncNotification_HistorySyncType) UnmarshalJSON(b []byte) error // Deprecated: Use HistorySyncNotification_HistorySyncType.Descriptor instead. func (HistorySyncNotification_HistorySyncType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{18, 0} } type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType int32 @@ -805,11 +882,11 @@ func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeC } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[12].Descriptor() + return file_binary_proto_def_proto_enumTypes[13].Descriptor() } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[12] + return &file_binary_proto_def_proto_enumTypes[13] } func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Number() protoreflect.EnumNumber { @@ -828,7 +905,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTime // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType.Descriptor instead. func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0, 0, 1, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0, 0, 1, 0} } type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType int32 @@ -861,11 +938,11 @@ func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeC } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[13].Descriptor() + return file_binary_proto_def_proto_enumTypes[14].Descriptor() } func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[13] + return &file_binary_proto_def_proto_enumTypes[14] } func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Number() protoreflect.EnumNumber { @@ -884,7 +961,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTime // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType.Descriptor instead. func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0, 0, 1, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0, 0, 1, 1} } type GroupInviteMessage_GroupType int32 @@ -917,11 +994,11 @@ func (x GroupInviteMessage_GroupType) String() string { } func (GroupInviteMessage_GroupType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[14].Descriptor() + return file_binary_proto_def_proto_enumTypes[15].Descriptor() } func (GroupInviteMessage_GroupType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[14] + return &file_binary_proto_def_proto_enumTypes[15] } func (x GroupInviteMessage_GroupType) Number() protoreflect.EnumNumber { @@ -940,7 +1017,7 @@ func (x *GroupInviteMessage_GroupType) UnmarshalJSON(b []byte) error { // Deprecated: Use GroupInviteMessage_GroupType.Descriptor instead. func (GroupInviteMessage_GroupType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0} } type ExtendedTextMessage_PreviewType int32 @@ -973,11 +1050,11 @@ func (x ExtendedTextMessage_PreviewType) String() string { } func (ExtendedTextMessage_PreviewType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[15].Descriptor() + return file_binary_proto_def_proto_enumTypes[16].Descriptor() } func (ExtendedTextMessage_PreviewType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[15] + return &file_binary_proto_def_proto_enumTypes[16] } func (x ExtendedTextMessage_PreviewType) Number() protoreflect.EnumNumber { @@ -996,7 +1073,7 @@ func (x *ExtendedTextMessage_PreviewType) UnmarshalJSON(b []byte) error { // Deprecated: Use ExtendedTextMessage_PreviewType.Descriptor instead. func (ExtendedTextMessage_PreviewType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{23, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{22, 0} } type ExtendedTextMessage_InviteLinkGroupType int32 @@ -1035,11 +1112,11 @@ func (x ExtendedTextMessage_InviteLinkGroupType) String() string { } func (ExtendedTextMessage_InviteLinkGroupType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[16].Descriptor() + return file_binary_proto_def_proto_enumTypes[17].Descriptor() } func (ExtendedTextMessage_InviteLinkGroupType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[16] + return &file_binary_proto_def_proto_enumTypes[17] } func (x ExtendedTextMessage_InviteLinkGroupType) Number() protoreflect.EnumNumber { @@ -1058,7 +1135,7 @@ func (x *ExtendedTextMessage_InviteLinkGroupType) UnmarshalJSON(b []byte) error // Deprecated: Use ExtendedTextMessage_InviteLinkGroupType.Descriptor instead. func (ExtendedTextMessage_InviteLinkGroupType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{23, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{22, 1} } type ExtendedTextMessage_FontType int32 @@ -1070,7 +1147,7 @@ const ( ExtendedTextMessage_BRYNDAN_WRITE ExtendedTextMessage_FontType = 3 ExtendedTextMessage_BEBASNEUE_REGULAR ExtendedTextMessage_FontType = 4 ExtendedTextMessage_OSWALD_HEAVY ExtendedTextMessage_FontType = 5 - ExtendedTextMessage_DAMION_REGULAR ExtendedTextMessage_FontType = 6 + ExtendedTextMessage_SYSTEM_BOLD ExtendedTextMessage_FontType = 6 ExtendedTextMessage_MORNINGBREEZE_REGULAR ExtendedTextMessage_FontType = 7 ExtendedTextMessage_CALISTOGA_REGULAR ExtendedTextMessage_FontType = 8 ExtendedTextMessage_EXO2_EXTRABOLD ExtendedTextMessage_FontType = 9 @@ -1086,7 +1163,7 @@ var ( 3: "BRYNDAN_WRITE", 4: "BEBASNEUE_REGULAR", 5: "OSWALD_HEAVY", - 6: "DAMION_REGULAR", + 6: "SYSTEM_BOLD", 7: "MORNINGBREEZE_REGULAR", 8: "CALISTOGA_REGULAR", 9: "EXO2_EXTRABOLD", @@ -1099,7 +1176,7 @@ var ( "BRYNDAN_WRITE": 3, "BEBASNEUE_REGULAR": 4, "OSWALD_HEAVY": 5, - "DAMION_REGULAR": 6, + "SYSTEM_BOLD": 6, "MORNINGBREEZE_REGULAR": 7, "CALISTOGA_REGULAR": 8, "EXO2_EXTRABOLD": 9, @@ -1118,11 +1195,11 @@ func (x ExtendedTextMessage_FontType) String() string { } func (ExtendedTextMessage_FontType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[17].Descriptor() + return file_binary_proto_def_proto_enumTypes[18].Descriptor() } func (ExtendedTextMessage_FontType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[17] + return &file_binary_proto_def_proto_enumTypes[18] } func (x ExtendedTextMessage_FontType) Number() protoreflect.EnumNumber { @@ -1141,7 +1218,7 @@ func (x *ExtendedTextMessage_FontType) UnmarshalJSON(b []byte) error { // Deprecated: Use ExtendedTextMessage_FontType.Descriptor instead. func (ExtendedTextMessage_FontType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{23, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{22, 2} } type ButtonsResponseMessage_Type int32 @@ -1174,11 +1251,11 @@ func (x ButtonsResponseMessage_Type) String() string { } func (ButtonsResponseMessage_Type) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[18].Descriptor() + return file_binary_proto_def_proto_enumTypes[19].Descriptor() } func (ButtonsResponseMessage_Type) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[18] + return &file_binary_proto_def_proto_enumTypes[19] } func (x ButtonsResponseMessage_Type) Number() protoreflect.EnumNumber { @@ -1245,11 +1322,11 @@ func (x ButtonsMessage_HeaderType) String() string { } func (ButtonsMessage_HeaderType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[19].Descriptor() + return file_binary_proto_def_proto_enumTypes[20].Descriptor() } func (ButtonsMessage_HeaderType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[19] + return &file_binary_proto_def_proto_enumTypes[20] } func (x ButtonsMessage_HeaderType) Number() protoreflect.EnumNumber { @@ -1304,11 +1381,11 @@ func (x ButtonsMessage_Button_Type) String() string { } func (ButtonsMessage_Button_Type) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[20].Descriptor() + return file_binary_proto_def_proto_enumTypes[21].Descriptor() } func (ButtonsMessage_Button_Type) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[20] + return &file_binary_proto_def_proto_enumTypes[21] } func (x ButtonsMessage_Button_Type) Number() protoreflect.EnumNumber { @@ -1363,11 +1440,11 @@ func (x DisappearingMode_Initiator) String() string { } func (DisappearingMode_Initiator) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[21].Descriptor() + return file_binary_proto_def_proto_enumTypes[22].Descriptor() } func (DisappearingMode_Initiator) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[21] + return &file_binary_proto_def_proto_enumTypes[22] } func (x DisappearingMode_Initiator) Number() protoreflect.EnumNumber { @@ -1422,11 +1499,11 @@ func (x ContextInfo_ExternalAdReplyInfo_MediaType) String() string { } func (ContextInfo_ExternalAdReplyInfo_MediaType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[22].Descriptor() + return file_binary_proto_def_proto_enumTypes[23].Descriptor() } func (ContextInfo_ExternalAdReplyInfo_MediaType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[22] + return &file_binary_proto_def_proto_enumTypes[23] } func (x ContextInfo_ExternalAdReplyInfo_MediaType) Number() protoreflect.EnumNumber { @@ -1481,11 +1558,11 @@ func (x ContextInfo_AdReplyInfo_MediaType) String() string { } func (ContextInfo_AdReplyInfo_MediaType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[23].Descriptor() + return file_binary_proto_def_proto_enumTypes[24].Descriptor() } func (ContextInfo_AdReplyInfo_MediaType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[23] + return &file_binary_proto_def_proto_enumTypes[24] } func (x ContextInfo_AdReplyInfo_MediaType) Number() protoreflect.EnumNumber { @@ -1537,11 +1614,11 @@ func (x PaymentBackground_Type) String() string { } func (PaymentBackground_Type) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[24].Descriptor() + return file_binary_proto_def_proto_enumTypes[25].Descriptor() } func (PaymentBackground_Type) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[24] + return &file_binary_proto_def_proto_enumTypes[25] } func (x PaymentBackground_Type) Number() protoreflect.EnumNumber { @@ -1596,11 +1673,11 @@ func (x VideoMessage_Attribution) String() string { } func (VideoMessage_Attribution) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[25].Descriptor() + return file_binary_proto_def_proto_enumTypes[26].Descriptor() } func (VideoMessage_Attribution) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[25] + return &file_binary_proto_def_proto_enumTypes[26] } func (x VideoMessage_Attribution) Number() protoreflect.EnumNumber { @@ -1652,11 +1729,11 @@ func (x ScheduledCallEditMessage_EditType) String() string { } func (ScheduledCallEditMessage_EditType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[26].Descriptor() + return file_binary_proto_def_proto_enumTypes[27].Descriptor() } func (ScheduledCallEditMessage_EditType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[26] + return &file_binary_proto_def_proto_enumTypes[27] } func (x ScheduledCallEditMessage_EditType) Number() protoreflect.EnumNumber { @@ -1711,11 +1788,11 @@ func (x ScheduledCallCreationMessage_CallType) String() string { } func (ScheduledCallCreationMessage_CallType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[27].Descriptor() + return file_binary_proto_def_proto_enumTypes[28].Descriptor() } func (ScheduledCallCreationMessage_CallType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[27] + return &file_binary_proto_def_proto_enumTypes[28] } func (x ScheduledCallCreationMessage_CallType) Number() protoreflect.EnumNumber { @@ -1800,11 +1877,11 @@ func (x ProtocolMessage_Type) String() string { } func (ProtocolMessage_Type) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[28].Descriptor() + return file_binary_proto_def_proto_enumTypes[29].Descriptor() } func (ProtocolMessage_Type) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[28] + return &file_binary_proto_def_proto_enumTypes[29] } func (x ProtocolMessage_Type) Number() protoreflect.EnumNumber { @@ -1859,11 +1936,11 @@ func (x PinMessage_PinMessageType) String() string { } func (PinMessage_PinMessageType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[29].Descriptor() + return file_binary_proto_def_proto_enumTypes[30].Descriptor() } func (PinMessage_PinMessageType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[29] + return &file_binary_proto_def_proto_enumTypes[30] } func (x PinMessage_PinMessageType) Number() protoreflect.EnumNumber { @@ -1915,11 +1992,11 @@ func (x PastParticipant_LeaveReason) String() string { } func (PastParticipant_LeaveReason) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[30].Descriptor() + return file_binary_proto_def_proto_enumTypes[31].Descriptor() } func (PastParticipant_LeaveReason) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[30] + return &file_binary_proto_def_proto_enumTypes[31] } func (x PastParticipant_LeaveReason) Number() protoreflect.EnumNumber { @@ -1938,7 +2015,7 @@ func (x *PastParticipant_LeaveReason) UnmarshalJSON(b []byte) error { // Deprecated: Use PastParticipant_LeaveReason.Descriptor instead. func (PastParticipant_LeaveReason) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{83, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{84, 0} } type HistorySync_HistorySyncType int32 @@ -1950,6 +2027,7 @@ const ( HistorySync_RECENT HistorySync_HistorySyncType = 3 HistorySync_PUSH_NAME HistorySync_HistorySyncType = 4 HistorySync_NON_BLOCKING_DATA HistorySync_HistorySyncType = 5 + HistorySync_ON_DEMAND HistorySync_HistorySyncType = 6 ) // Enum value maps for HistorySync_HistorySyncType. @@ -1961,6 +2039,7 @@ var ( 3: "RECENT", 4: "PUSH_NAME", 5: "NON_BLOCKING_DATA", + 6: "ON_DEMAND", } HistorySync_HistorySyncType_value = map[string]int32{ "INITIAL_BOOTSTRAP": 0, @@ -1969,6 +2048,7 @@ var ( "RECENT": 3, "PUSH_NAME": 4, "NON_BLOCKING_DATA": 5, + "ON_DEMAND": 6, } ) @@ -1983,11 +2063,11 @@ func (x HistorySync_HistorySyncType) String() string { } func (HistorySync_HistorySyncType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[31].Descriptor() + return file_binary_proto_def_proto_enumTypes[32].Descriptor() } func (HistorySync_HistorySyncType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[31] + return &file_binary_proto_def_proto_enumTypes[32] } func (x HistorySync_HistorySyncType) Number() protoreflect.EnumNumber { @@ -2006,7 +2086,7 @@ func (x *HistorySync_HistorySyncType) UnmarshalJSON(b []byte) error { // Deprecated: Use HistorySync_HistorySyncType.Descriptor instead. func (HistorySync_HistorySyncType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{84, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{86, 0} } type GroupParticipant_Rank int32 @@ -2042,11 +2122,11 @@ func (x GroupParticipant_Rank) String() string { } func (GroupParticipant_Rank) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[32].Descriptor() + return file_binary_proto_def_proto_enumTypes[33].Descriptor() } func (GroupParticipant_Rank) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[32] + return &file_binary_proto_def_proto_enumTypes[33] } func (x GroupParticipant_Rank) Number() protoreflect.EnumNumber { @@ -2065,14 +2145,15 @@ func (x *GroupParticipant_Rank) UnmarshalJSON(b []byte) error { // Deprecated: Use GroupParticipant_Rank.Descriptor instead. func (GroupParticipant_Rank) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{86, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{88, 0} } type Conversation_EndOfHistoryTransferType int32 const ( - Conversation_COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 0 - Conversation_COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 1 + Conversation_COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 0 + Conversation_COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 1 + Conversation_COMPLETE_ON_DEMAND_SYNC_BUT_MORE_MSG_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 2 ) // Enum value maps for Conversation_EndOfHistoryTransferType. @@ -2080,10 +2161,12 @@ var ( Conversation_EndOfHistoryTransferType_name = map[int32]string{ 0: "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY", 1: "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY", + 2: "COMPLETE_ON_DEMAND_SYNC_BUT_MORE_MSG_REMAIN_ON_PRIMARY", } Conversation_EndOfHistoryTransferType_value = map[string]int32{ - "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY": 0, - "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY": 1, + "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY": 0, + "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY": 1, + "COMPLETE_ON_DEMAND_SYNC_BUT_MORE_MSG_REMAIN_ON_PRIMARY": 2, } ) @@ -2098,11 +2181,11 @@ func (x Conversation_EndOfHistoryTransferType) String() string { } func (Conversation_EndOfHistoryTransferType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[33].Descriptor() + return file_binary_proto_def_proto_enumTypes[34].Descriptor() } func (Conversation_EndOfHistoryTransferType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[33] + return &file_binary_proto_def_proto_enumTypes[34] } func (x Conversation_EndOfHistoryTransferType) Number() protoreflect.EnumNumber { @@ -2121,7 +2204,7 @@ func (x *Conversation_EndOfHistoryTransferType) UnmarshalJSON(b []byte) error { // Deprecated: Use Conversation_EndOfHistoryTransferType.Descriptor instead. func (Conversation_EndOfHistoryTransferType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{88, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{90, 0} } type MediaRetryNotification_ResultType int32 @@ -2160,11 +2243,11 @@ func (x MediaRetryNotification_ResultType) String() string { } func (MediaRetryNotification_ResultType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[34].Descriptor() + return file_binary_proto_def_proto_enumTypes[35].Descriptor() } func (MediaRetryNotification_ResultType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[34] + return &file_binary_proto_def_proto_enumTypes[35] } func (x MediaRetryNotification_ResultType) Number() protoreflect.EnumNumber { @@ -2183,7 +2266,7 @@ func (x *MediaRetryNotification_ResultType) UnmarshalJSON(b []byte) error { // Deprecated: Use MediaRetryNotification_ResultType.Descriptor instead. func (MediaRetryNotification_ResultType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{94, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{96, 0} } type SyncdMutation_SyncdOperation int32 @@ -2216,11 +2299,11 @@ func (x SyncdMutation_SyncdOperation) String() string { } func (SyncdMutation_SyncdOperation) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[35].Descriptor() + return file_binary_proto_def_proto_enumTypes[36].Descriptor() } func (SyncdMutation_SyncdOperation) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[35] + return &file_binary_proto_def_proto_enumTypes[36] } func (x SyncdMutation_SyncdOperation) Number() protoreflect.EnumNumber { @@ -2239,7 +2322,60 @@ func (x *SyncdMutation_SyncdOperation) UnmarshalJSON(b []byte) error { // Deprecated: Use SyncdMutation_SyncdOperation.Descriptor instead. func (SyncdMutation_SyncdOperation) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{102, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{104, 0} +} + +type MarketingMessageAction_MarketingMessagePrototypeType int32 + +const ( + MarketingMessageAction_PERSONALIZED MarketingMessageAction_MarketingMessagePrototypeType = 0 +) + +// Enum value maps for MarketingMessageAction_MarketingMessagePrototypeType. +var ( + MarketingMessageAction_MarketingMessagePrototypeType_name = map[int32]string{ + 0: "PERSONALIZED", + } + MarketingMessageAction_MarketingMessagePrototypeType_value = map[string]int32{ + "PERSONALIZED": 0, + } +) + +func (x MarketingMessageAction_MarketingMessagePrototypeType) Enum() *MarketingMessageAction_MarketingMessagePrototypeType { + p := new(MarketingMessageAction_MarketingMessagePrototypeType) + *p = x + return p +} + +func (x MarketingMessageAction_MarketingMessagePrototypeType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MarketingMessageAction_MarketingMessagePrototypeType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[37].Descriptor() +} + +func (MarketingMessageAction_MarketingMessagePrototypeType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[37] +} + +func (x MarketingMessageAction_MarketingMessagePrototypeType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *MarketingMessageAction_MarketingMessagePrototypeType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = MarketingMessageAction_MarketingMessagePrototypeType(num) + return nil +} + +// Deprecated: Use MarketingMessageAction_MarketingMessagePrototypeType.Descriptor instead. +func (MarketingMessageAction_MarketingMessagePrototypeType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{131, 0} } type BizIdentityInfo_VerifiedLevelValue int32 @@ -2275,11 +2411,11 @@ func (x BizIdentityInfo_VerifiedLevelValue) String() string { } func (BizIdentityInfo_VerifiedLevelValue) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[36].Descriptor() + return file_binary_proto_def_proto_enumTypes[38].Descriptor() } func (BizIdentityInfo_VerifiedLevelValue) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[36] + return &file_binary_proto_def_proto_enumTypes[38] } func (x BizIdentityInfo_VerifiedLevelValue) Number() protoreflect.EnumNumber { @@ -2298,7 +2434,7 @@ func (x *BizIdentityInfo_VerifiedLevelValue) UnmarshalJSON(b []byte) error { // Deprecated: Use BizIdentityInfo_VerifiedLevelValue.Descriptor instead. func (BizIdentityInfo_VerifiedLevelValue) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{145, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{151, 0} } type BizIdentityInfo_HostStorageType int32 @@ -2331,11 +2467,11 @@ func (x BizIdentityInfo_HostStorageType) String() string { } func (BizIdentityInfo_HostStorageType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[37].Descriptor() + return file_binary_proto_def_proto_enumTypes[39].Descriptor() } func (BizIdentityInfo_HostStorageType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[37] + return &file_binary_proto_def_proto_enumTypes[39] } func (x BizIdentityInfo_HostStorageType) Number() protoreflect.EnumNumber { @@ -2354,7 +2490,7 @@ func (x *BizIdentityInfo_HostStorageType) UnmarshalJSON(b []byte) error { // Deprecated: Use BizIdentityInfo_HostStorageType.Descriptor instead. func (BizIdentityInfo_HostStorageType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{145, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{151, 1} } type BizIdentityInfo_ActualActorsType int32 @@ -2387,11 +2523,11 @@ func (x BizIdentityInfo_ActualActorsType) String() string { } func (BizIdentityInfo_ActualActorsType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[38].Descriptor() + return file_binary_proto_def_proto_enumTypes[40].Descriptor() } func (BizIdentityInfo_ActualActorsType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[38] + return &file_binary_proto_def_proto_enumTypes[40] } func (x BizIdentityInfo_ActualActorsType) Number() protoreflect.EnumNumber { @@ -2410,7 +2546,7 @@ func (x *BizIdentityInfo_ActualActorsType) UnmarshalJSON(b []byte) error { // Deprecated: Use BizIdentityInfo_ActualActorsType.Descriptor instead. func (BizIdentityInfo_ActualActorsType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{145, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{151, 2} } type BizAccountLinkInfo_HostStorageType int32 @@ -2443,11 +2579,11 @@ func (x BizAccountLinkInfo_HostStorageType) String() string { } func (BizAccountLinkInfo_HostStorageType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[39].Descriptor() + return file_binary_proto_def_proto_enumTypes[41].Descriptor() } func (BizAccountLinkInfo_HostStorageType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[39] + return &file_binary_proto_def_proto_enumTypes[41] } func (x BizAccountLinkInfo_HostStorageType) Number() protoreflect.EnumNumber { @@ -2466,7 +2602,7 @@ func (x *BizAccountLinkInfo_HostStorageType) UnmarshalJSON(b []byte) error { // Deprecated: Use BizAccountLinkInfo_HostStorageType.Descriptor instead. func (BizAccountLinkInfo_HostStorageType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{147, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{153, 0} } type BizAccountLinkInfo_AccountType int32 @@ -2496,11 +2632,11 @@ func (x BizAccountLinkInfo_AccountType) String() string { } func (BizAccountLinkInfo_AccountType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[40].Descriptor() + return file_binary_proto_def_proto_enumTypes[42].Descriptor() } func (BizAccountLinkInfo_AccountType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[40] + return &file_binary_proto_def_proto_enumTypes[42] } func (x BizAccountLinkInfo_AccountType) Number() protoreflect.EnumNumber { @@ -2519,7 +2655,7 @@ func (x *BizAccountLinkInfo_AccountType) UnmarshalJSON(b []byte) error { // Deprecated: Use BizAccountLinkInfo_AccountType.Descriptor instead. func (BizAccountLinkInfo_AccountType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{147, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{153, 1} } type ClientPayload_Product int32 @@ -2527,6 +2663,7 @@ type ClientPayload_Product int32 const ( ClientPayload_WHATSAPP ClientPayload_Product = 0 ClientPayload_MESSENGER ClientPayload_Product = 1 + ClientPayload_INTEROP ClientPayload_Product = 2 ) // Enum value maps for ClientPayload_Product. @@ -2534,10 +2671,12 @@ var ( ClientPayload_Product_name = map[int32]string{ 0: "WHATSAPP", 1: "MESSENGER", + 2: "INTEROP", } ClientPayload_Product_value = map[string]int32{ "WHATSAPP": 0, "MESSENGER": 1, + "INTEROP": 2, } ) @@ -2552,11 +2691,11 @@ func (x ClientPayload_Product) String() string { } func (ClientPayload_Product) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[41].Descriptor() + return file_binary_proto_def_proto_enumTypes[43].Descriptor() } func (ClientPayload_Product) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[41] + return &file_binary_proto_def_proto_enumTypes[43] } func (x ClientPayload_Product) Number() protoreflect.EnumNumber { @@ -2575,7 +2714,7 @@ func (x *ClientPayload_Product) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_Product.Descriptor instead. func (ClientPayload_Product) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 0} } type ClientPayload_IOSAppExtension int32 @@ -2611,11 +2750,11 @@ func (x ClientPayload_IOSAppExtension) String() string { } func (ClientPayload_IOSAppExtension) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[42].Descriptor() + return file_binary_proto_def_proto_enumTypes[44].Descriptor() } func (ClientPayload_IOSAppExtension) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[42] + return &file_binary_proto_def_proto_enumTypes[44] } func (x ClientPayload_IOSAppExtension) Number() protoreflect.EnumNumber { @@ -2634,7 +2773,7 @@ func (x *ClientPayload_IOSAppExtension) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_IOSAppExtension.Descriptor instead. func (ClientPayload_IOSAppExtension) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 1} } type ClientPayload_ConnectType int32 @@ -2706,11 +2845,11 @@ func (x ClientPayload_ConnectType) String() string { } func (ClientPayload_ConnectType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[43].Descriptor() + return file_binary_proto_def_proto_enumTypes[45].Descriptor() } func (ClientPayload_ConnectType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[43] + return &file_binary_proto_def_proto_enumTypes[45] } func (x ClientPayload_ConnectType) Number() protoreflect.EnumNumber { @@ -2729,7 +2868,7 @@ func (x *ClientPayload_ConnectType) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_ConnectType.Descriptor instead. func (ClientPayload_ConnectType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 2} } type ClientPayload_ConnectReason int32 @@ -2741,6 +2880,7 @@ const ( ClientPayload_ERROR_RECONNECT ClientPayload_ConnectReason = 3 ClientPayload_NETWORK_SWITCH ClientPayload_ConnectReason = 4 ClientPayload_PING_RECONNECT ClientPayload_ConnectReason = 5 + ClientPayload_UNKNOWN ClientPayload_ConnectReason = 6 ) // Enum value maps for ClientPayload_ConnectReason. @@ -2752,6 +2892,7 @@ var ( 3: "ERROR_RECONNECT", 4: "NETWORK_SWITCH", 5: "PING_RECONNECT", + 6: "UNKNOWN", } ClientPayload_ConnectReason_value = map[string]int32{ "PUSH": 0, @@ -2760,6 +2901,7 @@ var ( "ERROR_RECONNECT": 3, "NETWORK_SWITCH": 4, "PING_RECONNECT": 5, + "UNKNOWN": 6, } ) @@ -2774,11 +2916,11 @@ func (x ClientPayload_ConnectReason) String() string { } func (ClientPayload_ConnectReason) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[44].Descriptor() + return file_binary_proto_def_proto_enumTypes[46].Descriptor() } func (ClientPayload_ConnectReason) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[44] + return &file_binary_proto_def_proto_enumTypes[46] } func (x ClientPayload_ConnectReason) Number() protoreflect.EnumNumber { @@ -2797,7 +2939,7 @@ func (x *ClientPayload_ConnectReason) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_ConnectReason.Descriptor instead. func (ClientPayload_ConnectReason) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 3} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 3} } type ClientPayload_WebInfo_WebSubPlatform int32 @@ -2839,11 +2981,11 @@ func (x ClientPayload_WebInfo_WebSubPlatform) String() string { } func (ClientPayload_WebInfo_WebSubPlatform) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[45].Descriptor() + return file_binary_proto_def_proto_enumTypes[47].Descriptor() } func (ClientPayload_WebInfo_WebSubPlatform) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[45] + return &file_binary_proto_def_proto_enumTypes[47] } func (x ClientPayload_WebInfo_WebSubPlatform) Number() protoreflect.EnumNumber { @@ -2862,7 +3004,7 @@ func (x *ClientPayload_WebInfo_WebSubPlatform) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_WebInfo_WebSubPlatform.Descriptor instead. func (ClientPayload_WebInfo_WebSubPlatform) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 0, 0} } type ClientPayload_UserAgent_ReleaseChannel int32 @@ -2901,11 +3043,11 @@ func (x ClientPayload_UserAgent_ReleaseChannel) String() string { } func (ClientPayload_UserAgent_ReleaseChannel) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[46].Descriptor() + return file_binary_proto_def_proto_enumTypes[48].Descriptor() } func (ClientPayload_UserAgent_ReleaseChannel) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[46] + return &file_binary_proto_def_proto_enumTypes[48] } func (x ClientPayload_UserAgent_ReleaseChannel) Number() protoreflect.EnumNumber { @@ -2924,7 +3066,7 @@ func (x *ClientPayload_UserAgent_ReleaseChannel) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_UserAgent_ReleaseChannel.Descriptor instead. func (ClientPayload_UserAgent_ReleaseChannel) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 1, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 1, 0} } type ClientPayload_UserAgent_Platform int32 @@ -2963,6 +3105,7 @@ const ( ClientPayload_UserAgent_ARDEVICE ClientPayload_UserAgent_Platform = 30 ClientPayload_UserAgent_VRDEVICE ClientPayload_UserAgent_Platform = 31 ClientPayload_UserAgent_BLUE_WEB ClientPayload_UserAgent_Platform = 32 + ClientPayload_UserAgent_IPAD ClientPayload_UserAgent_Platform = 33 ) // Enum value maps for ClientPayload_UserAgent_Platform. @@ -3001,6 +3144,7 @@ var ( 30: "ARDEVICE", 31: "VRDEVICE", 32: "BLUE_WEB", + 33: "IPAD", } ClientPayload_UserAgent_Platform_value = map[string]int32{ "ANDROID": 0, @@ -3036,6 +3180,7 @@ var ( "ARDEVICE": 30, "VRDEVICE": 31, "BLUE_WEB": 32, + "IPAD": 33, } ) @@ -3050,11 +3195,11 @@ func (x ClientPayload_UserAgent_Platform) String() string { } func (ClientPayload_UserAgent_Platform) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[47].Descriptor() + return file_binary_proto_def_proto_enumTypes[49].Descriptor() } func (ClientPayload_UserAgent_Platform) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[47] + return &file_binary_proto_def_proto_enumTypes[49] } func (x ClientPayload_UserAgent_Platform) Number() protoreflect.EnumNumber { @@ -3073,7 +3218,7 @@ func (x *ClientPayload_UserAgent_Platform) UnmarshalJSON(b []byte) error { // Deprecated: Use ClientPayload_UserAgent_Platform.Descriptor instead. func (ClientPayload_UserAgent_Platform) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 1, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 1, 1} } type ClientPayload_DNSSource_DNSResolutionMethod int32 @@ -3115,11 +3260,11 @@ func (x ClientPayload_DNSSource_DNSResolutionMethod) String() string { } func (ClientPayload_DNSSource_DNSResolutionMethod) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[48].Descriptor() + return file_binary_proto_def_proto_enumTypes[50].Descriptor() } func (ClientPayload_DNSSource_DNSResolutionMethod) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[48] + return &file_binary_proto_def_proto_enumTypes[50] } func (x ClientPayload_DNSSource_DNSResolutionMethod) Number() protoreflect.EnumNumber { @@ -3138,7 +3283,7 @@ func (x *ClientPayload_DNSSource_DNSResolutionMethod) UnmarshalJSON(b []byte) er // Deprecated: Use ClientPayload_DNSSource_DNSResolutionMethod.Descriptor instead. func (ClientPayload_DNSSource_DNSResolutionMethod) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 3, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 4, 0} } type WebMessageInfo_StubType int32 @@ -3306,6 +3451,20 @@ const ( WebMessageInfo_CAG_INVITE_AUTO_ADD WebMessageInfo_StubType = 159 WebMessageInfo_BIZ_CHAT_ASSIGNMENT_UNASSIGN WebMessageInfo_StubType = 160 WebMessageInfo_CAG_INVITE_AUTO_JOINED WebMessageInfo_StubType = 161 + WebMessageInfo_SCHEDULED_CALL_START_MESSAGE WebMessageInfo_StubType = 162 + WebMessageInfo_COMMUNITY_INVITE_RICH WebMessageInfo_StubType = 163 + WebMessageInfo_COMMUNITY_INVITE_AUTO_ADD_RICH WebMessageInfo_StubType = 164 + WebMessageInfo_SUB_GROUP_INVITE_RICH WebMessageInfo_StubType = 165 + WebMessageInfo_SUB_GROUP_PARTICIPANT_ADD_RICH WebMessageInfo_StubType = 166 + WebMessageInfo_COMMUNITY_LINK_PARENT_GROUP_RICH WebMessageInfo_StubType = 167 + WebMessageInfo_COMMUNITY_PARTICIPANT_ADD_RICH WebMessageInfo_StubType = 168 + WebMessageInfo_SILENCED_UNKNOWN_CALLER_AUDIO WebMessageInfo_StubType = 169 + WebMessageInfo_SILENCED_UNKNOWN_CALLER_VIDEO WebMessageInfo_StubType = 170 + WebMessageInfo_GROUP_MEMBER_ADD_MODE WebMessageInfo_StubType = 171 + WebMessageInfo_GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD WebMessageInfo_StubType = 172 + WebMessageInfo_COMMUNITY_CHANGE_DESCRIPTION WebMessageInfo_StubType = 173 + WebMessageInfo_SENDER_INVITE WebMessageInfo_StubType = 174 + WebMessageInfo_RECEIVER_INVITE WebMessageInfo_StubType = 175 ) // Enum value maps for WebMessageInfo_StubType. @@ -3473,6 +3632,20 @@ var ( 159: "CAG_INVITE_AUTO_ADD", 160: "BIZ_CHAT_ASSIGNMENT_UNASSIGN", 161: "CAG_INVITE_AUTO_JOINED", + 162: "SCHEDULED_CALL_START_MESSAGE", + 163: "COMMUNITY_INVITE_RICH", + 164: "COMMUNITY_INVITE_AUTO_ADD_RICH", + 165: "SUB_GROUP_INVITE_RICH", + 166: "SUB_GROUP_PARTICIPANT_ADD_RICH", + 167: "COMMUNITY_LINK_PARENT_GROUP_RICH", + 168: "COMMUNITY_PARTICIPANT_ADD_RICH", + 169: "SILENCED_UNKNOWN_CALLER_AUDIO", + 170: "SILENCED_UNKNOWN_CALLER_VIDEO", + 171: "GROUP_MEMBER_ADD_MODE", + 172: "GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD", + 173: "COMMUNITY_CHANGE_DESCRIPTION", + 174: "SENDER_INVITE", + 175: "RECEIVER_INVITE", } WebMessageInfo_StubType_value = map[string]int32{ "UNKNOWN": 0, @@ -3637,6 +3810,20 @@ var ( "CAG_INVITE_AUTO_ADD": 159, "BIZ_CHAT_ASSIGNMENT_UNASSIGN": 160, "CAG_INVITE_AUTO_JOINED": 161, + "SCHEDULED_CALL_START_MESSAGE": 162, + "COMMUNITY_INVITE_RICH": 163, + "COMMUNITY_INVITE_AUTO_ADD_RICH": 164, + "SUB_GROUP_INVITE_RICH": 165, + "SUB_GROUP_PARTICIPANT_ADD_RICH": 166, + "COMMUNITY_LINK_PARENT_GROUP_RICH": 167, + "COMMUNITY_PARTICIPANT_ADD_RICH": 168, + "SILENCED_UNKNOWN_CALLER_AUDIO": 169, + "SILENCED_UNKNOWN_CALLER_VIDEO": 170, + "GROUP_MEMBER_ADD_MODE": 171, + "GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD": 172, + "COMMUNITY_CHANGE_DESCRIPTION": 173, + "SENDER_INVITE": 174, + "RECEIVER_INVITE": 175, } ) @@ -3651,11 +3838,11 @@ func (x WebMessageInfo_StubType) String() string { } func (WebMessageInfo_StubType) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[49].Descriptor() + return file_binary_proto_def_proto_enumTypes[51].Descriptor() } func (WebMessageInfo_StubType) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[49] + return &file_binary_proto_def_proto_enumTypes[51] } func (x WebMessageInfo_StubType) Number() protoreflect.EnumNumber { @@ -3674,7 +3861,7 @@ func (x *WebMessageInfo_StubType) UnmarshalJSON(b []byte) error { // Deprecated: Use WebMessageInfo_StubType.Descriptor instead. func (WebMessageInfo_StubType) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{154, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{160, 0} } type WebMessageInfo_Status int32 @@ -3719,11 +3906,11 @@ func (x WebMessageInfo_Status) String() string { } func (WebMessageInfo_Status) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[50].Descriptor() + return file_binary_proto_def_proto_enumTypes[52].Descriptor() } func (WebMessageInfo_Status) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[50] + return &file_binary_proto_def_proto_enumTypes[52] } func (x WebMessageInfo_Status) Number() protoreflect.EnumNumber { @@ -3742,7 +3929,7 @@ func (x *WebMessageInfo_Status) UnmarshalJSON(b []byte) error { // Deprecated: Use WebMessageInfo_Status.Descriptor instead. func (WebMessageInfo_Status) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{154, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{160, 1} } type WebMessageInfo_BizPrivacyStatus int32 @@ -3781,11 +3968,11 @@ func (x WebMessageInfo_BizPrivacyStatus) String() string { } func (WebMessageInfo_BizPrivacyStatus) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[51].Descriptor() + return file_binary_proto_def_proto_enumTypes[53].Descriptor() } func (WebMessageInfo_BizPrivacyStatus) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[51] + return &file_binary_proto_def_proto_enumTypes[53] } func (x WebMessageInfo_BizPrivacyStatus) Number() protoreflect.EnumNumber { @@ -3804,7 +3991,7 @@ func (x *WebMessageInfo_BizPrivacyStatus) UnmarshalJSON(b []byte) error { // Deprecated: Use WebMessageInfo_BizPrivacyStatus.Descriptor instead. func (WebMessageInfo_BizPrivacyStatus) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{154, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{160, 2} } type WebFeatures_Flag int32 @@ -3843,11 +4030,11 @@ func (x WebFeatures_Flag) String() string { } func (WebFeatures_Flag) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[52].Descriptor() + return file_binary_proto_def_proto_enumTypes[54].Descriptor() } func (WebFeatures_Flag) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[52] + return &file_binary_proto_def_proto_enumTypes[54] } func (x WebFeatures_Flag) Number() protoreflect.EnumNumber { @@ -3866,7 +4053,66 @@ func (x *WebFeatures_Flag) UnmarshalJSON(b []byte) error { // Deprecated: Use WebFeatures_Flag.Descriptor instead. func (WebFeatures_Flag) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{155, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{161, 0} +} + +type PinInChat_PinMessageType int32 + +const ( + PinInChat_UNKNOWN_PIN_MESSAGE_TYPE PinInChat_PinMessageType = 0 + PinInChat_PIN_FOR_ALL PinInChat_PinMessageType = 1 + PinInChat_UNPIN_FOR_ALL PinInChat_PinMessageType = 2 +) + +// Enum value maps for PinInChat_PinMessageType. +var ( + PinInChat_PinMessageType_name = map[int32]string{ + 0: "UNKNOWN_PIN_MESSAGE_TYPE", + 1: "PIN_FOR_ALL", + 2: "UNPIN_FOR_ALL", + } + PinInChat_PinMessageType_value = map[string]int32{ + "UNKNOWN_PIN_MESSAGE_TYPE": 0, + "PIN_FOR_ALL": 1, + "UNPIN_FOR_ALL": 2, + } +) + +func (x PinInChat_PinMessageType) Enum() *PinInChat_PinMessageType { + p := new(PinInChat_PinMessageType) + *p = x + return p +} + +func (x PinInChat_PinMessageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PinInChat_PinMessageType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[55].Descriptor() +} + +func (PinInChat_PinMessageType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[55] +} + +func (x PinInChat_PinMessageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PinInChat_PinMessageType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PinInChat_PinMessageType(num) + return nil +} + +// Deprecated: Use PinInChat_PinMessageType.Descriptor instead. +func (PinInChat_PinMessageType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{167, 0} } type PaymentInfo_TxnStatus int32 @@ -3989,11 +4235,11 @@ func (x PaymentInfo_TxnStatus) String() string { } func (PaymentInfo_TxnStatus) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[53].Descriptor() + return file_binary_proto_def_proto_enumTypes[56].Descriptor() } func (PaymentInfo_TxnStatus) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[53] + return &file_binary_proto_def_proto_enumTypes[56] } func (x PaymentInfo_TxnStatus) Number() protoreflect.EnumNumber { @@ -4012,7 +4258,7 @@ func (x *PaymentInfo_TxnStatus) UnmarshalJSON(b []byte) error { // Deprecated: Use PaymentInfo_TxnStatus.Descriptor instead. func (PaymentInfo_TxnStatus) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{162, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{169, 0} } type PaymentInfo_Status int32 @@ -4075,11 +4321,11 @@ func (x PaymentInfo_Status) String() string { } func (PaymentInfo_Status) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[54].Descriptor() + return file_binary_proto_def_proto_enumTypes[57].Descriptor() } func (PaymentInfo_Status) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[54] + return &file_binary_proto_def_proto_enumTypes[57] } func (x PaymentInfo_Status) Number() protoreflect.EnumNumber { @@ -4098,7 +4344,7 @@ func (x *PaymentInfo_Status) UnmarshalJSON(b []byte) error { // Deprecated: Use PaymentInfo_Status.Descriptor instead. func (PaymentInfo_Status) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{162, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{169, 1} } type PaymentInfo_Currency int32 @@ -4131,11 +4377,11 @@ func (x PaymentInfo_Currency) String() string { } func (PaymentInfo_Currency) Descriptor() protoreflect.EnumDescriptor { - return file_binary_proto_def_proto_enumTypes[55].Descriptor() + return file_binary_proto_def_proto_enumTypes[58].Descriptor() } func (PaymentInfo_Currency) Type() protoreflect.EnumType { - return &file_binary_proto_def_proto_enumTypes[55] + return &file_binary_proto_def_proto_enumTypes[58] } func (x PaymentInfo_Currency) Number() protoreflect.EnumNumber { @@ -4154,7 +4400,7 @@ func (x *PaymentInfo_Currency) UnmarshalJSON(b []byte) error { // Deprecated: Use PaymentInfo_Currency.Descriptor instead. func (PaymentInfo_Currency) EnumDescriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{162, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{169, 2} } type ADVSignedKeyIndexList struct { @@ -4551,69 +4797,6 @@ func (x *DeviceProps) GetHistorySyncConfig() *DeviceProps_HistorySyncConfig { return nil } -type PeerDataOperationRequestMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PeerDataOperationRequestType *PeerDataOperationRequestType `protobuf:"varint,1,opt,name=peerDataOperationRequestType,enum=proto.PeerDataOperationRequestType" json:"peerDataOperationRequestType,omitempty"` - RequestStickerReupload []*PeerDataOperationRequestMessage_RequestStickerReupload `protobuf:"bytes,2,rep,name=requestStickerReupload" json:"requestStickerReupload,omitempty"` - RequestUrlPreview []*PeerDataOperationRequestMessage_RequestUrlPreview `protobuf:"bytes,3,rep,name=requestUrlPreview" json:"requestUrlPreview,omitempty"` -} - -func (x *PeerDataOperationRequestMessage) Reset() { - *x = PeerDataOperationRequestMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestMessage) ProtoMessage() {} - -func (x *PeerDataOperationRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestMessage.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{6} -} - -func (x *PeerDataOperationRequestMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { - if x != nil && x.PeerDataOperationRequestType != nil { - return *x.PeerDataOperationRequestType - } - return PeerDataOperationRequestType_UPLOAD_STICKER -} - -func (x *PeerDataOperationRequestMessage) GetRequestStickerReupload() []*PeerDataOperationRequestMessage_RequestStickerReupload { - if x != nil { - return x.RequestStickerReupload - } - return nil -} - -func (x *PeerDataOperationRequestMessage) GetRequestUrlPreview() []*PeerDataOperationRequestMessage_RequestUrlPreview { - if x != nil { - return x.RequestUrlPreview - } - return nil -} - type PaymentInviteMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4626,7 +4809,7 @@ type PaymentInviteMessage struct { func (x *PaymentInviteMessage) Reset() { *x = PaymentInviteMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[7] + mi := &file_binary_proto_def_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4639,7 +4822,7 @@ func (x *PaymentInviteMessage) String() string { func (*PaymentInviteMessage) ProtoMessage() {} func (x *PaymentInviteMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[7] + mi := &file_binary_proto_def_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4652,7 +4835,7 @@ func (x *PaymentInviteMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use PaymentInviteMessage.ProtoReflect.Descriptor instead. func (*PaymentInviteMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{7} + return file_binary_proto_def_proto_rawDescGZIP(), []int{6} } func (x *PaymentInviteMessage) GetServiceType() PaymentInviteMessage_ServiceType { @@ -4691,7 +4874,7 @@ type OrderMessage struct { func (x *OrderMessage) Reset() { *x = OrderMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[8] + mi := &file_binary_proto_def_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4704,7 +4887,7 @@ func (x *OrderMessage) String() string { func (*OrderMessage) ProtoMessage() {} func (x *OrderMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[8] + mi := &file_binary_proto_def_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4717,7 +4900,7 @@ func (x *OrderMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use OrderMessage.ProtoReflect.Descriptor instead. func (*OrderMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{8} + return file_binary_proto_def_proto_rawDescGZIP(), []int{7} } func (x *OrderMessage) GetOrderId() string { @@ -4826,7 +5009,7 @@ type LocationMessage struct { func (x *LocationMessage) Reset() { *x = LocationMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[9] + mi := &file_binary_proto_def_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4839,7 +5022,7 @@ func (x *LocationMessage) String() string { func (*LocationMessage) ProtoMessage() {} func (x *LocationMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[9] + mi := &file_binary_proto_def_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4852,7 +5035,7 @@ func (x *LocationMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use LocationMessage.ProtoReflect.Descriptor instead. func (*LocationMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{9} + return file_binary_proto_def_proto_rawDescGZIP(), []int{8} } func (x *LocationMessage) GetDegreesLatitude() float64 { @@ -4959,7 +5142,7 @@ type LiveLocationMessage struct { func (x *LiveLocationMessage) Reset() { *x = LiveLocationMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[10] + mi := &file_binary_proto_def_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4972,7 +5155,7 @@ func (x *LiveLocationMessage) String() string { func (*LiveLocationMessage) ProtoMessage() {} func (x *LiveLocationMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[10] + mi := &file_binary_proto_def_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4985,7 +5168,7 @@ func (x *LiveLocationMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use LiveLocationMessage.ProtoReflect.Descriptor instead. func (*LiveLocationMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{10} + return file_binary_proto_def_proto_rawDescGZIP(), []int{9} } func (x *LiveLocationMessage) GetDegreesLatitude() float64 { @@ -5073,7 +5256,7 @@ type ListResponseMessage struct { func (x *ListResponseMessage) Reset() { *x = ListResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[11] + mi := &file_binary_proto_def_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5086,7 +5269,7 @@ func (x *ListResponseMessage) String() string { func (*ListResponseMessage) ProtoMessage() {} func (x *ListResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[11] + mi := &file_binary_proto_def_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5099,7 +5282,7 @@ func (x *ListResponseMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ListResponseMessage.ProtoReflect.Descriptor instead. func (*ListResponseMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{11} + return file_binary_proto_def_proto_rawDescGZIP(), []int{10} } func (x *ListResponseMessage) GetTitle() string { @@ -5155,7 +5338,7 @@ type ListMessage struct { func (x *ListMessage) Reset() { *x = ListMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[12] + mi := &file_binary_proto_def_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5168,7 +5351,7 @@ func (x *ListMessage) String() string { func (*ListMessage) ProtoMessage() {} func (x *ListMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[12] + mi := &file_binary_proto_def_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5181,7 +5364,7 @@ func (x *ListMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMessage.ProtoReflect.Descriptor instead. func (*ListMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11} } func (x *ListMessage) GetTitle() string { @@ -5253,7 +5436,7 @@ type KeepInChatMessage struct { func (x *KeepInChatMessage) Reset() { *x = KeepInChatMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[13] + mi := &file_binary_proto_def_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5266,7 +5449,7 @@ func (x *KeepInChatMessage) String() string { func (*KeepInChatMessage) ProtoMessage() {} func (x *KeepInChatMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[13] + mi := &file_binary_proto_def_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5279,7 +5462,7 @@ func (x *KeepInChatMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use KeepInChatMessage.ProtoReflect.Descriptor instead. func (*KeepInChatMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{13} + return file_binary_proto_def_proto_rawDescGZIP(), []int{12} } func (x *KeepInChatMessage) GetKey() *MessageKey { @@ -5323,7 +5506,7 @@ type InvoiceMessage struct { func (x *InvoiceMessage) Reset() { *x = InvoiceMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[14] + mi := &file_binary_proto_def_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5336,7 +5519,7 @@ func (x *InvoiceMessage) String() string { func (*InvoiceMessage) ProtoMessage() {} func (x *InvoiceMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[14] + mi := &file_binary_proto_def_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5349,7 +5532,7 @@ func (x *InvoiceMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use InvoiceMessage.ProtoReflect.Descriptor instead. func (*InvoiceMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{14} + return file_binary_proto_def_proto_rawDescGZIP(), []int{13} } func (x *InvoiceMessage) GetNote() string { @@ -5438,7 +5621,7 @@ type InteractiveResponseMessage struct { func (x *InteractiveResponseMessage) Reset() { *x = InteractiveResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[15] + mi := &file_binary_proto_def_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5451,7 +5634,7 @@ func (x *InteractiveResponseMessage) String() string { func (*InteractiveResponseMessage) ProtoMessage() {} func (x *InteractiveResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[15] + mi := &file_binary_proto_def_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5464,7 +5647,7 @@ func (x *InteractiveResponseMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveResponseMessage.ProtoReflect.Descriptor instead. func (*InteractiveResponseMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{15} + return file_binary_proto_def_proto_rawDescGZIP(), []int{14} } func (x *InteractiveResponseMessage) GetBody() *InteractiveResponseMessage_Body { @@ -5526,7 +5709,7 @@ type InteractiveMessage struct { func (x *InteractiveMessage) Reset() { *x = InteractiveMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[16] + mi := &file_binary_proto_def_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5539,7 +5722,7 @@ func (x *InteractiveMessage) String() string { func (*InteractiveMessage) ProtoMessage() {} func (x *InteractiveMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[16] + mi := &file_binary_proto_def_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5552,7 +5735,7 @@ func (x *InteractiveMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveMessage.ProtoReflect.Descriptor instead. func (*InteractiveMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15} } func (x *InteractiveMessage) GetHeader() *InteractiveMessage_Header { @@ -5644,7 +5827,7 @@ type InitialSecurityNotificationSettingSync struct { func (x *InitialSecurityNotificationSettingSync) Reset() { *x = InitialSecurityNotificationSettingSync{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[17] + mi := &file_binary_proto_def_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5657,7 +5840,7 @@ func (x *InitialSecurityNotificationSettingSync) String() string { func (*InitialSecurityNotificationSettingSync) ProtoMessage() {} func (x *InitialSecurityNotificationSettingSync) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[17] + mi := &file_binary_proto_def_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5670,7 +5853,7 @@ func (x *InitialSecurityNotificationSettingSync) ProtoReflect() protoreflect.Mes // Deprecated: Use InitialSecurityNotificationSettingSync.ProtoReflect.Descriptor instead. func (*InitialSecurityNotificationSettingSync) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{17} + return file_binary_proto_def_proto_rawDescGZIP(), []int{16} } func (x *InitialSecurityNotificationSettingSync) GetSecurityNotificationEnabled() bool { @@ -5716,7 +5899,7 @@ type ImageMessage struct { func (x *ImageMessage) Reset() { *x = ImageMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[18] + mi := &file_binary_proto_def_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5729,7 +5912,7 @@ func (x *ImageMessage) String() string { func (*ImageMessage) ProtoMessage() {} func (x *ImageMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[18] + mi := &file_binary_proto_def_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5742,7 +5925,7 @@ func (x *ImageMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ImageMessage.ProtoReflect.Descriptor instead. func (*ImageMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{18} + return file_binary_proto_def_proto_rawDescGZIP(), []int{17} } func (x *ImageMessage) GetUrl() string { @@ -5932,22 +6115,23 @@ type HistorySyncNotification struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FileSha256 []byte `protobuf:"bytes,1,opt,name=fileSha256" json:"fileSha256,omitempty"` - FileLength *uint64 `protobuf:"varint,2,opt,name=fileLength" json:"fileLength,omitempty"` - MediaKey []byte `protobuf:"bytes,3,opt,name=mediaKey" json:"mediaKey,omitempty"` - FileEncSha256 []byte `protobuf:"bytes,4,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` - DirectPath *string `protobuf:"bytes,5,opt,name=directPath" json:"directPath,omitempty"` - SyncType *HistorySyncNotification_HistorySyncType `protobuf:"varint,6,opt,name=syncType,enum=proto.HistorySyncNotification_HistorySyncType" json:"syncType,omitempty"` - ChunkOrder *uint32 `protobuf:"varint,7,opt,name=chunkOrder" json:"chunkOrder,omitempty"` - OriginalMessageId *string `protobuf:"bytes,8,opt,name=originalMessageId" json:"originalMessageId,omitempty"` - Progress *uint32 `protobuf:"varint,9,opt,name=progress" json:"progress,omitempty"` - OldestMsgInChunkTimestampSec *int64 `protobuf:"varint,10,opt,name=oldestMsgInChunkTimestampSec" json:"oldestMsgInChunkTimestampSec,omitempty"` + FileSha256 []byte `protobuf:"bytes,1,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileLength *uint64 `protobuf:"varint,2,opt,name=fileLength" json:"fileLength,omitempty"` + MediaKey []byte `protobuf:"bytes,3,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,4,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + DirectPath *string `protobuf:"bytes,5,opt,name=directPath" json:"directPath,omitempty"` + SyncType *HistorySyncNotification_HistorySyncType `protobuf:"varint,6,opt,name=syncType,enum=proto.HistorySyncNotification_HistorySyncType" json:"syncType,omitempty"` + ChunkOrder *uint32 `protobuf:"varint,7,opt,name=chunkOrder" json:"chunkOrder,omitempty"` + OriginalMessageId *string `protobuf:"bytes,8,opt,name=originalMessageId" json:"originalMessageId,omitempty"` + Progress *uint32 `protobuf:"varint,9,opt,name=progress" json:"progress,omitempty"` + OldestMsgInChunkTimestampSec *int64 `protobuf:"varint,10,opt,name=oldestMsgInChunkTimestampSec" json:"oldestMsgInChunkTimestampSec,omitempty"` + InitialHistBootstrapInlinePayload []byte `protobuf:"bytes,11,opt,name=initialHistBootstrapInlinePayload" json:"initialHistBootstrapInlinePayload,omitempty"` } func (x *HistorySyncNotification) Reset() { *x = HistorySyncNotification{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[19] + mi := &file_binary_proto_def_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5960,7 +6144,7 @@ func (x *HistorySyncNotification) String() string { func (*HistorySyncNotification) ProtoMessage() {} func (x *HistorySyncNotification) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[19] + mi := &file_binary_proto_def_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5973,7 +6157,7 @@ func (x *HistorySyncNotification) ProtoReflect() protoreflect.Message { // Deprecated: Use HistorySyncNotification.ProtoReflect.Descriptor instead. func (*HistorySyncNotification) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{19} + return file_binary_proto_def_proto_rawDescGZIP(), []int{18} } func (x *HistorySyncNotification) GetFileSha256() []byte { @@ -6046,6 +6230,13 @@ func (x *HistorySyncNotification) GetOldestMsgInChunkTimestampSec() int64 { return 0 } +func (x *HistorySyncNotification) GetInitialHistBootstrapInlinePayload() []byte { + if x != nil { + return x.InitialHistBootstrapInlinePayload + } + return nil +} + type HighlyStructuredMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -6065,7 +6256,7 @@ type HighlyStructuredMessage struct { func (x *HighlyStructuredMessage) Reset() { *x = HighlyStructuredMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[20] + mi := &file_binary_proto_def_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6078,7 +6269,7 @@ func (x *HighlyStructuredMessage) String() string { func (*HighlyStructuredMessage) ProtoMessage() {} func (x *HighlyStructuredMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[20] + mi := &file_binary_proto_def_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6091,7 +6282,7 @@ func (x *HighlyStructuredMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use HighlyStructuredMessage.ProtoReflect.Descriptor instead. func (*HighlyStructuredMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19} } func (x *HighlyStructuredMessage) GetNamespace() string { @@ -6175,7 +6366,7 @@ type GroupInviteMessage struct { func (x *GroupInviteMessage) Reset() { *x = GroupInviteMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[21] + mi := &file_binary_proto_def_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6188,7 +6379,7 @@ func (x *GroupInviteMessage) String() string { func (*GroupInviteMessage) ProtoMessage() {} func (x *GroupInviteMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[21] + mi := &file_binary_proto_def_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6201,7 +6392,7 @@ func (x *GroupInviteMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use GroupInviteMessage.ProtoReflect.Descriptor instead. func (*GroupInviteMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{21} + return file_binary_proto_def_proto_rawDescGZIP(), []int{20} } func (x *GroupInviteMessage) GetGroupJid() string { @@ -6271,7 +6462,7 @@ type FutureProofMessage struct { func (x *FutureProofMessage) Reset() { *x = FutureProofMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[22] + mi := &file_binary_proto_def_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6284,7 +6475,7 @@ func (x *FutureProofMessage) String() string { func (*FutureProofMessage) ProtoMessage() {} func (x *FutureProofMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[22] + mi := &file_binary_proto_def_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6297,7 +6488,7 @@ func (x *FutureProofMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use FutureProofMessage.ProtoReflect.Descriptor instead. func (*FutureProofMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{22} + return file_binary_proto_def_proto_rawDescGZIP(), []int{21} } func (x *FutureProofMessage) GetMessage() *Message { @@ -6341,7 +6532,7 @@ type ExtendedTextMessage struct { func (x *ExtendedTextMessage) Reset() { *x = ExtendedTextMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[23] + mi := &file_binary_proto_def_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6354,7 +6545,7 @@ func (x *ExtendedTextMessage) String() string { func (*ExtendedTextMessage) ProtoMessage() {} func (x *ExtendedTextMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[23] + mi := &file_binary_proto_def_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6367,7 +6558,7 @@ func (x *ExtendedTextMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtendedTextMessage.ProtoReflect.Descriptor instead. func (*ExtendedTextMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{23} + return file_binary_proto_def_proto_rawDescGZIP(), []int{22} } func (x *ExtendedTextMessage) GetText() string { @@ -6551,7 +6742,7 @@ type EncReactionMessage struct { func (x *EncReactionMessage) Reset() { *x = EncReactionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[24] + mi := &file_binary_proto_def_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6564,7 +6755,7 @@ func (x *EncReactionMessage) String() string { func (*EncReactionMessage) ProtoMessage() {} func (x *EncReactionMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[24] + mi := &file_binary_proto_def_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6577,7 +6768,7 @@ func (x *EncReactionMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use EncReactionMessage.ProtoReflect.Descriptor instead. func (*EncReactionMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{24} + return file_binary_proto_def_proto_rawDescGZIP(), []int{23} } func (x *EncReactionMessage) GetTargetMessageKey() *MessageKey { @@ -6631,7 +6822,7 @@ type DocumentMessage struct { func (x *DocumentMessage) Reset() { *x = DocumentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[25] + mi := &file_binary_proto_def_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6644,7 +6835,7 @@ func (x *DocumentMessage) String() string { func (*DocumentMessage) ProtoMessage() {} func (x *DocumentMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[25] + mi := &file_binary_proto_def_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6657,7 +6848,7 @@ func (x *DocumentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DocumentMessage.ProtoReflect.Descriptor instead. func (*DocumentMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{25} + return file_binary_proto_def_proto_rawDescGZIP(), []int{24} } func (x *DocumentMessage) GetUrl() string { @@ -6813,7 +7004,7 @@ type DeviceSentMessage struct { func (x *DeviceSentMessage) Reset() { *x = DeviceSentMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[26] + mi := &file_binary_proto_def_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6826,7 +7017,7 @@ func (x *DeviceSentMessage) String() string { func (*DeviceSentMessage) ProtoMessage() {} func (x *DeviceSentMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[26] + mi := &file_binary_proto_def_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6839,7 +7030,7 @@ func (x *DeviceSentMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DeviceSentMessage.ProtoReflect.Descriptor instead. func (*DeviceSentMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{26} + return file_binary_proto_def_proto_rawDescGZIP(), []int{25} } func (x *DeviceSentMessage) GetDestinationJid() string { @@ -6874,7 +7065,7 @@ type DeclinePaymentRequestMessage struct { func (x *DeclinePaymentRequestMessage) Reset() { *x = DeclinePaymentRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[27] + mi := &file_binary_proto_def_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6887,7 +7078,7 @@ func (x *DeclinePaymentRequestMessage) String() string { func (*DeclinePaymentRequestMessage) ProtoMessage() {} func (x *DeclinePaymentRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[27] + mi := &file_binary_proto_def_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6900,7 +7091,7 @@ func (x *DeclinePaymentRequestMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DeclinePaymentRequestMessage.ProtoReflect.Descriptor instead. func (*DeclinePaymentRequestMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{27} + return file_binary_proto_def_proto_rawDescGZIP(), []int{26} } func (x *DeclinePaymentRequestMessage) GetKey() *MessageKey { @@ -6923,7 +7114,7 @@ type ContactsArrayMessage struct { func (x *ContactsArrayMessage) Reset() { *x = ContactsArrayMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[28] + mi := &file_binary_proto_def_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6936,7 +7127,7 @@ func (x *ContactsArrayMessage) String() string { func (*ContactsArrayMessage) ProtoMessage() {} func (x *ContactsArrayMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[28] + mi := &file_binary_proto_def_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6949,7 +7140,7 @@ func (x *ContactsArrayMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ContactsArrayMessage.ProtoReflect.Descriptor instead. func (*ContactsArrayMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{28} + return file_binary_proto_def_proto_rawDescGZIP(), []int{27} } func (x *ContactsArrayMessage) GetDisplayName() string { @@ -6973,6 +7164,69 @@ func (x *ContactsArrayMessage) GetContextInfo() *ContextInfo { return nil } +type ContactMessageV2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayName *string `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"` + Vcard *string `protobuf:"bytes,2,opt,name=vcard" json:"vcard,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,3,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *ContactMessageV2) Reset() { + *x = ContactMessageV2{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContactMessageV2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContactMessageV2) ProtoMessage() {} + +func (x *ContactMessageV2) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContactMessageV2.ProtoReflect.Descriptor instead. +func (*ContactMessageV2) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{28} +} + +func (x *ContactMessageV2) GetDisplayName() string { + if x != nil && x.DisplayName != nil { + return *x.DisplayName + } + return "" +} + +func (x *ContactMessageV2) GetVcard() string { + if x != nil && x.Vcard != nil { + return *x.Vcard + } + return "" +} + +func (x *ContactMessageV2) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + type ContactMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7482,6 +7736,7 @@ type AudioMessage struct { StreamingSidecar []byte `protobuf:"bytes,18,opt,name=streamingSidecar" json:"streamingSidecar,omitempty"` Waveform []byte `protobuf:"bytes,19,opt,name=waveform" json:"waveform,omitempty"` BackgroundArgb *uint32 `protobuf:"fixed32,20,opt,name=backgroundArgb" json:"backgroundArgb,omitempty"` + ViewOnce *bool `protobuf:"varint,21,opt,name=viewOnce" json:"viewOnce,omitempty"` } func (x *AudioMessage) Reset() { @@ -7614,6 +7869,13 @@ func (x *AudioMessage) GetBackgroundArgb() uint32 { return 0 } +func (x *AudioMessage) GetViewOnce() bool { + if x != nil && x.ViewOnce != nil { + return *x.ViewOnce + } + return false +} + type AppStateSyncKey struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -9155,6 +9417,7 @@ type Message struct { PinMessage *PinMessage `protobuf:"bytes,63,opt,name=pinMessage" json:"pinMessage,omitempty"` PollCreationMessageV3 *PollCreationMessage `protobuf:"bytes,64,opt,name=pollCreationMessageV3" json:"pollCreationMessageV3,omitempty"` ScheduledCallEditMessage *ScheduledCallEditMessage `protobuf:"bytes,65,opt,name=scheduledCallEditMessage" json:"scheduledCallEditMessage,omitempty"` + PtvMessage *VideoMessage `protobuf:"bytes,66,opt,name=ptvMessage" json:"ptvMessage,omitempty"` } func (x *Message) Reset() { @@ -9574,15 +9837,23 @@ func (x *Message) GetScheduledCallEditMessage() *ScheduledCallEditMessage { return nil } +func (x *Message) GetPtvMessage() *VideoMessage { + if x != nil { + return x.PtvMessage + } + return nil +} + type MessageContextInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - DeviceListMetadata *DeviceListMetadata `protobuf:"bytes,1,opt,name=deviceListMetadata" json:"deviceListMetadata,omitempty"` - DeviceListMetadataVersion *int32 `protobuf:"varint,2,opt,name=deviceListMetadataVersion" json:"deviceListMetadataVersion,omitempty"` - MessageSecret []byte `protobuf:"bytes,3,opt,name=messageSecret" json:"messageSecret,omitempty"` - PaddingBytes []byte `protobuf:"bytes,4,opt,name=paddingBytes" json:"paddingBytes,omitempty"` + DeviceListMetadata *DeviceListMetadata `protobuf:"bytes,1,opt,name=deviceListMetadata" json:"deviceListMetadata,omitempty"` + DeviceListMetadataVersion *int32 `protobuf:"varint,2,opt,name=deviceListMetadataVersion" json:"deviceListMetadataVersion,omitempty"` + MessageSecret []byte `protobuf:"bytes,3,opt,name=messageSecret" json:"messageSecret,omitempty"` + PaddingBytes []byte `protobuf:"bytes,4,opt,name=paddingBytes" json:"paddingBytes,omitempty"` + MessageAddOnDurationInSecs *uint32 `protobuf:"varint,5,opt,name=messageAddOnDurationInSecs" json:"messageAddOnDurationInSecs,omitempty"` } func (x *MessageContextInfo) Reset() { @@ -9645,6 +9916,13 @@ func (x *MessageContextInfo) GetPaddingBytes() []byte { return nil } +func (x *MessageContextInfo) GetMessageAddOnDurationInSecs() uint32 { + if x != nil && x.MessageAddOnDurationInSecs != nil { + return *x.MessageAddOnDurationInSecs + } + return 0 +} + type VideoMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11399,6 +11677,85 @@ func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationResult() [ return nil } +type PeerDataOperationRequestMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerDataOperationRequestType *PeerDataOperationRequestType `protobuf:"varint,1,opt,name=peerDataOperationRequestType,enum=proto.PeerDataOperationRequestType" json:"peerDataOperationRequestType,omitempty"` + RequestStickerReupload []*PeerDataOperationRequestMessage_RequestStickerReupload `protobuf:"bytes,2,rep,name=requestStickerReupload" json:"requestStickerReupload,omitempty"` + RequestUrlPreview []*PeerDataOperationRequestMessage_RequestUrlPreview `protobuf:"bytes,3,rep,name=requestUrlPreview" json:"requestUrlPreview,omitempty"` + HistorySyncOnDemandRequest *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest `protobuf:"bytes,4,opt,name=historySyncOnDemandRequest" json:"historySyncOnDemandRequest,omitempty"` + PlaceholderMessageResendRequest []*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest `protobuf:"bytes,5,rep,name=placeholderMessageResendRequest" json:"placeholderMessageResendRequest,omitempty"` +} + +func (x *PeerDataOperationRequestMessage) Reset() { + *x = PeerDataOperationRequestMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[78] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[78] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{78} +} + +func (x *PeerDataOperationRequestMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { + if x != nil && x.PeerDataOperationRequestType != nil { + return *x.PeerDataOperationRequestType + } + return PeerDataOperationRequestType_UPLOAD_STICKER +} + +func (x *PeerDataOperationRequestMessage) GetRequestStickerReupload() []*PeerDataOperationRequestMessage_RequestStickerReupload { + if x != nil { + return x.RequestStickerReupload + } + return nil +} + +func (x *PeerDataOperationRequestMessage) GetRequestUrlPreview() []*PeerDataOperationRequestMessage_RequestUrlPreview { + if x != nil { + return x.RequestUrlPreview + } + return nil +} + +func (x *PeerDataOperationRequestMessage) GetHistorySyncOnDemandRequest() *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest { + if x != nil { + return x.HistorySyncOnDemandRequest + } + return nil +} + +func (x *PeerDataOperationRequestMessage) GetPlaceholderMessageResendRequest() []*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest { + if x != nil { + return x.PlaceholderMessageResendRequest + } + return nil +} + type EphemeralSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11411,7 +11768,7 @@ type EphemeralSetting struct { func (x *EphemeralSetting) Reset() { *x = EphemeralSetting{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[78] + mi := &file_binary_proto_def_proto_msgTypes[79] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11424,7 +11781,7 @@ func (x *EphemeralSetting) String() string { func (*EphemeralSetting) ProtoMessage() {} func (x *EphemeralSetting) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[78] + mi := &file_binary_proto_def_proto_msgTypes[79] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11437,7 +11794,7 @@ func (x *EphemeralSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use EphemeralSetting.ProtoReflect.Descriptor instead. func (*EphemeralSetting) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{78} + return file_binary_proto_def_proto_rawDescGZIP(), []int{79} } func (x *EphemeralSetting) GetDuration() int32 { @@ -11466,7 +11823,7 @@ type WallpaperSettings struct { func (x *WallpaperSettings) Reset() { *x = WallpaperSettings{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[79] + mi := &file_binary_proto_def_proto_msgTypes[80] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11479,7 +11836,7 @@ func (x *WallpaperSettings) String() string { func (*WallpaperSettings) ProtoMessage() {} func (x *WallpaperSettings) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[79] + mi := &file_binary_proto_def_proto_msgTypes[80] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11492,7 +11849,7 @@ func (x *WallpaperSettings) ProtoReflect() protoreflect.Message { // Deprecated: Use WallpaperSettings.ProtoReflect.Descriptor instead. func (*WallpaperSettings) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{79} + return file_binary_proto_def_proto_rawDescGZIP(), []int{80} } func (x *WallpaperSettings) GetFilename() string { @@ -11530,7 +11887,7 @@ type StickerMetadata struct { func (x *StickerMetadata) Reset() { *x = StickerMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[80] + mi := &file_binary_proto_def_proto_msgTypes[81] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11543,7 +11900,7 @@ func (x *StickerMetadata) String() string { func (*StickerMetadata) ProtoMessage() {} func (x *StickerMetadata) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[80] + mi := &file_binary_proto_def_proto_msgTypes[81] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11556,7 +11913,7 @@ func (x *StickerMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use StickerMetadata.ProtoReflect.Descriptor instead. func (*StickerMetadata) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{80} + return file_binary_proto_def_proto_rawDescGZIP(), []int{81} } func (x *StickerMetadata) GetUrl() string { @@ -11648,7 +12005,7 @@ type Pushname struct { func (x *Pushname) Reset() { *x = Pushname{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[81] + mi := &file_binary_proto_def_proto_msgTypes[82] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11661,7 +12018,7 @@ func (x *Pushname) String() string { func (*Pushname) ProtoMessage() {} func (x *Pushname) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[81] + mi := &file_binary_proto_def_proto_msgTypes[82] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11674,7 +12031,7 @@ func (x *Pushname) ProtoReflect() protoreflect.Message { // Deprecated: Use Pushname.ProtoReflect.Descriptor instead. func (*Pushname) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{81} + return file_binary_proto_def_proto_rawDescGZIP(), []int{82} } func (x *Pushname) GetId() string { @@ -11703,7 +12060,7 @@ type PastParticipants struct { func (x *PastParticipants) Reset() { *x = PastParticipants{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[82] + mi := &file_binary_proto_def_proto_msgTypes[83] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11716,7 +12073,7 @@ func (x *PastParticipants) String() string { func (*PastParticipants) ProtoMessage() {} func (x *PastParticipants) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[82] + mi := &file_binary_proto_def_proto_msgTypes[83] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11729,7 +12086,7 @@ func (x *PastParticipants) ProtoReflect() protoreflect.Message { // Deprecated: Use PastParticipants.ProtoReflect.Descriptor instead. func (*PastParticipants) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{82} + return file_binary_proto_def_proto_rawDescGZIP(), []int{83} } func (x *PastParticipants) GetGroupJid() string { @@ -11759,7 +12116,7 @@ type PastParticipant struct { func (x *PastParticipant) Reset() { *x = PastParticipant{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[83] + mi := &file_binary_proto_def_proto_msgTypes[84] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11772,7 +12129,7 @@ func (x *PastParticipant) String() string { func (*PastParticipant) ProtoMessage() {} func (x *PastParticipant) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[83] + mi := &file_binary_proto_def_proto_msgTypes[84] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11785,7 +12142,7 @@ func (x *PastParticipant) ProtoReflect() protoreflect.Message { // Deprecated: Use PastParticipant.ProtoReflect.Descriptor instead. func (*PastParticipant) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{83} + return file_binary_proto_def_proto_rawDescGZIP(), []int{84} } func (x *PastParticipant) GetUserJid() string { @@ -11809,6 +12166,93 @@ func (x *PastParticipant) GetLeaveTs() uint64 { return 0 } +type NotificationSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageVibrate *string `protobuf:"bytes,1,opt,name=messageVibrate" json:"messageVibrate,omitempty"` + MessagePopup *string `protobuf:"bytes,2,opt,name=messagePopup" json:"messagePopup,omitempty"` + MessageLight *string `protobuf:"bytes,3,opt,name=messageLight" json:"messageLight,omitempty"` + LowPriorityNotifications *bool `protobuf:"varint,4,opt,name=lowPriorityNotifications" json:"lowPriorityNotifications,omitempty"` + ReactionsMuted *bool `protobuf:"varint,5,opt,name=reactionsMuted" json:"reactionsMuted,omitempty"` + CallVibrate *string `protobuf:"bytes,6,opt,name=callVibrate" json:"callVibrate,omitempty"` +} + +func (x *NotificationSettings) Reset() { + *x = NotificationSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[85] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationSettings) ProtoMessage() {} + +func (x *NotificationSettings) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[85] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationSettings.ProtoReflect.Descriptor instead. +func (*NotificationSettings) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{85} +} + +func (x *NotificationSettings) GetMessageVibrate() string { + if x != nil && x.MessageVibrate != nil { + return *x.MessageVibrate + } + return "" +} + +func (x *NotificationSettings) GetMessagePopup() string { + if x != nil && x.MessagePopup != nil { + return *x.MessagePopup + } + return "" +} + +func (x *NotificationSettings) GetMessageLight() string { + if x != nil && x.MessageLight != nil { + return *x.MessageLight + } + return "" +} + +func (x *NotificationSettings) GetLowPriorityNotifications() bool { + if x != nil && x.LowPriorityNotifications != nil { + return *x.LowPriorityNotifications + } + return false +} + +func (x *NotificationSettings) GetReactionsMuted() bool { + if x != nil && x.ReactionsMuted != nil { + return *x.ReactionsMuted + } + return false +} + +func (x *NotificationSettings) GetCallVibrate() string { + if x != nil && x.CallVibrate != nil { + return *x.CallVibrate + } + return "" +} + type HistorySync struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11830,7 +12274,7 @@ type HistorySync struct { func (x *HistorySync) Reset() { *x = HistorySync{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[84] + mi := &file_binary_proto_def_proto_msgTypes[86] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11843,7 +12287,7 @@ func (x *HistorySync) String() string { func (*HistorySync) ProtoMessage() {} func (x *HistorySync) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[84] + mi := &file_binary_proto_def_proto_msgTypes[86] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11856,7 +12300,7 @@ func (x *HistorySync) ProtoReflect() protoreflect.Message { // Deprecated: Use HistorySync.ProtoReflect.Descriptor instead. func (*HistorySync) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{84} + return file_binary_proto_def_proto_rawDescGZIP(), []int{86} } func (x *HistorySync) GetSyncType() HistorySync_HistorySyncType { @@ -11948,7 +12392,7 @@ type HistorySyncMsg struct { func (x *HistorySyncMsg) Reset() { *x = HistorySyncMsg{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[85] + mi := &file_binary_proto_def_proto_msgTypes[87] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -11961,7 +12405,7 @@ func (x *HistorySyncMsg) String() string { func (*HistorySyncMsg) ProtoMessage() {} func (x *HistorySyncMsg) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[85] + mi := &file_binary_proto_def_proto_msgTypes[87] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -11974,7 +12418,7 @@ func (x *HistorySyncMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use HistorySyncMsg.ProtoReflect.Descriptor instead. func (*HistorySyncMsg) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{85} + return file_binary_proto_def_proto_rawDescGZIP(), []int{87} } func (x *HistorySyncMsg) GetMessage() *WebMessageInfo { @@ -12003,7 +12447,7 @@ type GroupParticipant struct { func (x *GroupParticipant) Reset() { *x = GroupParticipant{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[86] + mi := &file_binary_proto_def_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12016,7 +12460,7 @@ func (x *GroupParticipant) String() string { func (*GroupParticipant) ProtoMessage() {} func (x *GroupParticipant) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[86] + mi := &file_binary_proto_def_proto_msgTypes[88] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12029,7 +12473,7 @@ func (x *GroupParticipant) ProtoReflect() protoreflect.Message { // Deprecated: Use GroupParticipant.ProtoReflect.Descriptor instead. func (*GroupParticipant) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{86} + return file_binary_proto_def_proto_rawDescGZIP(), []int{88} } func (x *GroupParticipant) GetUserJid() string { @@ -12062,12 +12506,19 @@ type GlobalSettings struct { DisappearingModeDuration *int32 `protobuf:"varint,9,opt,name=disappearingModeDuration" json:"disappearingModeDuration,omitempty"` DisappearingModeTimestamp *int64 `protobuf:"varint,10,opt,name=disappearingModeTimestamp" json:"disappearingModeTimestamp,omitempty"` AvatarUserSettings *AvatarUserSettings `protobuf:"bytes,11,opt,name=avatarUserSettings" json:"avatarUserSettings,omitempty"` + FontSize *int32 `protobuf:"varint,12,opt,name=fontSize" json:"fontSize,omitempty"` + SecurityNotifications *bool `protobuf:"varint,13,opt,name=securityNotifications" json:"securityNotifications,omitempty"` + AutoUnarchiveChats *bool `protobuf:"varint,14,opt,name=autoUnarchiveChats" json:"autoUnarchiveChats,omitempty"` + VideoQualityMode *int32 `protobuf:"varint,15,opt,name=videoQualityMode" json:"videoQualityMode,omitempty"` + PhotoQualityMode *int32 `protobuf:"varint,16,opt,name=photoQualityMode" json:"photoQualityMode,omitempty"` + IndividualNotificationSettings *NotificationSettings `protobuf:"bytes,17,opt,name=individualNotificationSettings" json:"individualNotificationSettings,omitempty"` + GroupNotificationSettings *NotificationSettings `protobuf:"bytes,18,opt,name=groupNotificationSettings" json:"groupNotificationSettings,omitempty"` } func (x *GlobalSettings) Reset() { *x = GlobalSettings{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[87] + mi := &file_binary_proto_def_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12080,7 +12531,7 @@ func (x *GlobalSettings) String() string { func (*GlobalSettings) ProtoMessage() {} func (x *GlobalSettings) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[87] + mi := &file_binary_proto_def_proto_msgTypes[89] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12093,7 +12544,7 @@ func (x *GlobalSettings) ProtoReflect() protoreflect.Message { // Deprecated: Use GlobalSettings.ProtoReflect.Descriptor instead. func (*GlobalSettings) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{87} + return file_binary_proto_def_proto_rawDescGZIP(), []int{89} } func (x *GlobalSettings) GetLightThemeWallpaper() *WallpaperSettings { @@ -12173,6 +12624,55 @@ func (x *GlobalSettings) GetAvatarUserSettings() *AvatarUserSettings { return nil } +func (x *GlobalSettings) GetFontSize() int32 { + if x != nil && x.FontSize != nil { + return *x.FontSize + } + return 0 +} + +func (x *GlobalSettings) GetSecurityNotifications() bool { + if x != nil && x.SecurityNotifications != nil { + return *x.SecurityNotifications + } + return false +} + +func (x *GlobalSettings) GetAutoUnarchiveChats() bool { + if x != nil && x.AutoUnarchiveChats != nil { + return *x.AutoUnarchiveChats + } + return false +} + +func (x *GlobalSettings) GetVideoQualityMode() int32 { + if x != nil && x.VideoQualityMode != nil { + return *x.VideoQualityMode + } + return 0 +} + +func (x *GlobalSettings) GetPhotoQualityMode() int32 { + if x != nil && x.PhotoQualityMode != nil { + return *x.PhotoQualityMode + } + return 0 +} + +func (x *GlobalSettings) GetIndividualNotificationSettings() *NotificationSettings { + if x != nil { + return x.IndividualNotificationSettings + } + return nil +} + +func (x *GlobalSettings) GetGroupNotificationSettings() *NotificationSettings { + if x != nil { + return x.GroupNotificationSettings + } + return nil +} + type Conversation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -12213,8 +12713,8 @@ type Conversation struct { Description *string `protobuf:"bytes,33,opt,name=description" json:"description,omitempty"` Support *bool `protobuf:"varint,34,opt,name=support" json:"support,omitempty"` IsParentGroup *bool `protobuf:"varint,35,opt,name=isParentGroup" json:"isParentGroup,omitempty"` - IsDefaultSubgroup *bool `protobuf:"varint,36,opt,name=isDefaultSubgroup" json:"isDefaultSubgroup,omitempty"` ParentGroupId *string `protobuf:"bytes,37,opt,name=parentGroupId" json:"parentGroupId,omitempty"` + IsDefaultSubgroup *bool `protobuf:"varint,36,opt,name=isDefaultSubgroup" json:"isDefaultSubgroup,omitempty"` DisplayName *string `protobuf:"bytes,38,opt,name=displayName" json:"displayName,omitempty"` PnJid *string `protobuf:"bytes,39,opt,name=pnJid" json:"pnJid,omitempty"` ShareOwnPn *bool `protobuf:"varint,40,opt,name=shareOwnPn" json:"shareOwnPn,omitempty"` @@ -12225,7 +12725,7 @@ type Conversation struct { func (x *Conversation) Reset() { *x = Conversation{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[88] + mi := &file_binary_proto_def_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12238,7 +12738,7 @@ func (x *Conversation) String() string { func (*Conversation) ProtoMessage() {} func (x *Conversation) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[88] + mi := &file_binary_proto_def_proto_msgTypes[90] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12251,7 +12751,7 @@ func (x *Conversation) ProtoReflect() protoreflect.Message { // Deprecated: Use Conversation.ProtoReflect.Descriptor instead. func (*Conversation) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{88} + return file_binary_proto_def_proto_rawDescGZIP(), []int{90} } func (x *Conversation) GetId() string { @@ -12499,13 +12999,6 @@ func (x *Conversation) GetIsParentGroup() bool { return false } -func (x *Conversation) GetIsDefaultSubgroup() bool { - if x != nil && x.IsDefaultSubgroup != nil { - return *x.IsDefaultSubgroup - } - return false -} - func (x *Conversation) GetParentGroupId() string { if x != nil && x.ParentGroupId != nil { return *x.ParentGroupId @@ -12513,6 +13006,13 @@ func (x *Conversation) GetParentGroupId() string { return "" } +func (x *Conversation) GetIsDefaultSubgroup() bool { + if x != nil && x.IsDefaultSubgroup != nil { + return *x.IsDefaultSubgroup + } + return false +} + func (x *Conversation) GetDisplayName() string { if x != nil && x.DisplayName != nil { return *x.DisplayName @@ -12560,7 +13060,7 @@ type AvatarUserSettings struct { func (x *AvatarUserSettings) Reset() { *x = AvatarUserSettings{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[89] + mi := &file_binary_proto_def_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12573,7 +13073,7 @@ func (x *AvatarUserSettings) String() string { func (*AvatarUserSettings) ProtoMessage() {} func (x *AvatarUserSettings) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[89] + mi := &file_binary_proto_def_proto_msgTypes[91] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12586,7 +13086,7 @@ func (x *AvatarUserSettings) ProtoReflect() protoreflect.Message { // Deprecated: Use AvatarUserSettings.ProtoReflect.Descriptor instead. func (*AvatarUserSettings) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{89} + return file_binary_proto_def_proto_rawDescGZIP(), []int{91} } func (x *AvatarUserSettings) GetFbid() string { @@ -12617,7 +13117,7 @@ type AutoDownloadSettings struct { func (x *AutoDownloadSettings) Reset() { *x = AutoDownloadSettings{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[90] + mi := &file_binary_proto_def_proto_msgTypes[92] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12630,7 +13130,7 @@ func (x *AutoDownloadSettings) String() string { func (*AutoDownloadSettings) ProtoMessage() {} func (x *AutoDownloadSettings) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[90] + mi := &file_binary_proto_def_proto_msgTypes[92] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12643,7 +13143,7 @@ func (x *AutoDownloadSettings) ProtoReflect() protoreflect.Message { // Deprecated: Use AutoDownloadSettings.ProtoReflect.Descriptor instead. func (*AutoDownloadSettings) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{90} + return file_binary_proto_def_proto_rawDescGZIP(), []int{92} } func (x *AutoDownloadSettings) GetDownloadImages() bool { @@ -12686,7 +13186,7 @@ type MsgRowOpaqueData struct { func (x *MsgRowOpaqueData) Reset() { *x = MsgRowOpaqueData{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[91] + mi := &file_binary_proto_def_proto_msgTypes[93] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12699,7 +13199,7 @@ func (x *MsgRowOpaqueData) String() string { func (*MsgRowOpaqueData) ProtoMessage() {} func (x *MsgRowOpaqueData) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[91] + mi := &file_binary_proto_def_proto_msgTypes[93] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12712,7 +13212,7 @@ func (x *MsgRowOpaqueData) ProtoReflect() protoreflect.Message { // Deprecated: Use MsgRowOpaqueData.ProtoReflect.Descriptor instead. func (*MsgRowOpaqueData) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{91} + return file_binary_proto_def_proto_rawDescGZIP(), []int{93} } func (x *MsgRowOpaqueData) GetCurrentMsg() *MsgOpaqueData { @@ -12765,7 +13265,7 @@ type MsgOpaqueData struct { func (x *MsgOpaqueData) Reset() { *x = MsgOpaqueData{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[92] + mi := &file_binary_proto_def_proto_msgTypes[94] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -12778,7 +13278,7 @@ func (x *MsgOpaqueData) String() string { func (*MsgOpaqueData) ProtoMessage() {} func (x *MsgOpaqueData) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[92] + mi := &file_binary_proto_def_proto_msgTypes[94] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -12791,7 +13291,7 @@ func (x *MsgOpaqueData) ProtoReflect() protoreflect.Message { // Deprecated: Use MsgOpaqueData.ProtoReflect.Descriptor instead. func (*MsgOpaqueData) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{92} + return file_binary_proto_def_proto_rawDescGZIP(), []int{94} } func (x *MsgOpaqueData) GetBody() string { @@ -12987,7 +13487,7 @@ type ServerErrorReceipt struct { func (x *ServerErrorReceipt) Reset() { *x = ServerErrorReceipt{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[93] + mi := &file_binary_proto_def_proto_msgTypes[95] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13000,7 +13500,7 @@ func (x *ServerErrorReceipt) String() string { func (*ServerErrorReceipt) ProtoMessage() {} func (x *ServerErrorReceipt) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[93] + mi := &file_binary_proto_def_proto_msgTypes[95] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13013,7 +13513,7 @@ func (x *ServerErrorReceipt) ProtoReflect() protoreflect.Message { // Deprecated: Use ServerErrorReceipt.ProtoReflect.Descriptor instead. func (*ServerErrorReceipt) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{93} + return file_binary_proto_def_proto_rawDescGZIP(), []int{95} } func (x *ServerErrorReceipt) GetStanzaId() string { @@ -13036,7 +13536,7 @@ type MediaRetryNotification struct { func (x *MediaRetryNotification) Reset() { *x = MediaRetryNotification{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[94] + mi := &file_binary_proto_def_proto_msgTypes[96] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13049,7 +13549,7 @@ func (x *MediaRetryNotification) String() string { func (*MediaRetryNotification) ProtoMessage() {} func (x *MediaRetryNotification) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[94] + mi := &file_binary_proto_def_proto_msgTypes[96] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13062,7 +13562,7 @@ func (x *MediaRetryNotification) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaRetryNotification.ProtoReflect.Descriptor instead. func (*MediaRetryNotification) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{94} + return file_binary_proto_def_proto_rawDescGZIP(), []int{96} } func (x *MediaRetryNotification) GetStanzaId() string { @@ -13100,7 +13600,7 @@ type MessageKey struct { func (x *MessageKey) Reset() { *x = MessageKey{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[95] + mi := &file_binary_proto_def_proto_msgTypes[97] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13113,7 +13613,7 @@ func (x *MessageKey) String() string { func (*MessageKey) ProtoMessage() {} func (x *MessageKey) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[95] + mi := &file_binary_proto_def_proto_msgTypes[97] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13126,7 +13626,7 @@ func (x *MessageKey) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageKey.ProtoReflect.Descriptor instead. func (*MessageKey) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{95} + return file_binary_proto_def_proto_rawDescGZIP(), []int{97} } func (x *MessageKey) GetRemoteJid() string { @@ -13168,7 +13668,7 @@ type SyncdVersion struct { func (x *SyncdVersion) Reset() { *x = SyncdVersion{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[96] + mi := &file_binary_proto_def_proto_msgTypes[98] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13181,7 +13681,7 @@ func (x *SyncdVersion) String() string { func (*SyncdVersion) ProtoMessage() {} func (x *SyncdVersion) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[96] + mi := &file_binary_proto_def_proto_msgTypes[98] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13194,7 +13694,7 @@ func (x *SyncdVersion) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdVersion.ProtoReflect.Descriptor instead. func (*SyncdVersion) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{96} + return file_binary_proto_def_proto_rawDescGZIP(), []int{98} } func (x *SyncdVersion) GetVersion() uint64 { @@ -13215,7 +13715,7 @@ type SyncdValue struct { func (x *SyncdValue) Reset() { *x = SyncdValue{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[97] + mi := &file_binary_proto_def_proto_msgTypes[99] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13228,7 +13728,7 @@ func (x *SyncdValue) String() string { func (*SyncdValue) ProtoMessage() {} func (x *SyncdValue) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[97] + mi := &file_binary_proto_def_proto_msgTypes[99] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13241,7 +13741,7 @@ func (x *SyncdValue) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdValue.ProtoReflect.Descriptor instead. func (*SyncdValue) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{97} + return file_binary_proto_def_proto_rawDescGZIP(), []int{99} } func (x *SyncdValue) GetBlob() []byte { @@ -13265,7 +13765,7 @@ type SyncdSnapshot struct { func (x *SyncdSnapshot) Reset() { *x = SyncdSnapshot{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[98] + mi := &file_binary_proto_def_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13278,7 +13778,7 @@ func (x *SyncdSnapshot) String() string { func (*SyncdSnapshot) ProtoMessage() {} func (x *SyncdSnapshot) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[98] + mi := &file_binary_proto_def_proto_msgTypes[100] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13291,7 +13791,7 @@ func (x *SyncdSnapshot) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdSnapshot.ProtoReflect.Descriptor instead. func (*SyncdSnapshot) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{98} + return file_binary_proto_def_proto_rawDescGZIP(), []int{100} } func (x *SyncdSnapshot) GetVersion() *SyncdVersion { @@ -13335,7 +13835,7 @@ type SyncdRecord struct { func (x *SyncdRecord) Reset() { *x = SyncdRecord{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[99] + mi := &file_binary_proto_def_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13348,7 +13848,7 @@ func (x *SyncdRecord) String() string { func (*SyncdRecord) ProtoMessage() {} func (x *SyncdRecord) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[99] + mi := &file_binary_proto_def_proto_msgTypes[101] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13361,7 +13861,7 @@ func (x *SyncdRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdRecord.ProtoReflect.Descriptor instead. func (*SyncdRecord) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{99} + return file_binary_proto_def_proto_rawDescGZIP(), []int{101} } func (x *SyncdRecord) GetIndex() *SyncdIndex { @@ -13403,7 +13903,7 @@ type SyncdPatch struct { func (x *SyncdPatch) Reset() { *x = SyncdPatch{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[100] + mi := &file_binary_proto_def_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13416,7 +13916,7 @@ func (x *SyncdPatch) String() string { func (*SyncdPatch) ProtoMessage() {} func (x *SyncdPatch) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[100] + mi := &file_binary_proto_def_proto_msgTypes[102] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13429,7 +13929,7 @@ func (x *SyncdPatch) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdPatch.ProtoReflect.Descriptor instead. func (*SyncdPatch) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{100} + return file_binary_proto_def_proto_rawDescGZIP(), []int{102} } func (x *SyncdPatch) GetVersion() *SyncdVersion { @@ -13499,7 +13999,7 @@ type SyncdMutations struct { func (x *SyncdMutations) Reset() { *x = SyncdMutations{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[101] + mi := &file_binary_proto_def_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13512,7 +14012,7 @@ func (x *SyncdMutations) String() string { func (*SyncdMutations) ProtoMessage() {} func (x *SyncdMutations) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[101] + mi := &file_binary_proto_def_proto_msgTypes[103] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13525,7 +14025,7 @@ func (x *SyncdMutations) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdMutations.ProtoReflect.Descriptor instead. func (*SyncdMutations) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{101} + return file_binary_proto_def_proto_rawDescGZIP(), []int{103} } func (x *SyncdMutations) GetMutations() []*SyncdMutation { @@ -13547,7 +14047,7 @@ type SyncdMutation struct { func (x *SyncdMutation) Reset() { *x = SyncdMutation{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[102] + mi := &file_binary_proto_def_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13560,7 +14060,7 @@ func (x *SyncdMutation) String() string { func (*SyncdMutation) ProtoMessage() {} func (x *SyncdMutation) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[102] + mi := &file_binary_proto_def_proto_msgTypes[104] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13573,7 +14073,7 @@ func (x *SyncdMutation) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdMutation.ProtoReflect.Descriptor instead. func (*SyncdMutation) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{102} + return file_binary_proto_def_proto_rawDescGZIP(), []int{104} } func (x *SyncdMutation) GetOperation() SyncdMutation_SyncdOperation { @@ -13601,7 +14101,7 @@ type SyncdIndex struct { func (x *SyncdIndex) Reset() { *x = SyncdIndex{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[103] + mi := &file_binary_proto_def_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13614,7 +14114,7 @@ func (x *SyncdIndex) String() string { func (*SyncdIndex) ProtoMessage() {} func (x *SyncdIndex) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[103] + mi := &file_binary_proto_def_proto_msgTypes[105] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13627,7 +14127,7 @@ func (x *SyncdIndex) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncdIndex.ProtoReflect.Descriptor instead. func (*SyncdIndex) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{103} + return file_binary_proto_def_proto_rawDescGZIP(), []int{105} } func (x *SyncdIndex) GetBlob() []byte { @@ -13648,7 +14148,7 @@ type KeyId struct { func (x *KeyId) Reset() { *x = KeyId{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[104] + mi := &file_binary_proto_def_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13661,7 +14161,7 @@ func (x *KeyId) String() string { func (*KeyId) ProtoMessage() {} func (x *KeyId) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[104] + mi := &file_binary_proto_def_proto_msgTypes[106] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13674,7 +14174,7 @@ func (x *KeyId) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyId.ProtoReflect.Descriptor instead. func (*KeyId) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{104} + return file_binary_proto_def_proto_rawDescGZIP(), []int{106} } func (x *KeyId) GetId() []byte { @@ -13700,7 +14200,7 @@ type ExternalBlobReference struct { func (x *ExternalBlobReference) Reset() { *x = ExternalBlobReference{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[105] + mi := &file_binary_proto_def_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13713,7 +14213,7 @@ func (x *ExternalBlobReference) String() string { func (*ExternalBlobReference) ProtoMessage() {} func (x *ExternalBlobReference) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[105] + mi := &file_binary_proto_def_proto_msgTypes[107] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13726,7 +14226,7 @@ func (x *ExternalBlobReference) ProtoReflect() protoreflect.Message { // Deprecated: Use ExternalBlobReference.ProtoReflect.Descriptor instead. func (*ExternalBlobReference) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{105} + return file_binary_proto_def_proto_rawDescGZIP(), []int{107} } func (x *ExternalBlobReference) GetMediaKey() []byte { @@ -13783,7 +14283,7 @@ type ExitCode struct { func (x *ExitCode) Reset() { *x = ExitCode{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[106] + mi := &file_binary_proto_def_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13796,7 +14296,7 @@ func (x *ExitCode) String() string { func (*ExitCode) ProtoMessage() {} func (x *ExitCode) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[106] + mi := &file_binary_proto_def_proto_msgTypes[108] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13809,7 +14309,7 @@ func (x *ExitCode) ProtoReflect() protoreflect.Message { // Deprecated: Use ExitCode.ProtoReflect.Descriptor instead. func (*ExitCode) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{106} + return file_binary_proto_def_proto_rawDescGZIP(), []int{108} } func (x *ExitCode) GetCode() uint64 { @@ -13831,44 +14331,48 @@ type SyncActionValue struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` - StarAction *StarAction `protobuf:"bytes,2,opt,name=starAction" json:"starAction,omitempty"` - ContactAction *ContactAction `protobuf:"bytes,3,opt,name=contactAction" json:"contactAction,omitempty"` - MuteAction *MuteAction `protobuf:"bytes,4,opt,name=muteAction" json:"muteAction,omitempty"` - PinAction *PinAction `protobuf:"bytes,5,opt,name=pinAction" json:"pinAction,omitempty"` - SecurityNotificationSetting *SecurityNotificationSetting `protobuf:"bytes,6,opt,name=securityNotificationSetting" json:"securityNotificationSetting,omitempty"` - PushNameSetting *PushNameSetting `protobuf:"bytes,7,opt,name=pushNameSetting" json:"pushNameSetting,omitempty"` - QuickReplyAction *QuickReplyAction `protobuf:"bytes,8,opt,name=quickReplyAction" json:"quickReplyAction,omitempty"` - RecentEmojiWeightsAction *RecentEmojiWeightsAction `protobuf:"bytes,11,opt,name=recentEmojiWeightsAction" json:"recentEmojiWeightsAction,omitempty"` - LabelEditAction *LabelEditAction `protobuf:"bytes,14,opt,name=labelEditAction" json:"labelEditAction,omitempty"` - LabelAssociationAction *LabelAssociationAction `protobuf:"bytes,15,opt,name=labelAssociationAction" json:"labelAssociationAction,omitempty"` - LocaleSetting *LocaleSetting `protobuf:"bytes,16,opt,name=localeSetting" json:"localeSetting,omitempty"` - ArchiveChatAction *ArchiveChatAction `protobuf:"bytes,17,opt,name=archiveChatAction" json:"archiveChatAction,omitempty"` - DeleteMessageForMeAction *DeleteMessageForMeAction `protobuf:"bytes,18,opt,name=deleteMessageForMeAction" json:"deleteMessageForMeAction,omitempty"` - KeyExpiration *KeyExpiration `protobuf:"bytes,19,opt,name=keyExpiration" json:"keyExpiration,omitempty"` - MarkChatAsReadAction *MarkChatAsReadAction `protobuf:"bytes,20,opt,name=markChatAsReadAction" json:"markChatAsReadAction,omitempty"` - ClearChatAction *ClearChatAction `protobuf:"bytes,21,opt,name=clearChatAction" json:"clearChatAction,omitempty"` - DeleteChatAction *DeleteChatAction `protobuf:"bytes,22,opt,name=deleteChatAction" json:"deleteChatAction,omitempty"` - UnarchiveChatsSetting *UnarchiveChatsSetting `protobuf:"bytes,23,opt,name=unarchiveChatsSetting" json:"unarchiveChatsSetting,omitempty"` - PrimaryFeature *PrimaryFeature `protobuf:"bytes,24,opt,name=primaryFeature" json:"primaryFeature,omitempty"` - AndroidUnsupportedActions *AndroidUnsupportedActions `protobuf:"bytes,26,opt,name=androidUnsupportedActions" json:"androidUnsupportedActions,omitempty"` - AgentAction *AgentAction `protobuf:"bytes,27,opt,name=agentAction" json:"agentAction,omitempty"` - SubscriptionAction *SubscriptionAction `protobuf:"bytes,28,opt,name=subscriptionAction" json:"subscriptionAction,omitempty"` - UserStatusMuteAction *UserStatusMuteAction `protobuf:"bytes,29,opt,name=userStatusMuteAction" json:"userStatusMuteAction,omitempty"` - TimeFormatAction *TimeFormatAction `protobuf:"bytes,30,opt,name=timeFormatAction" json:"timeFormatAction,omitempty"` - NuxAction *NuxAction `protobuf:"bytes,31,opt,name=nuxAction" json:"nuxAction,omitempty"` - PrimaryVersionAction *PrimaryVersionAction `protobuf:"bytes,32,opt,name=primaryVersionAction" json:"primaryVersionAction,omitempty"` - StickerAction *StickerAction `protobuf:"bytes,33,opt,name=stickerAction" json:"stickerAction,omitempty"` - RemoveRecentStickerAction *RemoveRecentStickerAction `protobuf:"bytes,34,opt,name=removeRecentStickerAction" json:"removeRecentStickerAction,omitempty"` - ChatAssignment *ChatAssignmentAction `protobuf:"bytes,35,opt,name=chatAssignment" json:"chatAssignment,omitempty"` - ChatAssignmentOpenedStatus *ChatAssignmentOpenedStatusAction `protobuf:"bytes,36,opt,name=chatAssignmentOpenedStatus" json:"chatAssignmentOpenedStatus,omitempty"` - PnForLidChatAction *PnForLidChatAction `protobuf:"bytes,37,opt,name=pnForLidChatAction" json:"pnForLidChatAction,omitempty"` + Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` + StarAction *StarAction `protobuf:"bytes,2,opt,name=starAction" json:"starAction,omitempty"` + ContactAction *ContactAction `protobuf:"bytes,3,opt,name=contactAction" json:"contactAction,omitempty"` + MuteAction *MuteAction `protobuf:"bytes,4,opt,name=muteAction" json:"muteAction,omitempty"` + PinAction *PinAction `protobuf:"bytes,5,opt,name=pinAction" json:"pinAction,omitempty"` + SecurityNotificationSetting *SecurityNotificationSetting `protobuf:"bytes,6,opt,name=securityNotificationSetting" json:"securityNotificationSetting,omitempty"` + PushNameSetting *PushNameSetting `protobuf:"bytes,7,opt,name=pushNameSetting" json:"pushNameSetting,omitempty"` + QuickReplyAction *QuickReplyAction `protobuf:"bytes,8,opt,name=quickReplyAction" json:"quickReplyAction,omitempty"` + RecentEmojiWeightsAction *RecentEmojiWeightsAction `protobuf:"bytes,11,opt,name=recentEmojiWeightsAction" json:"recentEmojiWeightsAction,omitempty"` + LabelEditAction *LabelEditAction `protobuf:"bytes,14,opt,name=labelEditAction" json:"labelEditAction,omitempty"` + LabelAssociationAction *LabelAssociationAction `protobuf:"bytes,15,opt,name=labelAssociationAction" json:"labelAssociationAction,omitempty"` + LocaleSetting *LocaleSetting `protobuf:"bytes,16,opt,name=localeSetting" json:"localeSetting,omitempty"` + ArchiveChatAction *ArchiveChatAction `protobuf:"bytes,17,opt,name=archiveChatAction" json:"archiveChatAction,omitempty"` + DeleteMessageForMeAction *DeleteMessageForMeAction `protobuf:"bytes,18,opt,name=deleteMessageForMeAction" json:"deleteMessageForMeAction,omitempty"` + KeyExpiration *KeyExpiration `protobuf:"bytes,19,opt,name=keyExpiration" json:"keyExpiration,omitempty"` + MarkChatAsReadAction *MarkChatAsReadAction `protobuf:"bytes,20,opt,name=markChatAsReadAction" json:"markChatAsReadAction,omitempty"` + ClearChatAction *ClearChatAction `protobuf:"bytes,21,opt,name=clearChatAction" json:"clearChatAction,omitempty"` + DeleteChatAction *DeleteChatAction `protobuf:"bytes,22,opt,name=deleteChatAction" json:"deleteChatAction,omitempty"` + UnarchiveChatsSetting *UnarchiveChatsSetting `protobuf:"bytes,23,opt,name=unarchiveChatsSetting" json:"unarchiveChatsSetting,omitempty"` + PrimaryFeature *PrimaryFeature `protobuf:"bytes,24,opt,name=primaryFeature" json:"primaryFeature,omitempty"` + AndroidUnsupportedActions *AndroidUnsupportedActions `protobuf:"bytes,26,opt,name=androidUnsupportedActions" json:"androidUnsupportedActions,omitempty"` + AgentAction *AgentAction `protobuf:"bytes,27,opt,name=agentAction" json:"agentAction,omitempty"` + SubscriptionAction *SubscriptionAction `protobuf:"bytes,28,opt,name=subscriptionAction" json:"subscriptionAction,omitempty"` + UserStatusMuteAction *UserStatusMuteAction `protobuf:"bytes,29,opt,name=userStatusMuteAction" json:"userStatusMuteAction,omitempty"` + TimeFormatAction *TimeFormatAction `protobuf:"bytes,30,opt,name=timeFormatAction" json:"timeFormatAction,omitempty"` + NuxAction *NuxAction `protobuf:"bytes,31,opt,name=nuxAction" json:"nuxAction,omitempty"` + PrimaryVersionAction *PrimaryVersionAction `protobuf:"bytes,32,opt,name=primaryVersionAction" json:"primaryVersionAction,omitempty"` + StickerAction *StickerAction `protobuf:"bytes,33,opt,name=stickerAction" json:"stickerAction,omitempty"` + RemoveRecentStickerAction *RemoveRecentStickerAction `protobuf:"bytes,34,opt,name=removeRecentStickerAction" json:"removeRecentStickerAction,omitempty"` + ChatAssignment *ChatAssignmentAction `protobuf:"bytes,35,opt,name=chatAssignment" json:"chatAssignment,omitempty"` + ChatAssignmentOpenedStatus *ChatAssignmentOpenedStatusAction `protobuf:"bytes,36,opt,name=chatAssignmentOpenedStatus" json:"chatAssignmentOpenedStatus,omitempty"` + PnForLidChatAction *PnForLidChatAction `protobuf:"bytes,37,opt,name=pnForLidChatAction" json:"pnForLidChatAction,omitempty"` + MarketingMessageAction *MarketingMessageAction `protobuf:"bytes,38,opt,name=marketingMessageAction" json:"marketingMessageAction,omitempty"` + MarketingMessageBroadcastAction *MarketingMessageBroadcastAction `protobuf:"bytes,39,opt,name=marketingMessageBroadcastAction" json:"marketingMessageBroadcastAction,omitempty"` + ExternalWebBetaAction *ExternalWebBetaAction `protobuf:"bytes,40,opt,name=externalWebBetaAction" json:"externalWebBetaAction,omitempty"` + PrivacySettingRelayAllCalls *PrivacySettingRelayAllCalls `protobuf:"bytes,41,opt,name=privacySettingRelayAllCalls" json:"privacySettingRelayAllCalls,omitempty"` } func (x *SyncActionValue) Reset() { *x = SyncActionValue{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[107] + mi := &file_binary_proto_def_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -13881,7 +14385,7 @@ func (x *SyncActionValue) String() string { func (*SyncActionValue) ProtoMessage() {} func (x *SyncActionValue) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[107] + mi := &file_binary_proto_def_proto_msgTypes[109] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -13894,7 +14398,7 @@ func (x *SyncActionValue) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionValue.ProtoReflect.Descriptor instead. func (*SyncActionValue) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{107} + return file_binary_proto_def_proto_rawDescGZIP(), []int{109} } func (x *SyncActionValue) GetTimestamp() int64 { @@ -14121,6 +14625,34 @@ func (x *SyncActionValue) GetPnForLidChatAction() *PnForLidChatAction { return nil } +func (x *SyncActionValue) GetMarketingMessageAction() *MarketingMessageAction { + if x != nil { + return x.MarketingMessageAction + } + return nil +} + +func (x *SyncActionValue) GetMarketingMessageBroadcastAction() *MarketingMessageBroadcastAction { + if x != nil { + return x.MarketingMessageBroadcastAction + } + return nil +} + +func (x *SyncActionValue) GetExternalWebBetaAction() *ExternalWebBetaAction { + if x != nil { + return x.ExternalWebBetaAction + } + return nil +} + +func (x *SyncActionValue) GetPrivacySettingRelayAllCalls() *PrivacySettingRelayAllCalls { + if x != nil { + return x.PrivacySettingRelayAllCalls + } + return nil +} + type UserStatusMuteAction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14132,7 +14664,7 @@ type UserStatusMuteAction struct { func (x *UserStatusMuteAction) Reset() { *x = UserStatusMuteAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[108] + mi := &file_binary_proto_def_proto_msgTypes[110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14145,7 +14677,7 @@ func (x *UserStatusMuteAction) String() string { func (*UserStatusMuteAction) ProtoMessage() {} func (x *UserStatusMuteAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[108] + mi := &file_binary_proto_def_proto_msgTypes[110] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14158,7 +14690,7 @@ func (x *UserStatusMuteAction) ProtoReflect() protoreflect.Message { // Deprecated: Use UserStatusMuteAction.ProtoReflect.Descriptor instead. func (*UserStatusMuteAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{108} + return file_binary_proto_def_proto_rawDescGZIP(), []int{110} } func (x *UserStatusMuteAction) GetMuted() bool { @@ -14179,7 +14711,7 @@ type UnarchiveChatsSetting struct { func (x *UnarchiveChatsSetting) Reset() { *x = UnarchiveChatsSetting{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[109] + mi := &file_binary_proto_def_proto_msgTypes[111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14192,7 +14724,7 @@ func (x *UnarchiveChatsSetting) String() string { func (*UnarchiveChatsSetting) ProtoMessage() {} func (x *UnarchiveChatsSetting) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[109] + mi := &file_binary_proto_def_proto_msgTypes[111] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14205,7 +14737,7 @@ func (x *UnarchiveChatsSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use UnarchiveChatsSetting.ProtoReflect.Descriptor instead. func (*UnarchiveChatsSetting) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{109} + return file_binary_proto_def_proto_rawDescGZIP(), []int{111} } func (x *UnarchiveChatsSetting) GetUnarchiveChats() bool { @@ -14226,7 +14758,7 @@ type TimeFormatAction struct { func (x *TimeFormatAction) Reset() { *x = TimeFormatAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[110] + mi := &file_binary_proto_def_proto_msgTypes[112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14239,7 +14771,7 @@ func (x *TimeFormatAction) String() string { func (*TimeFormatAction) ProtoMessage() {} func (x *TimeFormatAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[110] + mi := &file_binary_proto_def_proto_msgTypes[112] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14252,7 +14784,7 @@ func (x *TimeFormatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use TimeFormatAction.ProtoReflect.Descriptor instead. func (*TimeFormatAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{110} + return file_binary_proto_def_proto_rawDescGZIP(), []int{112} } func (x *TimeFormatAction) GetIsTwentyFourHourFormatEnabled() bool { @@ -14274,7 +14806,7 @@ type SyncActionMessage struct { func (x *SyncActionMessage) Reset() { *x = SyncActionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[111] + mi := &file_binary_proto_def_proto_msgTypes[113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14287,7 +14819,7 @@ func (x *SyncActionMessage) String() string { func (*SyncActionMessage) ProtoMessage() {} func (x *SyncActionMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[111] + mi := &file_binary_proto_def_proto_msgTypes[113] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14300,7 +14832,7 @@ func (x *SyncActionMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionMessage.ProtoReflect.Descriptor instead. func (*SyncActionMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{111} + return file_binary_proto_def_proto_rawDescGZIP(), []int{113} } func (x *SyncActionMessage) GetKey() *MessageKey { @@ -14330,7 +14862,7 @@ type SyncActionMessageRange struct { func (x *SyncActionMessageRange) Reset() { *x = SyncActionMessageRange{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[112] + mi := &file_binary_proto_def_proto_msgTypes[114] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14343,7 +14875,7 @@ func (x *SyncActionMessageRange) String() string { func (*SyncActionMessageRange) ProtoMessage() {} func (x *SyncActionMessageRange) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[112] + mi := &file_binary_proto_def_proto_msgTypes[114] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14356,7 +14888,7 @@ func (x *SyncActionMessageRange) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionMessageRange.ProtoReflect.Descriptor instead. func (*SyncActionMessageRange) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{112} + return file_binary_proto_def_proto_rawDescGZIP(), []int{114} } func (x *SyncActionMessageRange) GetLastMessageTimestamp() int64 { @@ -14393,7 +14925,7 @@ type SubscriptionAction struct { func (x *SubscriptionAction) Reset() { *x = SubscriptionAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[113] + mi := &file_binary_proto_def_proto_msgTypes[115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14406,7 +14938,7 @@ func (x *SubscriptionAction) String() string { func (*SubscriptionAction) ProtoMessage() {} func (x *SubscriptionAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[113] + mi := &file_binary_proto_def_proto_msgTypes[115] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14419,7 +14951,7 @@ func (x *SubscriptionAction) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscriptionAction.ProtoReflect.Descriptor instead. func (*SubscriptionAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{113} + return file_binary_proto_def_proto_rawDescGZIP(), []int{115} } func (x *SubscriptionAction) GetIsDeactivated() bool { @@ -14463,7 +14995,7 @@ type StickerAction struct { func (x *StickerAction) Reset() { *x = StickerAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[114] + mi := &file_binary_proto_def_proto_msgTypes[116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14476,7 +15008,7 @@ func (x *StickerAction) String() string { func (*StickerAction) ProtoMessage() {} func (x *StickerAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[114] + mi := &file_binary_proto_def_proto_msgTypes[116] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14489,7 +15021,7 @@ func (x *StickerAction) ProtoReflect() protoreflect.Message { // Deprecated: Use StickerAction.ProtoReflect.Descriptor instead. func (*StickerAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{114} + return file_binary_proto_def_proto_rawDescGZIP(), []int{116} } func (x *StickerAction) GetUrl() string { @@ -14573,7 +15105,7 @@ type StarAction struct { func (x *StarAction) Reset() { *x = StarAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[115] + mi := &file_binary_proto_def_proto_msgTypes[117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14586,7 +15118,7 @@ func (x *StarAction) String() string { func (*StarAction) ProtoMessage() {} func (x *StarAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[115] + mi := &file_binary_proto_def_proto_msgTypes[117] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14599,7 +15131,7 @@ func (x *StarAction) ProtoReflect() protoreflect.Message { // Deprecated: Use StarAction.ProtoReflect.Descriptor instead. func (*StarAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{115} + return file_binary_proto_def_proto_rawDescGZIP(), []int{117} } func (x *StarAction) GetStarred() bool { @@ -14620,7 +15152,7 @@ type SecurityNotificationSetting struct { func (x *SecurityNotificationSetting) Reset() { *x = SecurityNotificationSetting{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[116] + mi := &file_binary_proto_def_proto_msgTypes[118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14633,7 +15165,7 @@ func (x *SecurityNotificationSetting) String() string { func (*SecurityNotificationSetting) ProtoMessage() {} func (x *SecurityNotificationSetting) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[116] + mi := &file_binary_proto_def_proto_msgTypes[118] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14646,7 +15178,7 @@ func (x *SecurityNotificationSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use SecurityNotificationSetting.ProtoReflect.Descriptor instead. func (*SecurityNotificationSetting) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{116} + return file_binary_proto_def_proto_rawDescGZIP(), []int{118} } func (x *SecurityNotificationSetting) GetShowNotification() bool { @@ -14667,7 +15199,7 @@ type RemoveRecentStickerAction struct { func (x *RemoveRecentStickerAction) Reset() { *x = RemoveRecentStickerAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[117] + mi := &file_binary_proto_def_proto_msgTypes[119] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14680,7 +15212,7 @@ func (x *RemoveRecentStickerAction) String() string { func (*RemoveRecentStickerAction) ProtoMessage() {} func (x *RemoveRecentStickerAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[117] + mi := &file_binary_proto_def_proto_msgTypes[119] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14693,7 +15225,7 @@ func (x *RemoveRecentStickerAction) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveRecentStickerAction.ProtoReflect.Descriptor instead. func (*RemoveRecentStickerAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{117} + return file_binary_proto_def_proto_rawDescGZIP(), []int{119} } func (x *RemoveRecentStickerAction) GetLastStickerSentTs() int64 { @@ -14714,7 +15246,7 @@ type RecentEmojiWeightsAction struct { func (x *RecentEmojiWeightsAction) Reset() { *x = RecentEmojiWeightsAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[118] + mi := &file_binary_proto_def_proto_msgTypes[120] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14727,7 +15259,7 @@ func (x *RecentEmojiWeightsAction) String() string { func (*RecentEmojiWeightsAction) ProtoMessage() {} func (x *RecentEmojiWeightsAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[118] + mi := &file_binary_proto_def_proto_msgTypes[120] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14740,7 +15272,7 @@ func (x *RecentEmojiWeightsAction) ProtoReflect() protoreflect.Message { // Deprecated: Use RecentEmojiWeightsAction.ProtoReflect.Descriptor instead. func (*RecentEmojiWeightsAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{118} + return file_binary_proto_def_proto_rawDescGZIP(), []int{120} } func (x *RecentEmojiWeightsAction) GetWeights() []*RecentEmojiWeight { @@ -14765,7 +15297,7 @@ type QuickReplyAction struct { func (x *QuickReplyAction) Reset() { *x = QuickReplyAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[119] + mi := &file_binary_proto_def_proto_msgTypes[121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14778,7 +15310,7 @@ func (x *QuickReplyAction) String() string { func (*QuickReplyAction) ProtoMessage() {} func (x *QuickReplyAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[119] + mi := &file_binary_proto_def_proto_msgTypes[121] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14791,7 +15323,7 @@ func (x *QuickReplyAction) ProtoReflect() protoreflect.Message { // Deprecated: Use QuickReplyAction.ProtoReflect.Descriptor instead. func (*QuickReplyAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{119} + return file_binary_proto_def_proto_rawDescGZIP(), []int{121} } func (x *QuickReplyAction) GetShortcut() string { @@ -14840,7 +15372,7 @@ type PushNameSetting struct { func (x *PushNameSetting) Reset() { *x = PushNameSetting{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[120] + mi := &file_binary_proto_def_proto_msgTypes[122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14853,7 +15385,7 @@ func (x *PushNameSetting) String() string { func (*PushNameSetting) ProtoMessage() {} func (x *PushNameSetting) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[120] + mi := &file_binary_proto_def_proto_msgTypes[122] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14866,7 +15398,7 @@ func (x *PushNameSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use PushNameSetting.ProtoReflect.Descriptor instead. func (*PushNameSetting) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{120} + return file_binary_proto_def_proto_rawDescGZIP(), []int{122} } func (x *PushNameSetting) GetName() string { @@ -14876,6 +15408,53 @@ func (x *PushNameSetting) GetName() string { return "" } +type PrivacySettingRelayAllCalls struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsEnabled *bool `protobuf:"varint,1,opt,name=isEnabled" json:"isEnabled,omitempty"` +} + +func (x *PrivacySettingRelayAllCalls) Reset() { + *x = PrivacySettingRelayAllCalls{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[123] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrivacySettingRelayAllCalls) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrivacySettingRelayAllCalls) ProtoMessage() {} + +func (x *PrivacySettingRelayAllCalls) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[123] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrivacySettingRelayAllCalls.ProtoReflect.Descriptor instead. +func (*PrivacySettingRelayAllCalls) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{123} +} + +func (x *PrivacySettingRelayAllCalls) GetIsEnabled() bool { + if x != nil && x.IsEnabled != nil { + return *x.IsEnabled + } + return false +} + type PrimaryVersionAction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14887,7 +15466,7 @@ type PrimaryVersionAction struct { func (x *PrimaryVersionAction) Reset() { *x = PrimaryVersionAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[121] + mi := &file_binary_proto_def_proto_msgTypes[124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14900,7 +15479,7 @@ func (x *PrimaryVersionAction) String() string { func (*PrimaryVersionAction) ProtoMessage() {} func (x *PrimaryVersionAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[121] + mi := &file_binary_proto_def_proto_msgTypes[124] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14913,7 +15492,7 @@ func (x *PrimaryVersionAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PrimaryVersionAction.ProtoReflect.Descriptor instead. func (*PrimaryVersionAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{121} + return file_binary_proto_def_proto_rawDescGZIP(), []int{124} } func (x *PrimaryVersionAction) GetVersion() string { @@ -14934,7 +15513,7 @@ type PrimaryFeature struct { func (x *PrimaryFeature) Reset() { *x = PrimaryFeature{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[122] + mi := &file_binary_proto_def_proto_msgTypes[125] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14947,7 +15526,7 @@ func (x *PrimaryFeature) String() string { func (*PrimaryFeature) ProtoMessage() {} func (x *PrimaryFeature) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[122] + mi := &file_binary_proto_def_proto_msgTypes[125] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -14960,7 +15539,7 @@ func (x *PrimaryFeature) ProtoReflect() protoreflect.Message { // Deprecated: Use PrimaryFeature.ProtoReflect.Descriptor instead. func (*PrimaryFeature) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{122} + return file_binary_proto_def_proto_rawDescGZIP(), []int{125} } func (x *PrimaryFeature) GetFlags() []string { @@ -14981,7 +15560,7 @@ type PnForLidChatAction struct { func (x *PnForLidChatAction) Reset() { *x = PnForLidChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[123] + mi := &file_binary_proto_def_proto_msgTypes[126] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -14994,7 +15573,7 @@ func (x *PnForLidChatAction) String() string { func (*PnForLidChatAction) ProtoMessage() {} func (x *PnForLidChatAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[123] + mi := &file_binary_proto_def_proto_msgTypes[126] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15007,7 +15586,7 @@ func (x *PnForLidChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PnForLidChatAction.ProtoReflect.Descriptor instead. func (*PnForLidChatAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{123} + return file_binary_proto_def_proto_rawDescGZIP(), []int{126} } func (x *PnForLidChatAction) GetPnJid() string { @@ -15028,7 +15607,7 @@ type PinAction struct { func (x *PinAction) Reset() { *x = PinAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[124] + mi := &file_binary_proto_def_proto_msgTypes[127] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15041,7 +15620,7 @@ func (x *PinAction) String() string { func (*PinAction) ProtoMessage() {} func (x *PinAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[124] + mi := &file_binary_proto_def_proto_msgTypes[127] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15054,7 +15633,7 @@ func (x *PinAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PinAction.ProtoReflect.Descriptor instead. func (*PinAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{124} + return file_binary_proto_def_proto_rawDescGZIP(), []int{127} } func (x *PinAction) GetPinned() bool { @@ -15075,7 +15654,7 @@ type NuxAction struct { func (x *NuxAction) Reset() { *x = NuxAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[125] + mi := &file_binary_proto_def_proto_msgTypes[128] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15088,7 +15667,7 @@ func (x *NuxAction) String() string { func (*NuxAction) ProtoMessage() {} func (x *NuxAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[125] + mi := &file_binary_proto_def_proto_msgTypes[128] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15101,7 +15680,7 @@ func (x *NuxAction) ProtoReflect() protoreflect.Message { // Deprecated: Use NuxAction.ProtoReflect.Descriptor instead. func (*NuxAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{125} + return file_binary_proto_def_proto_rawDescGZIP(), []int{128} } func (x *NuxAction) GetAcknowledged() bool { @@ -15124,7 +15703,7 @@ type MuteAction struct { func (x *MuteAction) Reset() { *x = MuteAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[126] + mi := &file_binary_proto_def_proto_msgTypes[129] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15137,7 +15716,7 @@ func (x *MuteAction) String() string { func (*MuteAction) ProtoMessage() {} func (x *MuteAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[126] + mi := &file_binary_proto_def_proto_msgTypes[129] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15150,7 +15729,7 @@ func (x *MuteAction) ProtoReflect() protoreflect.Message { // Deprecated: Use MuteAction.ProtoReflect.Descriptor instead. func (*MuteAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{126} + return file_binary_proto_def_proto_rawDescGZIP(), []int{129} } func (x *MuteAction) GetMuted() bool { @@ -15174,6 +15753,148 @@ func (x *MuteAction) GetAutoMuted() bool { return false } +type MarketingMessageBroadcastAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepliedCount *int32 `protobuf:"varint,1,opt,name=repliedCount" json:"repliedCount,omitempty"` +} + +func (x *MarketingMessageBroadcastAction) Reset() { + *x = MarketingMessageBroadcastAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[130] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MarketingMessageBroadcastAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarketingMessageBroadcastAction) ProtoMessage() {} + +func (x *MarketingMessageBroadcastAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[130] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarketingMessageBroadcastAction.ProtoReflect.Descriptor instead. +func (*MarketingMessageBroadcastAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{130} +} + +func (x *MarketingMessageBroadcastAction) GetRepliedCount() int32 { + if x != nil && x.RepliedCount != nil { + return *x.RepliedCount + } + return 0 +} + +type MarketingMessageAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + Type *MarketingMessageAction_MarketingMessagePrototypeType `protobuf:"varint,3,opt,name=type,enum=proto.MarketingMessageAction_MarketingMessagePrototypeType" json:"type,omitempty"` + CreatedAt *int64 `protobuf:"varint,4,opt,name=createdAt" json:"createdAt,omitempty"` + LastSentAt *int64 `protobuf:"varint,5,opt,name=lastSentAt" json:"lastSentAt,omitempty"` + IsDeleted *bool `protobuf:"varint,6,opt,name=isDeleted" json:"isDeleted,omitempty"` + MediaId *string `protobuf:"bytes,7,opt,name=mediaId" json:"mediaId,omitempty"` +} + +func (x *MarketingMessageAction) Reset() { + *x = MarketingMessageAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[131] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MarketingMessageAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarketingMessageAction) ProtoMessage() {} + +func (x *MarketingMessageAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[131] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarketingMessageAction.ProtoReflect.Descriptor instead. +func (*MarketingMessageAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{131} +} + +func (x *MarketingMessageAction) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *MarketingMessageAction) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +func (x *MarketingMessageAction) GetType() MarketingMessageAction_MarketingMessagePrototypeType { + if x != nil && x.Type != nil { + return *x.Type + } + return MarketingMessageAction_PERSONALIZED +} + +func (x *MarketingMessageAction) GetCreatedAt() int64 { + if x != nil && x.CreatedAt != nil { + return *x.CreatedAt + } + return 0 +} + +func (x *MarketingMessageAction) GetLastSentAt() int64 { + if x != nil && x.LastSentAt != nil { + return *x.LastSentAt + } + return 0 +} + +func (x *MarketingMessageAction) GetIsDeleted() bool { + if x != nil && x.IsDeleted != nil { + return *x.IsDeleted + } + return false +} + +func (x *MarketingMessageAction) GetMediaId() string { + if x != nil && x.MediaId != nil { + return *x.MediaId + } + return "" +} + type MarkChatAsReadAction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -15186,7 +15907,7 @@ type MarkChatAsReadAction struct { func (x *MarkChatAsReadAction) Reset() { *x = MarkChatAsReadAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[127] + mi := &file_binary_proto_def_proto_msgTypes[132] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15199,7 +15920,7 @@ func (x *MarkChatAsReadAction) String() string { func (*MarkChatAsReadAction) ProtoMessage() {} func (x *MarkChatAsReadAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[127] + mi := &file_binary_proto_def_proto_msgTypes[132] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15212,7 +15933,7 @@ func (x *MarkChatAsReadAction) ProtoReflect() protoreflect.Message { // Deprecated: Use MarkChatAsReadAction.ProtoReflect.Descriptor instead. func (*MarkChatAsReadAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{127} + return file_binary_proto_def_proto_rawDescGZIP(), []int{132} } func (x *MarkChatAsReadAction) GetRead() bool { @@ -15240,7 +15961,7 @@ type LocaleSetting struct { func (x *LocaleSetting) Reset() { *x = LocaleSetting{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[128] + mi := &file_binary_proto_def_proto_msgTypes[133] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15253,7 +15974,7 @@ func (x *LocaleSetting) String() string { func (*LocaleSetting) ProtoMessage() {} func (x *LocaleSetting) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[128] + mi := &file_binary_proto_def_proto_msgTypes[133] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15266,7 +15987,7 @@ func (x *LocaleSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use LocaleSetting.ProtoReflect.Descriptor instead. func (*LocaleSetting) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{128} + return file_binary_proto_def_proto_rawDescGZIP(), []int{133} } func (x *LocaleSetting) GetLocale() string { @@ -15290,7 +16011,7 @@ type LabelEditAction struct { func (x *LabelEditAction) Reset() { *x = LabelEditAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[129] + mi := &file_binary_proto_def_proto_msgTypes[134] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15303,7 +16024,7 @@ func (x *LabelEditAction) String() string { func (*LabelEditAction) ProtoMessage() {} func (x *LabelEditAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[129] + mi := &file_binary_proto_def_proto_msgTypes[134] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15316,7 +16037,7 @@ func (x *LabelEditAction) ProtoReflect() protoreflect.Message { // Deprecated: Use LabelEditAction.ProtoReflect.Descriptor instead. func (*LabelEditAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{129} + return file_binary_proto_def_proto_rawDescGZIP(), []int{134} } func (x *LabelEditAction) GetName() string { @@ -15358,7 +16079,7 @@ type LabelAssociationAction struct { func (x *LabelAssociationAction) Reset() { *x = LabelAssociationAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[130] + mi := &file_binary_proto_def_proto_msgTypes[135] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15371,7 +16092,7 @@ func (x *LabelAssociationAction) String() string { func (*LabelAssociationAction) ProtoMessage() {} func (x *LabelAssociationAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[130] + mi := &file_binary_proto_def_proto_msgTypes[135] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15384,7 +16105,7 @@ func (x *LabelAssociationAction) ProtoReflect() protoreflect.Message { // Deprecated: Use LabelAssociationAction.ProtoReflect.Descriptor instead. func (*LabelAssociationAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{130} + return file_binary_proto_def_proto_rawDescGZIP(), []int{135} } func (x *LabelAssociationAction) GetLabeled() bool { @@ -15405,7 +16126,7 @@ type KeyExpiration struct { func (x *KeyExpiration) Reset() { *x = KeyExpiration{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[131] + mi := &file_binary_proto_def_proto_msgTypes[136] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15418,7 +16139,7 @@ func (x *KeyExpiration) String() string { func (*KeyExpiration) ProtoMessage() {} func (x *KeyExpiration) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[131] + mi := &file_binary_proto_def_proto_msgTypes[136] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15431,7 +16152,7 @@ func (x *KeyExpiration) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyExpiration.ProtoReflect.Descriptor instead. func (*KeyExpiration) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{131} + return file_binary_proto_def_proto_rawDescGZIP(), []int{136} } func (x *KeyExpiration) GetExpiredKeyEpoch() int32 { @@ -15441,6 +16162,53 @@ func (x *KeyExpiration) GetExpiredKeyEpoch() int32 { return 0 } +type ExternalWebBetaAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsOptIn *bool `protobuf:"varint,1,opt,name=isOptIn" json:"isOptIn,omitempty"` +} + +func (x *ExternalWebBetaAction) Reset() { + *x = ExternalWebBetaAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[137] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExternalWebBetaAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalWebBetaAction) ProtoMessage() {} + +func (x *ExternalWebBetaAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[137] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExternalWebBetaAction.ProtoReflect.Descriptor instead. +func (*ExternalWebBetaAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{137} +} + +func (x *ExternalWebBetaAction) GetIsOptIn() bool { + if x != nil && x.IsOptIn != nil { + return *x.IsOptIn + } + return false +} + type DeleteMessageForMeAction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -15453,7 +16221,7 @@ type DeleteMessageForMeAction struct { func (x *DeleteMessageForMeAction) Reset() { *x = DeleteMessageForMeAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[132] + mi := &file_binary_proto_def_proto_msgTypes[138] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15466,7 +16234,7 @@ func (x *DeleteMessageForMeAction) String() string { func (*DeleteMessageForMeAction) ProtoMessage() {} func (x *DeleteMessageForMeAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[132] + mi := &file_binary_proto_def_proto_msgTypes[138] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15479,7 +16247,7 @@ func (x *DeleteMessageForMeAction) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteMessageForMeAction.ProtoReflect.Descriptor instead. func (*DeleteMessageForMeAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{132} + return file_binary_proto_def_proto_rawDescGZIP(), []int{138} } func (x *DeleteMessageForMeAction) GetDeleteMedia() bool { @@ -15507,7 +16275,7 @@ type DeleteChatAction struct { func (x *DeleteChatAction) Reset() { *x = DeleteChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[133] + mi := &file_binary_proto_def_proto_msgTypes[139] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15520,7 +16288,7 @@ func (x *DeleteChatAction) String() string { func (*DeleteChatAction) ProtoMessage() {} func (x *DeleteChatAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[133] + mi := &file_binary_proto_def_proto_msgTypes[139] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15533,7 +16301,7 @@ func (x *DeleteChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteChatAction.ProtoReflect.Descriptor instead. func (*DeleteChatAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{133} + return file_binary_proto_def_proto_rawDescGZIP(), []int{139} } func (x *DeleteChatAction) GetMessageRange() *SyncActionMessageRange { @@ -15556,7 +16324,7 @@ type ContactAction struct { func (x *ContactAction) Reset() { *x = ContactAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[134] + mi := &file_binary_proto_def_proto_msgTypes[140] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15569,7 +16337,7 @@ func (x *ContactAction) String() string { func (*ContactAction) ProtoMessage() {} func (x *ContactAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[134] + mi := &file_binary_proto_def_proto_msgTypes[140] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15582,7 +16350,7 @@ func (x *ContactAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ContactAction.ProtoReflect.Descriptor instead. func (*ContactAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{134} + return file_binary_proto_def_proto_rawDescGZIP(), []int{140} } func (x *ContactAction) GetFullName() string { @@ -15617,7 +16385,7 @@ type ClearChatAction struct { func (x *ClearChatAction) Reset() { *x = ClearChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[135] + mi := &file_binary_proto_def_proto_msgTypes[141] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15630,7 +16398,7 @@ func (x *ClearChatAction) String() string { func (*ClearChatAction) ProtoMessage() {} func (x *ClearChatAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[135] + mi := &file_binary_proto_def_proto_msgTypes[141] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15643,7 +16411,7 @@ func (x *ClearChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ClearChatAction.ProtoReflect.Descriptor instead. func (*ClearChatAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{135} + return file_binary_proto_def_proto_rawDescGZIP(), []int{141} } func (x *ClearChatAction) GetMessageRange() *SyncActionMessageRange { @@ -15664,7 +16432,7 @@ type ChatAssignmentOpenedStatusAction struct { func (x *ChatAssignmentOpenedStatusAction) Reset() { *x = ChatAssignmentOpenedStatusAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[136] + mi := &file_binary_proto_def_proto_msgTypes[142] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15677,7 +16445,7 @@ func (x *ChatAssignmentOpenedStatusAction) String() string { func (*ChatAssignmentOpenedStatusAction) ProtoMessage() {} func (x *ChatAssignmentOpenedStatusAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[136] + mi := &file_binary_proto_def_proto_msgTypes[142] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15690,7 +16458,7 @@ func (x *ChatAssignmentOpenedStatusAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ChatAssignmentOpenedStatusAction.ProtoReflect.Descriptor instead. func (*ChatAssignmentOpenedStatusAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{136} + return file_binary_proto_def_proto_rawDescGZIP(), []int{142} } func (x *ChatAssignmentOpenedStatusAction) GetChatOpened() bool { @@ -15711,7 +16479,7 @@ type ChatAssignmentAction struct { func (x *ChatAssignmentAction) Reset() { *x = ChatAssignmentAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[137] + mi := &file_binary_proto_def_proto_msgTypes[143] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15724,7 +16492,7 @@ func (x *ChatAssignmentAction) String() string { func (*ChatAssignmentAction) ProtoMessage() {} func (x *ChatAssignmentAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[137] + mi := &file_binary_proto_def_proto_msgTypes[143] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15737,7 +16505,7 @@ func (x *ChatAssignmentAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ChatAssignmentAction.ProtoReflect.Descriptor instead. func (*ChatAssignmentAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{137} + return file_binary_proto_def_proto_rawDescGZIP(), []int{143} } func (x *ChatAssignmentAction) GetDeviceAgentID() string { @@ -15759,7 +16527,7 @@ type ArchiveChatAction struct { func (x *ArchiveChatAction) Reset() { *x = ArchiveChatAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[138] + mi := &file_binary_proto_def_proto_msgTypes[144] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15772,7 +16540,7 @@ func (x *ArchiveChatAction) String() string { func (*ArchiveChatAction) ProtoMessage() {} func (x *ArchiveChatAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[138] + mi := &file_binary_proto_def_proto_msgTypes[144] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15785,7 +16553,7 @@ func (x *ArchiveChatAction) ProtoReflect() protoreflect.Message { // Deprecated: Use ArchiveChatAction.ProtoReflect.Descriptor instead. func (*ArchiveChatAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{138} + return file_binary_proto_def_proto_rawDescGZIP(), []int{144} } func (x *ArchiveChatAction) GetArchived() bool { @@ -15813,7 +16581,7 @@ type AndroidUnsupportedActions struct { func (x *AndroidUnsupportedActions) Reset() { *x = AndroidUnsupportedActions{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[139] + mi := &file_binary_proto_def_proto_msgTypes[145] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15826,7 +16594,7 @@ func (x *AndroidUnsupportedActions) String() string { func (*AndroidUnsupportedActions) ProtoMessage() {} func (x *AndroidUnsupportedActions) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[139] + mi := &file_binary_proto_def_proto_msgTypes[145] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15839,7 +16607,7 @@ func (x *AndroidUnsupportedActions) ProtoReflect() protoreflect.Message { // Deprecated: Use AndroidUnsupportedActions.ProtoReflect.Descriptor instead. func (*AndroidUnsupportedActions) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{139} + return file_binary_proto_def_proto_rawDescGZIP(), []int{145} } func (x *AndroidUnsupportedActions) GetAllowed() bool { @@ -15862,7 +16630,7 @@ type AgentAction struct { func (x *AgentAction) Reset() { *x = AgentAction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[140] + mi := &file_binary_proto_def_proto_msgTypes[146] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15875,7 +16643,7 @@ func (x *AgentAction) String() string { func (*AgentAction) ProtoMessage() {} func (x *AgentAction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[140] + mi := &file_binary_proto_def_proto_msgTypes[146] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15888,7 +16656,7 @@ func (x *AgentAction) ProtoReflect() protoreflect.Message { // Deprecated: Use AgentAction.ProtoReflect.Descriptor instead. func (*AgentAction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{140} + return file_binary_proto_def_proto_rawDescGZIP(), []int{146} } func (x *AgentAction) GetName() string { @@ -15926,7 +16694,7 @@ type SyncActionData struct { func (x *SyncActionData) Reset() { *x = SyncActionData{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[141] + mi := &file_binary_proto_def_proto_msgTypes[147] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -15939,7 +16707,7 @@ func (x *SyncActionData) String() string { func (*SyncActionData) ProtoMessage() {} func (x *SyncActionData) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[141] + mi := &file_binary_proto_def_proto_msgTypes[147] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -15952,7 +16720,7 @@ func (x *SyncActionData) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncActionData.ProtoReflect.Descriptor instead. func (*SyncActionData) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{141} + return file_binary_proto_def_proto_rawDescGZIP(), []int{147} } func (x *SyncActionData) GetIndex() []byte { @@ -15995,7 +16763,7 @@ type RecentEmojiWeight struct { func (x *RecentEmojiWeight) Reset() { *x = RecentEmojiWeight{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[142] + mi := &file_binary_proto_def_proto_msgTypes[148] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16008,7 +16776,7 @@ func (x *RecentEmojiWeight) String() string { func (*RecentEmojiWeight) ProtoMessage() {} func (x *RecentEmojiWeight) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[142] + mi := &file_binary_proto_def_proto_msgTypes[148] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16021,7 +16789,7 @@ func (x *RecentEmojiWeight) ProtoReflect() protoreflect.Message { // Deprecated: Use RecentEmojiWeight.ProtoReflect.Descriptor instead. func (*RecentEmojiWeight) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{142} + return file_binary_proto_def_proto_rawDescGZIP(), []int{148} } func (x *RecentEmojiWeight) GetEmoji() string { @@ -16051,7 +16819,7 @@ type VerifiedNameCertificate struct { func (x *VerifiedNameCertificate) Reset() { *x = VerifiedNameCertificate{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[143] + mi := &file_binary_proto_def_proto_msgTypes[149] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16064,7 +16832,7 @@ func (x *VerifiedNameCertificate) String() string { func (*VerifiedNameCertificate) ProtoMessage() {} func (x *VerifiedNameCertificate) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[143] + mi := &file_binary_proto_def_proto_msgTypes[149] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16077,7 +16845,7 @@ func (x *VerifiedNameCertificate) ProtoReflect() protoreflect.Message { // Deprecated: Use VerifiedNameCertificate.ProtoReflect.Descriptor instead. func (*VerifiedNameCertificate) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{143} + return file_binary_proto_def_proto_rawDescGZIP(), []int{149} } func (x *VerifiedNameCertificate) GetDetails() []byte { @@ -16114,7 +16882,7 @@ type LocalizedName struct { func (x *LocalizedName) Reset() { *x = LocalizedName{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[144] + mi := &file_binary_proto_def_proto_msgTypes[150] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16127,7 +16895,7 @@ func (x *LocalizedName) String() string { func (*LocalizedName) ProtoMessage() {} func (x *LocalizedName) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[144] + mi := &file_binary_proto_def_proto_msgTypes[150] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16140,7 +16908,7 @@ func (x *LocalizedName) ProtoReflect() protoreflect.Message { // Deprecated: Use LocalizedName.ProtoReflect.Descriptor instead. func (*LocalizedName) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{144} + return file_binary_proto_def_proto_rawDescGZIP(), []int{150} } func (x *LocalizedName) GetLg() string { @@ -16182,7 +16950,7 @@ type BizIdentityInfo struct { func (x *BizIdentityInfo) Reset() { *x = BizIdentityInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[145] + mi := &file_binary_proto_def_proto_msgTypes[151] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16195,7 +16963,7 @@ func (x *BizIdentityInfo) String() string { func (*BizIdentityInfo) ProtoMessage() {} func (x *BizIdentityInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[145] + mi := &file_binary_proto_def_proto_msgTypes[151] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16208,7 +16976,7 @@ func (x *BizIdentityInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use BizIdentityInfo.ProtoReflect.Descriptor instead. func (*BizIdentityInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{145} + return file_binary_proto_def_proto_rawDescGZIP(), []int{151} } func (x *BizIdentityInfo) GetVlevel() BizIdentityInfo_VerifiedLevelValue { @@ -16279,7 +17047,7 @@ type BizAccountPayload struct { func (x *BizAccountPayload) Reset() { *x = BizAccountPayload{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[146] + mi := &file_binary_proto_def_proto_msgTypes[152] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16292,7 +17060,7 @@ func (x *BizAccountPayload) String() string { func (*BizAccountPayload) ProtoMessage() {} func (x *BizAccountPayload) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[146] + mi := &file_binary_proto_def_proto_msgTypes[152] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16305,7 +17073,7 @@ func (x *BizAccountPayload) ProtoReflect() protoreflect.Message { // Deprecated: Use BizAccountPayload.ProtoReflect.Descriptor instead. func (*BizAccountPayload) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{146} + return file_binary_proto_def_proto_rawDescGZIP(), []int{152} } func (x *BizAccountPayload) GetVnameCert() *VerifiedNameCertificate { @@ -16337,7 +17105,7 @@ type BizAccountLinkInfo struct { func (x *BizAccountLinkInfo) Reset() { *x = BizAccountLinkInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[147] + mi := &file_binary_proto_def_proto_msgTypes[153] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16350,7 +17118,7 @@ func (x *BizAccountLinkInfo) String() string { func (*BizAccountLinkInfo) ProtoMessage() {} func (x *BizAccountLinkInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[147] + mi := &file_binary_proto_def_proto_msgTypes[153] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16363,7 +17131,7 @@ func (x *BizAccountLinkInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use BizAccountLinkInfo.ProtoReflect.Descriptor instead. func (*BizAccountLinkInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{147} + return file_binary_proto_def_proto_rawDescGZIP(), []int{153} } func (x *BizAccountLinkInfo) GetWhatsappBizAcctFbid() uint64 { @@ -16414,7 +17182,7 @@ type HandshakeMessage struct { func (x *HandshakeMessage) Reset() { *x = HandshakeMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[148] + mi := &file_binary_proto_def_proto_msgTypes[154] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16427,7 +17195,7 @@ func (x *HandshakeMessage) String() string { func (*HandshakeMessage) ProtoMessage() {} func (x *HandshakeMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[148] + mi := &file_binary_proto_def_proto_msgTypes[154] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16440,7 +17208,7 @@ func (x *HandshakeMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use HandshakeMessage.ProtoReflect.Descriptor instead. func (*HandshakeMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{148} + return file_binary_proto_def_proto_rawDescGZIP(), []int{154} } func (x *HandshakeMessage) GetClientHello() *HandshakeClientHello { @@ -16477,7 +17245,7 @@ type HandshakeServerHello struct { func (x *HandshakeServerHello) Reset() { *x = HandshakeServerHello{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[149] + mi := &file_binary_proto_def_proto_msgTypes[155] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16490,7 +17258,7 @@ func (x *HandshakeServerHello) String() string { func (*HandshakeServerHello) ProtoMessage() {} func (x *HandshakeServerHello) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[149] + mi := &file_binary_proto_def_proto_msgTypes[155] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16503,7 +17271,7 @@ func (x *HandshakeServerHello) ProtoReflect() protoreflect.Message { // Deprecated: Use HandshakeServerHello.ProtoReflect.Descriptor instead. func (*HandshakeServerHello) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{149} + return file_binary_proto_def_proto_rawDescGZIP(), []int{155} } func (x *HandshakeServerHello) GetEphemeral() []byte { @@ -16540,7 +17308,7 @@ type HandshakeClientHello struct { func (x *HandshakeClientHello) Reset() { *x = HandshakeClientHello{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[150] + mi := &file_binary_proto_def_proto_msgTypes[156] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16553,7 +17321,7 @@ func (x *HandshakeClientHello) String() string { func (*HandshakeClientHello) ProtoMessage() {} func (x *HandshakeClientHello) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[150] + mi := &file_binary_proto_def_proto_msgTypes[156] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16566,7 +17334,7 @@ func (x *HandshakeClientHello) ProtoReflect() protoreflect.Message { // Deprecated: Use HandshakeClientHello.ProtoReflect.Descriptor instead. func (*HandshakeClientHello) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{150} + return file_binary_proto_def_proto_rawDescGZIP(), []int{156} } func (x *HandshakeClientHello) GetEphemeral() []byte { @@ -16602,7 +17370,7 @@ type HandshakeClientFinish struct { func (x *HandshakeClientFinish) Reset() { *x = HandshakeClientFinish{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[151] + mi := &file_binary_proto_def_proto_msgTypes[157] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16615,7 +17383,7 @@ func (x *HandshakeClientFinish) String() string { func (*HandshakeClientFinish) ProtoMessage() {} func (x *HandshakeClientFinish) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[151] + mi := &file_binary_proto_def_proto_msgTypes[157] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16628,7 +17396,7 @@ func (x *HandshakeClientFinish) ProtoReflect() protoreflect.Message { // Deprecated: Use HandshakeClientFinish.ProtoReflect.Descriptor instead. func (*HandshakeClientFinish) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{151} + return file_binary_proto_def_proto_rawDescGZIP(), []int{157} } func (x *HandshakeClientFinish) GetStatic() []byte { @@ -16676,12 +17444,13 @@ type ClientPayload struct { PaddingBytes []byte `protobuf:"bytes,34,opt,name=paddingBytes" json:"paddingBytes,omitempty"` YearClass *int32 `protobuf:"varint,36,opt,name=yearClass" json:"yearClass,omitempty"` MemClass *int32 `protobuf:"varint,37,opt,name=memClass" json:"memClass,omitempty"` + InteropData *ClientPayload_InteropData `protobuf:"bytes,38,opt,name=interopData" json:"interopData,omitempty"` } func (x *ClientPayload) Reset() { *x = ClientPayload{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[152] + mi := &file_binary_proto_def_proto_msgTypes[158] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16694,7 +17463,7 @@ func (x *ClientPayload) String() string { func (*ClientPayload) ProtoMessage() {} func (x *ClientPayload) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[152] + mi := &file_binary_proto_def_proto_msgTypes[158] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16707,7 +17476,7 @@ func (x *ClientPayload) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientPayload.ProtoReflect.Descriptor instead. func (*ClientPayload) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158} } func (x *ClientPayload) GetUsername() uint64 { @@ -16892,6 +17661,13 @@ func (x *ClientPayload) GetMemClass() int32 { return 0 } +func (x *ClientPayload) GetInteropData() *ClientPayload_InteropData { + if x != nil { + return x.InteropData + } + return nil +} + type WebNotificationsInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -16906,7 +17682,7 @@ type WebNotificationsInfo struct { func (x *WebNotificationsInfo) Reset() { *x = WebNotificationsInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[153] + mi := &file_binary_proto_def_proto_msgTypes[159] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -16919,7 +17695,7 @@ func (x *WebNotificationsInfo) String() string { func (*WebNotificationsInfo) ProtoMessage() {} func (x *WebNotificationsInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[153] + mi := &file_binary_proto_def_proto_msgTypes[159] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -16932,7 +17708,7 @@ func (x *WebNotificationsInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use WebNotificationsInfo.ProtoReflect.Descriptor instead. func (*WebNotificationsInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{153} + return file_binary_proto_def_proto_rawDescGZIP(), []int{159} } func (x *WebNotificationsInfo) GetTimestamp() uint64 { @@ -17011,12 +17787,13 @@ type WebMessageInfo struct { KeepInChat *KeepInChat `protobuf:"bytes,50,opt,name=keepInChat" json:"keepInChat,omitempty"` OriginalSelfAuthorUserJidString *string `protobuf:"bytes,51,opt,name=originalSelfAuthorUserJidString" json:"originalSelfAuthorUserJidString,omitempty"` RevokeMessageTimestamp *uint64 `protobuf:"varint,52,opt,name=revokeMessageTimestamp" json:"revokeMessageTimestamp,omitempty"` + PinInChat *PinInChat `protobuf:"bytes,54,opt,name=pinInChat" json:"pinInChat,omitempty"` } func (x *WebMessageInfo) Reset() { *x = WebMessageInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[154] + mi := &file_binary_proto_def_proto_msgTypes[160] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -17029,7 +17806,7 @@ func (x *WebMessageInfo) String() string { func (*WebMessageInfo) ProtoMessage() {} func (x *WebMessageInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[154] + mi := &file_binary_proto_def_proto_msgTypes[160] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -17042,7 +17819,7 @@ func (x *WebMessageInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use WebMessageInfo.ProtoReflect.Descriptor instead. func (*WebMessageInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{154} + return file_binary_proto_def_proto_rawDescGZIP(), []int{160} } func (x *WebMessageInfo) GetKey() *MessageKey { @@ -17346,6 +18123,13 @@ func (x *WebMessageInfo) GetRevokeMessageTimestamp() uint64 { return 0 } +func (x *WebMessageInfo) GetPinInChat() *PinInChat { + if x != nil { + return x.PinInChat + } + return nil +} + type WebFeatures struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -17401,7 +18185,7 @@ type WebFeatures struct { func (x *WebFeatures) Reset() { *x = WebFeatures{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[155] + mi := &file_binary_proto_def_proto_msgTypes[161] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -17414,7 +18198,7 @@ func (x *WebFeatures) String() string { func (*WebFeatures) ProtoMessage() {} func (x *WebFeatures) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[155] + mi := &file_binary_proto_def_proto_msgTypes[161] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -17427,7 +18211,7 @@ func (x *WebFeatures) ProtoReflect() protoreflect.Message { // Deprecated: Use WebFeatures.ProtoReflect.Descriptor instead. func (*WebFeatures) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{155} + return file_binary_proto_def_proto_rawDescGZIP(), []int{161} } func (x *WebFeatures) GetLabelsDisplay() WebFeatures_Flag { @@ -17761,7 +18545,7 @@ type UserReceipt struct { func (x *UserReceipt) Reset() { *x = UserReceipt{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[156] + mi := &file_binary_proto_def_proto_msgTypes[162] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -17774,7 +18558,7 @@ func (x *UserReceipt) String() string { func (*UserReceipt) ProtoMessage() {} func (x *UserReceipt) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[156] + mi := &file_binary_proto_def_proto_msgTypes[162] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -17787,7 +18571,7 @@ func (x *UserReceipt) ProtoReflect() protoreflect.Message { // Deprecated: Use UserReceipt.ProtoReflect.Descriptor instead. func (*UserReceipt) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{156} + return file_binary_proto_def_proto_rawDescGZIP(), []int{162} } func (x *UserReceipt) GetUserJid() string { @@ -17844,7 +18628,7 @@ type StatusPSA struct { func (x *StatusPSA) Reset() { *x = StatusPSA{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[157] + mi := &file_binary_proto_def_proto_msgTypes[163] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -17857,7 +18641,7 @@ func (x *StatusPSA) String() string { func (*StatusPSA) ProtoMessage() {} func (x *StatusPSA) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[157] + mi := &file_binary_proto_def_proto_msgTypes[163] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -17870,7 +18654,7 @@ func (x *StatusPSA) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusPSA.ProtoReflect.Descriptor instead. func (*StatusPSA) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{157} + return file_binary_proto_def_proto_rawDescGZIP(), []int{163} } func (x *StatusPSA) GetCampaignId() uint64 { @@ -17902,7 +18686,7 @@ type Reaction struct { func (x *Reaction) Reset() { *x = Reaction{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[158] + mi := &file_binary_proto_def_proto_msgTypes[164] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -17915,7 +18699,7 @@ func (x *Reaction) String() string { func (*Reaction) ProtoMessage() {} func (x *Reaction) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[158] + mi := &file_binary_proto_def_proto_msgTypes[164] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -17928,7 +18712,7 @@ func (x *Reaction) ProtoReflect() protoreflect.Message { // Deprecated: Use Reaction.ProtoReflect.Descriptor instead. func (*Reaction) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{158} + return file_binary_proto_def_proto_rawDescGZIP(), []int{164} } func (x *Reaction) GetKey() *MessageKey { @@ -17981,7 +18765,7 @@ type PollUpdate struct { func (x *PollUpdate) Reset() { *x = PollUpdate{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[159] + mi := &file_binary_proto_def_proto_msgTypes[165] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -17994,7 +18778,7 @@ func (x *PollUpdate) String() string { func (*PollUpdate) ProtoMessage() {} func (x *PollUpdate) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[159] + mi := &file_binary_proto_def_proto_msgTypes[165] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18007,7 +18791,7 @@ func (x *PollUpdate) ProtoReflect() protoreflect.Message { // Deprecated: Use PollUpdate.ProtoReflect.Descriptor instead. func (*PollUpdate) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{159} + return file_binary_proto_def_proto_rawDescGZIP(), []int{165} } func (x *PollUpdate) GetPollUpdateMessageKey() *MessageKey { @@ -18056,7 +18840,7 @@ type PollAdditionalMetadata struct { func (x *PollAdditionalMetadata) Reset() { *x = PollAdditionalMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[160] + mi := &file_binary_proto_def_proto_msgTypes[166] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18069,7 +18853,7 @@ func (x *PollAdditionalMetadata) String() string { func (*PollAdditionalMetadata) ProtoMessage() {} func (x *PollAdditionalMetadata) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[160] + mi := &file_binary_proto_def_proto_msgTypes[166] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18082,7 +18866,7 @@ func (x *PollAdditionalMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use PollAdditionalMetadata.ProtoReflect.Descriptor instead. func (*PollAdditionalMetadata) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{160} + return file_binary_proto_def_proto_rawDescGZIP(), []int{166} } func (x *PollAdditionalMetadata) GetPollInvalidated() bool { @@ -18092,6 +18876,77 @@ func (x *PollAdditionalMetadata) GetPollInvalidated() bool { return false } +type PinInChat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PinMessageType *PinInChat_PinMessageType `protobuf:"varint,1,opt,name=pinMessageType,enum=proto.PinInChat_PinMessageType" json:"pinMessageType,omitempty"` + Key *MessageKey `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + SenderTimestampMs *int64 `protobuf:"varint,3,opt,name=senderTimestampMs" json:"senderTimestampMs,omitempty"` + ServerTimestampMs *int64 `protobuf:"varint,4,opt,name=serverTimestampMs" json:"serverTimestampMs,omitempty"` +} + +func (x *PinInChat) Reset() { + *x = PinInChat{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[167] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PinInChat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PinInChat) ProtoMessage() {} + +func (x *PinInChat) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[167] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PinInChat.ProtoReflect.Descriptor instead. +func (*PinInChat) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{167} +} + +func (x *PinInChat) GetPinMessageType() PinInChat_PinMessageType { + if x != nil && x.PinMessageType != nil { + return *x.PinMessageType + } + return PinInChat_UNKNOWN_PIN_MESSAGE_TYPE +} + +func (x *PinInChat) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *PinInChat) GetSenderTimestampMs() int64 { + if x != nil && x.SenderTimestampMs != nil { + return *x.SenderTimestampMs + } + return 0 +} + +func (x *PinInChat) GetServerTimestampMs() int64 { + if x != nil && x.ServerTimestampMs != nil { + return *x.ServerTimestampMs + } + return 0 +} + type PhotoChange struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -18105,7 +18960,7 @@ type PhotoChange struct { func (x *PhotoChange) Reset() { *x = PhotoChange{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[161] + mi := &file_binary_proto_def_proto_msgTypes[168] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18118,7 +18973,7 @@ func (x *PhotoChange) String() string { func (*PhotoChange) ProtoMessage() {} func (x *PhotoChange) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[161] + mi := &file_binary_proto_def_proto_msgTypes[168] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18131,7 +18986,7 @@ func (x *PhotoChange) ProtoReflect() protoreflect.Message { // Deprecated: Use PhotoChange.ProtoReflect.Descriptor instead. func (*PhotoChange) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{161} + return file_binary_proto_def_proto_rawDescGZIP(), []int{168} } func (x *PhotoChange) GetOldPhoto() []byte { @@ -18178,7 +19033,7 @@ type PaymentInfo struct { func (x *PaymentInfo) Reset() { *x = PaymentInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[162] + mi := &file_binary_proto_def_proto_msgTypes[169] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18191,7 +19046,7 @@ func (x *PaymentInfo) String() string { func (*PaymentInfo) ProtoMessage() {} func (x *PaymentInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[162] + mi := &file_binary_proto_def_proto_msgTypes[169] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18204,7 +19059,7 @@ func (x *PaymentInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use PaymentInfo.ProtoReflect.Descriptor instead. func (*PaymentInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{162} + return file_binary_proto_def_proto_rawDescGZIP(), []int{169} } func (x *PaymentInfo) GetCurrencyDeprecated() PaymentInfo_Currency { @@ -18312,7 +19167,7 @@ type NotificationMessageInfo struct { func (x *NotificationMessageInfo) Reset() { *x = NotificationMessageInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[163] + mi := &file_binary_proto_def_proto_msgTypes[170] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18325,7 +19180,7 @@ func (x *NotificationMessageInfo) String() string { func (*NotificationMessageInfo) ProtoMessage() {} func (x *NotificationMessageInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[163] + mi := &file_binary_proto_def_proto_msgTypes[170] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18338,7 +19193,7 @@ func (x *NotificationMessageInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NotificationMessageInfo.ProtoReflect.Descriptor instead. func (*NotificationMessageInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{163} + return file_binary_proto_def_proto_rawDescGZIP(), []int{170} } func (x *NotificationMessageInfo) GetKey() *MessageKey { @@ -18380,7 +19235,7 @@ type MediaData struct { func (x *MediaData) Reset() { *x = MediaData{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[164] + mi := &file_binary_proto_def_proto_msgTypes[171] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18393,7 +19248,7 @@ func (x *MediaData) String() string { func (*MediaData) ProtoMessage() {} func (x *MediaData) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[164] + mi := &file_binary_proto_def_proto_msgTypes[171] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18406,7 +19261,7 @@ func (x *MediaData) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaData.ProtoReflect.Descriptor instead. func (*MediaData) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{164} + return file_binary_proto_def_proto_rawDescGZIP(), []int{171} } func (x *MediaData) GetLocalPath() string { @@ -18432,7 +19287,7 @@ type KeepInChat struct { func (x *KeepInChat) Reset() { *x = KeepInChat{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[165] + mi := &file_binary_proto_def_proto_msgTypes[172] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18445,7 +19300,7 @@ func (x *KeepInChat) String() string { func (*KeepInChat) ProtoMessage() {} func (x *KeepInChat) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[165] + mi := &file_binary_proto_def_proto_msgTypes[172] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18458,7 +19313,7 @@ func (x *KeepInChat) ProtoReflect() protoreflect.Message { // Deprecated: Use KeepInChat.ProtoReflect.Descriptor instead. func (*KeepInChat) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{165} + return file_binary_proto_def_proto_rawDescGZIP(), []int{172} } func (x *KeepInChat) GetKeepType() KeepType { @@ -18515,7 +19370,7 @@ type NoiseCertificate struct { func (x *NoiseCertificate) Reset() { *x = NoiseCertificate{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[166] + mi := &file_binary_proto_def_proto_msgTypes[173] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18528,7 +19383,7 @@ func (x *NoiseCertificate) String() string { func (*NoiseCertificate) ProtoMessage() {} func (x *NoiseCertificate) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[166] + mi := &file_binary_proto_def_proto_msgTypes[173] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18541,7 +19396,7 @@ func (x *NoiseCertificate) ProtoReflect() protoreflect.Message { // Deprecated: Use NoiseCertificate.ProtoReflect.Descriptor instead. func (*NoiseCertificate) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{166} + return file_binary_proto_def_proto_rawDescGZIP(), []int{173} } func (x *NoiseCertificate) GetDetails() []byte { @@ -18570,7 +19425,7 @@ type CertChain struct { func (x *CertChain) Reset() { *x = CertChain{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[167] + mi := &file_binary_proto_def_proto_msgTypes[174] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18583,7 +19438,7 @@ func (x *CertChain) String() string { func (*CertChain) ProtoMessage() {} func (x *CertChain) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[167] + mi := &file_binary_proto_def_proto_msgTypes[174] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18596,7 +19451,7 @@ func (x *CertChain) ProtoReflect() protoreflect.Message { // Deprecated: Use CertChain.ProtoReflect.Descriptor instead. func (*CertChain) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{167} + return file_binary_proto_def_proto_rawDescGZIP(), []int{174} } func (x *CertChain) GetLeaf() *CertChain_NoiseCertificate { @@ -18618,15 +19473,17 @@ type DeviceProps_HistorySyncConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FullSyncDaysLimit *uint32 `protobuf:"varint,1,opt,name=fullSyncDaysLimit" json:"fullSyncDaysLimit,omitempty"` - FullSyncSizeMbLimit *uint32 `protobuf:"varint,2,opt,name=fullSyncSizeMbLimit" json:"fullSyncSizeMbLimit,omitempty"` - StorageQuotaMb *uint32 `protobuf:"varint,3,opt,name=storageQuotaMb" json:"storageQuotaMb,omitempty"` + FullSyncDaysLimit *uint32 `protobuf:"varint,1,opt,name=fullSyncDaysLimit" json:"fullSyncDaysLimit,omitempty"` + FullSyncSizeMbLimit *uint32 `protobuf:"varint,2,opt,name=fullSyncSizeMbLimit" json:"fullSyncSizeMbLimit,omitempty"` + StorageQuotaMb *uint32 `protobuf:"varint,3,opt,name=storageQuotaMb" json:"storageQuotaMb,omitempty"` + InlineInitialPayloadInE2EeMsg *bool `protobuf:"varint,4,opt,name=inlineInitialPayloadInE2EeMsg" json:"inlineInitialPayloadInE2EeMsg,omitempty"` + RecentSyncDaysLimit *uint32 `protobuf:"varint,5,opt,name=recentSyncDaysLimit" json:"recentSyncDaysLimit,omitempty"` } func (x *DeviceProps_HistorySyncConfig) Reset() { *x = DeviceProps_HistorySyncConfig{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[168] + mi := &file_binary_proto_def_proto_msgTypes[175] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18639,7 +19496,7 @@ func (x *DeviceProps_HistorySyncConfig) String() string { func (*DeviceProps_HistorySyncConfig) ProtoMessage() {} func (x *DeviceProps_HistorySyncConfig) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[168] + mi := &file_binary_proto_def_proto_msgTypes[175] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18676,6 +19533,20 @@ func (x *DeviceProps_HistorySyncConfig) GetStorageQuotaMb() uint32 { return 0 } +func (x *DeviceProps_HistorySyncConfig) GetInlineInitialPayloadInE2EeMsg() bool { + if x != nil && x.InlineInitialPayloadInE2EeMsg != nil { + return *x.InlineInitialPayloadInE2EeMsg + } + return false +} + +func (x *DeviceProps_HistorySyncConfig) GetRecentSyncDaysLimit() uint32 { + if x != nil && x.RecentSyncDaysLimit != nil { + return *x.RecentSyncDaysLimit + } + return 0 +} + type DeviceProps_AppVersion struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -18691,7 +19562,7 @@ type DeviceProps_AppVersion struct { func (x *DeviceProps_AppVersion) Reset() { *x = DeviceProps_AppVersion{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[169] + mi := &file_binary_proto_def_proto_msgTypes[176] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18704,7 +19575,7 @@ func (x *DeviceProps_AppVersion) String() string { func (*DeviceProps_AppVersion) ProtoMessage() {} func (x *DeviceProps_AppVersion) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[169] + mi := &file_binary_proto_def_proto_msgTypes[176] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18755,100 +19626,6 @@ func (x *DeviceProps_AppVersion) GetQuinary() uint32 { return 0 } -type PeerDataOperationRequestMessage_RequestUrlPreview struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` -} - -func (x *PeerDataOperationRequestMessage_RequestUrlPreview) Reset() { - *x = PeerDataOperationRequestMessage_RequestUrlPreview{} - if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[170] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestMessage_RequestUrlPreview) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestMessage_RequestUrlPreview) ProtoMessage() {} - -func (x *PeerDataOperationRequestMessage_RequestUrlPreview) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[170] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestMessage_RequestUrlPreview.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestMessage_RequestUrlPreview) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *PeerDataOperationRequestMessage_RequestUrlPreview) GetUrl() string { - if x != nil && x.Url != nil { - return *x.Url - } - return "" -} - -type PeerDataOperationRequestMessage_RequestStickerReupload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FileSha256 *string `protobuf:"bytes,1,opt,name=fileSha256" json:"fileSha256,omitempty"` -} - -func (x *PeerDataOperationRequestMessage_RequestStickerReupload) Reset() { - *x = PeerDataOperationRequestMessage_RequestStickerReupload{} - if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[171] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerDataOperationRequestMessage_RequestStickerReupload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerDataOperationRequestMessage_RequestStickerReupload) ProtoMessage() {} - -func (x *PeerDataOperationRequestMessage_RequestStickerReupload) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[171] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerDataOperationRequestMessage_RequestStickerReupload.ProtoReflect.Descriptor instead. -func (*PeerDataOperationRequestMessage_RequestStickerReupload) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{6, 1} -} - -func (x *PeerDataOperationRequestMessage_RequestStickerReupload) GetFileSha256() string { - if x != nil && x.FileSha256 != nil { - return *x.FileSha256 - } - return "" -} - type ListResponseMessage_SingleSelectReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -18860,7 +19637,7 @@ type ListResponseMessage_SingleSelectReply struct { func (x *ListResponseMessage_SingleSelectReply) Reset() { *x = ListResponseMessage_SingleSelectReply{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[172] + mi := &file_binary_proto_def_proto_msgTypes[177] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18873,7 +19650,7 @@ func (x *ListResponseMessage_SingleSelectReply) String() string { func (*ListResponseMessage_SingleSelectReply) ProtoMessage() {} func (x *ListResponseMessage_SingleSelectReply) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[172] + mi := &file_binary_proto_def_proto_msgTypes[177] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18886,7 +19663,7 @@ func (x *ListResponseMessage_SingleSelectReply) ProtoReflect() protoreflect.Mess // Deprecated: Use ListResponseMessage_SingleSelectReply.ProtoReflect.Descriptor instead. func (*ListResponseMessage_SingleSelectReply) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{10, 0} } func (x *ListResponseMessage_SingleSelectReply) GetSelectedRowId() string { @@ -18908,7 +19685,7 @@ type ListMessage_Section struct { func (x *ListMessage_Section) Reset() { *x = ListMessage_Section{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[173] + mi := &file_binary_proto_def_proto_msgTypes[178] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18921,7 +19698,7 @@ func (x *ListMessage_Section) String() string { func (*ListMessage_Section) ProtoMessage() {} func (x *ListMessage_Section) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[173] + mi := &file_binary_proto_def_proto_msgTypes[178] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18934,7 +19711,7 @@ func (x *ListMessage_Section) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMessage_Section.ProtoReflect.Descriptor instead. func (*ListMessage_Section) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 0} } func (x *ListMessage_Section) GetTitle() string { @@ -18964,7 +19741,7 @@ type ListMessage_Row struct { func (x *ListMessage_Row) Reset() { *x = ListMessage_Row{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[174] + mi := &file_binary_proto_def_proto_msgTypes[179] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -18977,7 +19754,7 @@ func (x *ListMessage_Row) String() string { func (*ListMessage_Row) ProtoMessage() {} func (x *ListMessage_Row) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[174] + mi := &file_binary_proto_def_proto_msgTypes[179] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -18990,7 +19767,7 @@ func (x *ListMessage_Row) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMessage_Row.ProtoReflect.Descriptor instead. func (*ListMessage_Row) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 1} } func (x *ListMessage_Row) GetTitle() string { @@ -19025,7 +19802,7 @@ type ListMessage_Product struct { func (x *ListMessage_Product) Reset() { *x = ListMessage_Product{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[175] + mi := &file_binary_proto_def_proto_msgTypes[180] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19038,7 +19815,7 @@ func (x *ListMessage_Product) String() string { func (*ListMessage_Product) ProtoMessage() {} func (x *ListMessage_Product) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[175] + mi := &file_binary_proto_def_proto_msgTypes[180] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19051,7 +19828,7 @@ func (x *ListMessage_Product) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMessage_Product.ProtoReflect.Descriptor instead. func (*ListMessage_Product) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 2} } func (x *ListMessage_Product) GetProductId() string { @@ -19073,7 +19850,7 @@ type ListMessage_ProductSection struct { func (x *ListMessage_ProductSection) Reset() { *x = ListMessage_ProductSection{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[176] + mi := &file_binary_proto_def_proto_msgTypes[181] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19086,7 +19863,7 @@ func (x *ListMessage_ProductSection) String() string { func (*ListMessage_ProductSection) ProtoMessage() {} func (x *ListMessage_ProductSection) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[176] + mi := &file_binary_proto_def_proto_msgTypes[181] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19099,7 +19876,7 @@ func (x *ListMessage_ProductSection) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMessage_ProductSection.ProtoReflect.Descriptor instead. func (*ListMessage_ProductSection) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 3} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 3} } func (x *ListMessage_ProductSection) GetTitle() string { @@ -19129,7 +19906,7 @@ type ListMessage_ProductListInfo struct { func (x *ListMessage_ProductListInfo) Reset() { *x = ListMessage_ProductListInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[177] + mi := &file_binary_proto_def_proto_msgTypes[182] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19142,7 +19919,7 @@ func (x *ListMessage_ProductListInfo) String() string { func (*ListMessage_ProductListInfo) ProtoMessage() {} func (x *ListMessage_ProductListInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[177] + mi := &file_binary_proto_def_proto_msgTypes[182] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19155,7 +19932,7 @@ func (x *ListMessage_ProductListInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMessage_ProductListInfo.ProtoReflect.Descriptor instead. func (*ListMessage_ProductListInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 4} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 4} } func (x *ListMessage_ProductListInfo) GetProductSections() []*ListMessage_ProductSection { @@ -19191,7 +19968,7 @@ type ListMessage_ProductListHeaderImage struct { func (x *ListMessage_ProductListHeaderImage) Reset() { *x = ListMessage_ProductListHeaderImage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[178] + mi := &file_binary_proto_def_proto_msgTypes[183] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19204,7 +19981,7 @@ func (x *ListMessage_ProductListHeaderImage) String() string { func (*ListMessage_ProductListHeaderImage) ProtoMessage() {} func (x *ListMessage_ProductListHeaderImage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[178] + mi := &file_binary_proto_def_proto_msgTypes[183] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19217,7 +19994,7 @@ func (x *ListMessage_ProductListHeaderImage) ProtoReflect() protoreflect.Message // Deprecated: Use ListMessage_ProductListHeaderImage.ProtoReflect.Descriptor instead. func (*ListMessage_ProductListHeaderImage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 5} + return file_binary_proto_def_proto_rawDescGZIP(), []int{11, 5} } func (x *ListMessage_ProductListHeaderImage) GetProductId() string { @@ -19247,7 +20024,7 @@ type InteractiveResponseMessage_NativeFlowResponseMessage struct { func (x *InteractiveResponseMessage_NativeFlowResponseMessage) Reset() { *x = InteractiveResponseMessage_NativeFlowResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[179] + mi := &file_binary_proto_def_proto_msgTypes[184] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19260,7 +20037,7 @@ func (x *InteractiveResponseMessage_NativeFlowResponseMessage) String() string { func (*InteractiveResponseMessage_NativeFlowResponseMessage) ProtoMessage() {} func (x *InteractiveResponseMessage_NativeFlowResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[179] + mi := &file_binary_proto_def_proto_msgTypes[184] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19273,7 +20050,7 @@ func (x *InteractiveResponseMessage_NativeFlowResponseMessage) ProtoReflect() pr // Deprecated: Use InteractiveResponseMessage_NativeFlowResponseMessage.ProtoReflect.Descriptor instead. func (*InteractiveResponseMessage_NativeFlowResponseMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{14, 0} } func (x *InteractiveResponseMessage_NativeFlowResponseMessage) GetName() string { @@ -19302,13 +20079,14 @@ type InteractiveResponseMessage_Body struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Text *string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + Text *string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + Format *InteractiveResponseMessage_Body_Format `protobuf:"varint,2,opt,name=format,enum=proto.InteractiveResponseMessage_Body_Format" json:"format,omitempty"` } func (x *InteractiveResponseMessage_Body) Reset() { *x = InteractiveResponseMessage_Body{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[180] + mi := &file_binary_proto_def_proto_msgTypes[185] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19321,7 +20099,7 @@ func (x *InteractiveResponseMessage_Body) String() string { func (*InteractiveResponseMessage_Body) ProtoMessage() {} func (x *InteractiveResponseMessage_Body) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[180] + mi := &file_binary_proto_def_proto_msgTypes[185] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19334,7 +20112,7 @@ func (x *InteractiveResponseMessage_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveResponseMessage_Body.ProtoReflect.Descriptor instead. func (*InteractiveResponseMessage_Body) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{14, 1} } func (x *InteractiveResponseMessage_Body) GetText() string { @@ -19344,6 +20122,13 @@ func (x *InteractiveResponseMessage_Body) GetText() string { return "" } +func (x *InteractiveResponseMessage_Body) GetFormat() InteractiveResponseMessage_Body_Format { + if x != nil && x.Format != nil { + return *x.Format + } + return InteractiveResponseMessage_Body_DEFAULT +} + type InteractiveMessage_ShopMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -19357,7 +20142,7 @@ type InteractiveMessage_ShopMessage struct { func (x *InteractiveMessage_ShopMessage) Reset() { *x = InteractiveMessage_ShopMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[181] + mi := &file_binary_proto_def_proto_msgTypes[186] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19370,7 +20155,7 @@ func (x *InteractiveMessage_ShopMessage) String() string { func (*InteractiveMessage_ShopMessage) ProtoMessage() {} func (x *InteractiveMessage_ShopMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[181] + mi := &file_binary_proto_def_proto_msgTypes[186] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19383,7 +20168,7 @@ func (x *InteractiveMessage_ShopMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveMessage_ShopMessage.ProtoReflect.Descriptor instead. func (*InteractiveMessage_ShopMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 0} } func (x *InteractiveMessage_ShopMessage) GetId() string { @@ -19420,7 +20205,7 @@ type InteractiveMessage_NativeFlowMessage struct { func (x *InteractiveMessage_NativeFlowMessage) Reset() { *x = InteractiveMessage_NativeFlowMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[182] + mi := &file_binary_proto_def_proto_msgTypes[187] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19433,7 +20218,7 @@ func (x *InteractiveMessage_NativeFlowMessage) String() string { func (*InteractiveMessage_NativeFlowMessage) ProtoMessage() {} func (x *InteractiveMessage_NativeFlowMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[182] + mi := &file_binary_proto_def_proto_msgTypes[187] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19446,7 +20231,7 @@ func (x *InteractiveMessage_NativeFlowMessage) ProtoReflect() protoreflect.Messa // Deprecated: Use InteractiveMessage_NativeFlowMessage.ProtoReflect.Descriptor instead. func (*InteractiveMessage_NativeFlowMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 1} } func (x *InteractiveMessage_NativeFlowMessage) GetButtons() []*InteractiveMessage_NativeFlowMessage_NativeFlowButton { @@ -19490,7 +20275,7 @@ type InteractiveMessage_Header struct { func (x *InteractiveMessage_Header) Reset() { *x = InteractiveMessage_Header{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[183] + mi := &file_binary_proto_def_proto_msgTypes[188] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19503,7 +20288,7 @@ func (x *InteractiveMessage_Header) String() string { func (*InteractiveMessage_Header) ProtoMessage() {} func (x *InteractiveMessage_Header) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[183] + mi := &file_binary_proto_def_proto_msgTypes[188] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19516,7 +20301,7 @@ func (x *InteractiveMessage_Header) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveMessage_Header.ProtoReflect.Descriptor instead. func (*InteractiveMessage_Header) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 2} } func (x *InteractiveMessage_Header) GetTitle() string { @@ -19614,7 +20399,7 @@ type InteractiveMessage_Footer struct { func (x *InteractiveMessage_Footer) Reset() { *x = InteractiveMessage_Footer{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[184] + mi := &file_binary_proto_def_proto_msgTypes[189] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19627,7 +20412,7 @@ func (x *InteractiveMessage_Footer) String() string { func (*InteractiveMessage_Footer) ProtoMessage() {} func (x *InteractiveMessage_Footer) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[184] + mi := &file_binary_proto_def_proto_msgTypes[189] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19640,7 +20425,7 @@ func (x *InteractiveMessage_Footer) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveMessage_Footer.ProtoReflect.Descriptor instead. func (*InteractiveMessage_Footer) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 3} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 3} } func (x *InteractiveMessage_Footer) GetText() string { @@ -19663,7 +20448,7 @@ type InteractiveMessage_CollectionMessage struct { func (x *InteractiveMessage_CollectionMessage) Reset() { *x = InteractiveMessage_CollectionMessage{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[185] + mi := &file_binary_proto_def_proto_msgTypes[190] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19676,7 +20461,7 @@ func (x *InteractiveMessage_CollectionMessage) String() string { func (*InteractiveMessage_CollectionMessage) ProtoMessage() {} func (x *InteractiveMessage_CollectionMessage) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[185] + mi := &file_binary_proto_def_proto_msgTypes[190] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19689,7 +20474,7 @@ func (x *InteractiveMessage_CollectionMessage) ProtoReflect() protoreflect.Messa // Deprecated: Use InteractiveMessage_CollectionMessage.ProtoReflect.Descriptor instead. func (*InteractiveMessage_CollectionMessage) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 4} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 4} } func (x *InteractiveMessage_CollectionMessage) GetBizJid() string { @@ -19724,7 +20509,7 @@ type InteractiveMessage_Body struct { func (x *InteractiveMessage_Body) Reset() { *x = InteractiveMessage_Body{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[186] + mi := &file_binary_proto_def_proto_msgTypes[191] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19737,7 +20522,7 @@ func (x *InteractiveMessage_Body) String() string { func (*InteractiveMessage_Body) ProtoMessage() {} func (x *InteractiveMessage_Body) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[186] + mi := &file_binary_proto_def_proto_msgTypes[191] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19750,7 +20535,7 @@ func (x *InteractiveMessage_Body) ProtoReflect() protoreflect.Message { // Deprecated: Use InteractiveMessage_Body.ProtoReflect.Descriptor instead. func (*InteractiveMessage_Body) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 5} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 5} } func (x *InteractiveMessage_Body) GetText() string { @@ -19772,7 +20557,7 @@ type InteractiveMessage_NativeFlowMessage_NativeFlowButton struct { func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) Reset() { *x = InteractiveMessage_NativeFlowMessage_NativeFlowButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[187] + mi := &file_binary_proto_def_proto_msgTypes[192] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19785,7 +20570,7 @@ func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) String() string func (*InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoMessage() {} func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[187] + mi := &file_binary_proto_def_proto_msgTypes[192] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19798,7 +20583,7 @@ func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoReflect() p // Deprecated: Use InteractiveMessage_NativeFlowMessage_NativeFlowButton.ProtoReflect.Descriptor instead. func (*InteractiveMessage_NativeFlowMessage_NativeFlowButton) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 1, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 1, 0} } func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) GetName() string { @@ -19831,7 +20616,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter struct { func (x *HighlyStructuredMessage_HSMLocalizableParameter) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[188] + mi := &file_binary_proto_def_proto_msgTypes[193] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19844,7 +20629,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter) String() string { func (*HighlyStructuredMessage_HSMLocalizableParameter) ProtoMessage() {} func (x *HighlyStructuredMessage_HSMLocalizableParameter) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[188] + mi := &file_binary_proto_def_proto_msgTypes[193] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19857,7 +20642,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter) ProtoReflect() protore // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter.ProtoReflect.Descriptor instead. func (*HighlyStructuredMessage_HSMLocalizableParameter) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0} } func (x *HighlyStructuredMessage_HSMLocalizableParameter) GetDefault() string { @@ -19921,7 +20706,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime struct { func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[189] + mi := &file_binary_proto_def_proto_msgTypes[194] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -19934,7 +20719,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) String() s func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoMessage() {} func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[189] + mi := &file_binary_proto_def_proto_msgTypes[194] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -19947,7 +20732,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoRefle // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime.ProtoReflect.Descriptor instead. func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0, 0} } func (m *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) GetDatetimeOneof() isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof { @@ -20001,7 +20786,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency struct { func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[190] + mi := &file_binary_proto_def_proto_msgTypes[195] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20014,7 +20799,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) String() s func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoMessage() {} func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[190] + mi := &file_binary_proto_def_proto_msgTypes[195] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20027,7 +20812,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoRefle // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency.ProtoReflect.Descriptor instead. func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0, 1} } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) GetCurrencyCode() string { @@ -20055,7 +20840,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnix func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[191] + mi := &file_binary_proto_def_proto_msgTypes[196] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20069,7 +20854,7 @@ func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUn } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[191] + mi := &file_binary_proto_def_proto_msgTypes[196] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20082,7 +20867,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTime // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch.ProtoReflect.Descriptor instead. func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0, 0, 0} } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) GetTimestamp() int64 { @@ -20109,7 +20894,7 @@ type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComp func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) Reset() { *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[192] + mi := &file_binary_proto_def_proto_msgTypes[197] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20123,7 +20908,7 @@ func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeCo } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[192] + mi := &file_binary_proto_def_proto_msgTypes[197] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20136,7 +20921,7 @@ func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTime // Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent.ProtoReflect.Descriptor instead. func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0, 0, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{19, 0, 0, 1} } func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetDayOfWeek() HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType { @@ -20202,7 +20987,7 @@ type ButtonsMessage_Button struct { func (x *ButtonsMessage_Button) Reset() { *x = ButtonsMessage_Button{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[193] + mi := &file_binary_proto_def_proto_msgTypes[198] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20215,7 +21000,7 @@ func (x *ButtonsMessage_Button) String() string { func (*ButtonsMessage_Button) ProtoMessage() {} func (x *ButtonsMessage_Button) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[193] + mi := &file_binary_proto_def_proto_msgTypes[198] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20271,7 +21056,7 @@ type ButtonsMessage_Button_NativeFlowInfo struct { func (x *ButtonsMessage_Button_NativeFlowInfo) Reset() { *x = ButtonsMessage_Button_NativeFlowInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[194] + mi := &file_binary_proto_def_proto_msgTypes[199] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20284,7 +21069,7 @@ func (x *ButtonsMessage_Button_NativeFlowInfo) String() string { func (*ButtonsMessage_Button_NativeFlowInfo) ProtoMessage() {} func (x *ButtonsMessage_Button_NativeFlowInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[194] + mi := &file_binary_proto_def_proto_msgTypes[199] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20325,7 +21110,7 @@ type ButtonsMessage_Button_ButtonText struct { func (x *ButtonsMessage_Button_ButtonText) Reset() { *x = ButtonsMessage_Button_ButtonText{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[195] + mi := &file_binary_proto_def_proto_msgTypes[200] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20338,7 +21123,7 @@ func (x *ButtonsMessage_Button_ButtonText) String() string { func (*ButtonsMessage_Button_ButtonText) ProtoMessage() {} func (x *ButtonsMessage_Button_ButtonText) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[195] + mi := &file_binary_proto_def_proto_msgTypes[200] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20373,7 +21158,7 @@ type HydratedTemplateButton_HydratedURLButton struct { func (x *HydratedTemplateButton_HydratedURLButton) Reset() { *x = HydratedTemplateButton_HydratedURLButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[196] + mi := &file_binary_proto_def_proto_msgTypes[201] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20386,7 +21171,7 @@ func (x *HydratedTemplateButton_HydratedURLButton) String() string { func (*HydratedTemplateButton_HydratedURLButton) ProtoMessage() {} func (x *HydratedTemplateButton_HydratedURLButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[196] + mi := &file_binary_proto_def_proto_msgTypes[201] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20428,7 +21213,7 @@ type HydratedTemplateButton_HydratedQuickReplyButton struct { func (x *HydratedTemplateButton_HydratedQuickReplyButton) Reset() { *x = HydratedTemplateButton_HydratedQuickReplyButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[197] + mi := &file_binary_proto_def_proto_msgTypes[202] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20441,7 +21226,7 @@ func (x *HydratedTemplateButton_HydratedQuickReplyButton) String() string { func (*HydratedTemplateButton_HydratedQuickReplyButton) ProtoMessage() {} func (x *HydratedTemplateButton_HydratedQuickReplyButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[197] + mi := &file_binary_proto_def_proto_msgTypes[202] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20483,7 +21268,7 @@ type HydratedTemplateButton_HydratedCallButton struct { func (x *HydratedTemplateButton_HydratedCallButton) Reset() { *x = HydratedTemplateButton_HydratedCallButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[198] + mi := &file_binary_proto_def_proto_msgTypes[203] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20496,7 +21281,7 @@ func (x *HydratedTemplateButton_HydratedCallButton) String() string { func (*HydratedTemplateButton_HydratedCallButton) ProtoMessage() {} func (x *HydratedTemplateButton_HydratedCallButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[198] + mi := &file_binary_proto_def_proto_msgTypes[203] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20538,7 +21323,7 @@ type ContextInfo_UTMInfo struct { func (x *ContextInfo_UTMInfo) Reset() { *x = ContextInfo_UTMInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[199] + mi := &file_binary_proto_def_proto_msgTypes[204] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20551,7 +21336,7 @@ func (x *ContextInfo_UTMInfo) String() string { func (*ContextInfo_UTMInfo) ProtoMessage() {} func (x *ContextInfo_UTMInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[199] + mi := &file_binary_proto_def_proto_msgTypes[204] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20604,7 +21389,7 @@ type ContextInfo_ExternalAdReplyInfo struct { func (x *ContextInfo_ExternalAdReplyInfo) Reset() { *x = ContextInfo_ExternalAdReplyInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[200] + mi := &file_binary_proto_def_proto_msgTypes[205] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20617,7 +21402,7 @@ func (x *ContextInfo_ExternalAdReplyInfo) String() string { func (*ContextInfo_ExternalAdReplyInfo) ProtoMessage() {} func (x *ContextInfo_ExternalAdReplyInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[200] + mi := &file_binary_proto_def_proto_msgTypes[205] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20738,7 +21523,7 @@ type ContextInfo_AdReplyInfo struct { func (x *ContextInfo_AdReplyInfo) Reset() { *x = ContextInfo_AdReplyInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[201] + mi := &file_binary_proto_def_proto_msgTypes[206] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20751,7 +21536,7 @@ func (x *ContextInfo_AdReplyInfo) String() string { func (*ContextInfo_AdReplyInfo) ProtoMessage() {} func (x *ContextInfo_AdReplyInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[201] + mi := &file_binary_proto_def_proto_msgTypes[206] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20807,7 +21592,7 @@ type TemplateButton_URLButton struct { func (x *TemplateButton_URLButton) Reset() { *x = TemplateButton_URLButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[202] + mi := &file_binary_proto_def_proto_msgTypes[207] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20820,7 +21605,7 @@ func (x *TemplateButton_URLButton) String() string { func (*TemplateButton_URLButton) ProtoMessage() {} func (x *TemplateButton_URLButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[202] + mi := &file_binary_proto_def_proto_msgTypes[207] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20862,7 +21647,7 @@ type TemplateButton_QuickReplyButton struct { func (x *TemplateButton_QuickReplyButton) Reset() { *x = TemplateButton_QuickReplyButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[203] + mi := &file_binary_proto_def_proto_msgTypes[208] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20875,7 +21660,7 @@ func (x *TemplateButton_QuickReplyButton) String() string { func (*TemplateButton_QuickReplyButton) ProtoMessage() {} func (x *TemplateButton_QuickReplyButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[203] + mi := &file_binary_proto_def_proto_msgTypes[208] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20917,7 +21702,7 @@ type TemplateButton_CallButton struct { func (x *TemplateButton_CallButton) Reset() { *x = TemplateButton_CallButton{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[204] + mi := &file_binary_proto_def_proto_msgTypes[209] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20930,7 +21715,7 @@ func (x *TemplateButton_CallButton) String() string { func (*TemplateButton_CallButton) ProtoMessage() {} func (x *TemplateButton_CallButton) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[204] + mi := &file_binary_proto_def_proto_msgTypes[209] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -20975,7 +21760,7 @@ type PaymentBackground_MediaData struct { func (x *PaymentBackground_MediaData) Reset() { *x = PaymentBackground_MediaData{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[205] + mi := &file_binary_proto_def_proto_msgTypes[210] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -20988,7 +21773,7 @@ func (x *PaymentBackground_MediaData) String() string { func (*PaymentBackground_MediaData) ProtoMessage() {} func (x *PaymentBackground_MediaData) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[205] + mi := &file_binary_proto_def_proto_msgTypes[210] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21061,7 +21846,7 @@ type TemplateMessage_HydratedFourRowTemplate struct { func (x *TemplateMessage_HydratedFourRowTemplate) Reset() { *x = TemplateMessage_HydratedFourRowTemplate{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[206] + mi := &file_binary_proto_def_proto_msgTypes[211] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21074,7 +21859,7 @@ func (x *TemplateMessage_HydratedFourRowTemplate) String() string { func (*TemplateMessage_HydratedFourRowTemplate) ProtoMessage() {} func (x *TemplateMessage_HydratedFourRowTemplate) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[206] + mi := &file_binary_proto_def_proto_msgTypes[211] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21220,7 +22005,7 @@ type TemplateMessage_FourRowTemplate struct { func (x *TemplateMessage_FourRowTemplate) Reset() { *x = TemplateMessage_FourRowTemplate{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[207] + mi := &file_binary_proto_def_proto_msgTypes[212] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21233,7 +22018,7 @@ func (x *TemplateMessage_FourRowTemplate) String() string { func (*TemplateMessage_FourRowTemplate) ProtoMessage() {} func (x *TemplateMessage_FourRowTemplate) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[207] + mi := &file_binary_proto_def_proto_msgTypes[212] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21368,7 +22153,7 @@ type ProductMessage_ProductSnapshot struct { func (x *ProductMessage_ProductSnapshot) Reset() { *x = ProductMessage_ProductSnapshot{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[208] + mi := &file_binary_proto_def_proto_msgTypes[213] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21381,7 +22166,7 @@ func (x *ProductMessage_ProductSnapshot) String() string { func (*ProductMessage_ProductSnapshot) ProtoMessage() {} func (x *ProductMessage_ProductSnapshot) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[208] + mi := &file_binary_proto_def_proto_msgTypes[213] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21487,7 +22272,7 @@ type ProductMessage_CatalogSnapshot struct { func (x *ProductMessage_CatalogSnapshot) Reset() { *x = ProductMessage_CatalogSnapshot{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[209] + mi := &file_binary_proto_def_proto_msgTypes[214] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21500,7 +22285,7 @@ func (x *ProductMessage_CatalogSnapshot) String() string { func (*ProductMessage_CatalogSnapshot) ProtoMessage() {} func (x *ProductMessage_CatalogSnapshot) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[209] + mi := &file_binary_proto_def_proto_msgTypes[214] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21548,7 +22333,7 @@ type PollCreationMessage_Option struct { func (x *PollCreationMessage_Option) Reset() { *x = PollCreationMessage_Option{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[210] + mi := &file_binary_proto_def_proto_msgTypes[215] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21561,7 +22346,7 @@ func (x *PollCreationMessage_Option) String() string { func (*PollCreationMessage_Option) ProtoMessage() {} func (x *PollCreationMessage_Option) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[210] + mi := &file_binary_proto_def_proto_msgTypes[215] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21589,15 +22374,16 @@ type PeerDataOperationRequestResponseMessage_PeerDataOperationResult struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MediaUploadResult *MediaRetryNotification_ResultType `protobuf:"varint,1,opt,name=mediaUploadResult,enum=proto.MediaRetryNotification_ResultType" json:"mediaUploadResult,omitempty"` - StickerMessage *StickerMessage `protobuf:"bytes,2,opt,name=stickerMessage" json:"stickerMessage,omitempty"` - LinkPreviewResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse `protobuf:"bytes,3,opt,name=linkPreviewResponse" json:"linkPreviewResponse,omitempty"` + MediaUploadResult *MediaRetryNotification_ResultType `protobuf:"varint,1,opt,name=mediaUploadResult,enum=proto.MediaRetryNotification_ResultType" json:"mediaUploadResult,omitempty"` + StickerMessage *StickerMessage `protobuf:"bytes,2,opt,name=stickerMessage" json:"stickerMessage,omitempty"` + LinkPreviewResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse `protobuf:"bytes,3,opt,name=linkPreviewResponse" json:"linkPreviewResponse,omitempty"` + PlaceholderMessageResendResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse `protobuf:"bytes,4,opt,name=placeholderMessageResendResponse" json:"placeholderMessageResendResponse,omitempty"` } func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Reset() { *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[211] + mi := &file_binary_proto_def_proto_msgTypes[216] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21610,7 +22396,7 @@ func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) String func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoMessage() {} func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[211] + mi := &file_binary_proto_def_proto_msgTypes[216] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21647,24 +22433,80 @@ func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetLin return nil } +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetPlaceholderMessageResendResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse { + if x != nil { + return x.PlaceholderMessageResendResponse + } + return nil +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebMessageInfoBytes []byte `protobuf:"bytes,1,opt,name=webMessageInfoBytes" json:"webMessageInfoBytes,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[217] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[217] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{77, 0, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse) GetWebMessageInfoBytes() []byte { + if x != nil { + return x.WebMessageInfoBytes + } + return nil +} + type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` - Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` - Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - ThumbData []byte `protobuf:"bytes,4,opt,name=thumbData" json:"thumbData,omitempty"` - CanonicalUrl *string `protobuf:"bytes,5,opt,name=canonicalUrl" json:"canonicalUrl,omitempty"` - MatchText *string `protobuf:"bytes,6,opt,name=matchText" json:"matchText,omitempty"` - PreviewType *string `protobuf:"bytes,7,opt,name=previewType" json:"previewType,omitempty"` + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + ThumbData []byte `protobuf:"bytes,4,opt,name=thumbData" json:"thumbData,omitempty"` + CanonicalUrl *string `protobuf:"bytes,5,opt,name=canonicalUrl" json:"canonicalUrl,omitempty"` + MatchText *string `protobuf:"bytes,6,opt,name=matchText" json:"matchText,omitempty"` + PreviewType *string `protobuf:"bytes,7,opt,name=previewType" json:"previewType,omitempty"` + HqThumbnail *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail `protobuf:"bytes,8,opt,name=hqThumbnail" json:"hqThumbnail,omitempty"` } func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Reset() { *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[212] + mi := &file_binary_proto_def_proto_msgTypes[218] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21678,7 +22520,7 @@ func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPrevi } func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[212] + mi := &file_binary_proto_def_proto_msgTypes[218] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21691,7 +22533,7 @@ func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPre // Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse.ProtoReflect.Descriptor instead. func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{77, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{77, 0, 1} } func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetUrl() string { @@ -21743,6 +22585,337 @@ func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPre return "" } +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetHqThumbnail() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail { + if x != nil { + return x.HqThumbnail + } + return nil +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DirectPath *string `protobuf:"bytes,1,opt,name=directPath" json:"directPath,omitempty"` + ThumbHash *string `protobuf:"bytes,2,opt,name=thumbHash" json:"thumbHash,omitempty"` + EncThumbHash *string `protobuf:"bytes,3,opt,name=encThumbHash" json:"encThumbHash,omitempty"` + MediaKey []byte `protobuf:"bytes,4,opt,name=mediaKey" json:"mediaKey,omitempty"` + MediaKeyTimestampMs *int64 `protobuf:"varint,5,opt,name=mediaKeyTimestampMs" json:"mediaKeyTimestampMs,omitempty"` + ThumbWidth *int32 `protobuf:"varint,6,opt,name=thumbWidth" json:"thumbWidth,omitempty"` + ThumbHeight *int32 `protobuf:"varint,7,opt,name=thumbHeight" json:"thumbHeight,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[219] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[219] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{77, 0, 1, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbHash() string { + if x != nil && x.ThumbHash != nil { + return *x.ThumbHash + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetEncThumbHash() string { + if x != nil && x.EncThumbHash != nil { + return *x.EncThumbHash + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetMediaKeyTimestampMs() int64 { + if x != nil && x.MediaKeyTimestampMs != nil { + return *x.MediaKeyTimestampMs + } + return 0 +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbWidth() int32 { + if x != nil && x.ThumbWidth != nil { + return *x.ThumbWidth + } + return 0 +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail) GetThumbHeight() int32 { + if x != nil && x.ThumbHeight != nil { + return *x.ThumbHeight + } + return 0 +} + +type PeerDataOperationRequestMessage_RequestStickerReupload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileSha256 *string `protobuf:"bytes,1,opt,name=fileSha256" json:"fileSha256,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) Reset() { + *x = PeerDataOperationRequestMessage_RequestStickerReupload{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[220] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_RequestStickerReupload) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[220] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_RequestStickerReupload.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_RequestStickerReupload) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{78, 0} +} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) GetFileSha256() string { + if x != nil && x.FileSha256 != nil { + return *x.FileSha256 + } + return "" +} + +type PeerDataOperationRequestMessage_PlaceholderMessageResendRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageKey *MessageKey `protobuf:"bytes,1,opt,name=messageKey" json:"messageKey,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) Reset() { + *x = PeerDataOperationRequestMessage_PlaceholderMessageResendRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[221] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[221] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_PlaceholderMessageResendRequest.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{78, 1} +} + +func (x *PeerDataOperationRequestMessage_PlaceholderMessageResendRequest) GetMessageKey() *MessageKey { + if x != nil { + return x.MessageKey + } + return nil +} + +type PeerDataOperationRequestMessage_HistorySyncOnDemandRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChatJid *string `protobuf:"bytes,1,opt,name=chatJid" json:"chatJid,omitempty"` + OldestMsgId *string `protobuf:"bytes,2,opt,name=oldestMsgId" json:"oldestMsgId,omitempty"` + OldestMsgFromMe *bool `protobuf:"varint,3,opt,name=oldestMsgFromMe" json:"oldestMsgFromMe,omitempty"` + OnDemandMsgCount *int32 `protobuf:"varint,4,opt,name=onDemandMsgCount" json:"onDemandMsgCount,omitempty"` + OldestMsgTimestampMs *int64 `protobuf:"varint,5,opt,name=oldestMsgTimestampMs" json:"oldestMsgTimestampMs,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) Reset() { + *x = PeerDataOperationRequestMessage_HistorySyncOnDemandRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[222] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[222] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_HistorySyncOnDemandRequest.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{78, 2} +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) GetChatJid() string { + if x != nil && x.ChatJid != nil { + return *x.ChatJid + } + return "" +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) GetOldestMsgId() string { + if x != nil && x.OldestMsgId != nil { + return *x.OldestMsgId + } + return "" +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) GetOldestMsgFromMe() bool { + if x != nil && x.OldestMsgFromMe != nil { + return *x.OldestMsgFromMe + } + return false +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) GetOnDemandMsgCount() int32 { + if x != nil && x.OnDemandMsgCount != nil { + return *x.OnDemandMsgCount + } + return 0 +} + +func (x *PeerDataOperationRequestMessage_HistorySyncOnDemandRequest) GetOldestMsgTimestampMs() int64 { + if x != nil && x.OldestMsgTimestampMs != nil { + return *x.OldestMsgTimestampMs + } + return 0 +} + +type PeerDataOperationRequestMessage_RequestUrlPreview struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + IncludeHqThumbnail *bool `protobuf:"varint,2,opt,name=includeHqThumbnail" json:"includeHqThumbnail,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) Reset() { + *x = PeerDataOperationRequestMessage_RequestUrlPreview{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[223] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_RequestUrlPreview) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[223] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_RequestUrlPreview.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_RequestUrlPreview) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{78, 3} +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) GetIncludeHqThumbnail() bool { + if x != nil && x.IncludeHqThumbnail != nil { + return *x.IncludeHqThumbnail + } + return false +} + type MsgOpaqueData_PollOption struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -21754,7 +22927,7 @@ type MsgOpaqueData_PollOption struct { func (x *MsgOpaqueData_PollOption) Reset() { *x = MsgOpaqueData_PollOption{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[213] + mi := &file_binary_proto_def_proto_msgTypes[224] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21767,7 +22940,7 @@ func (x *MsgOpaqueData_PollOption) String() string { func (*MsgOpaqueData_PollOption) ProtoMessage() {} func (x *MsgOpaqueData_PollOption) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[213] + mi := &file_binary_proto_def_proto_msgTypes[224] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21780,7 +22953,7 @@ func (x *MsgOpaqueData_PollOption) ProtoReflect() protoreflect.Message { // Deprecated: Use MsgOpaqueData_PollOption.ProtoReflect.Descriptor instead. func (*MsgOpaqueData_PollOption) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{92, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{94, 0} } func (x *MsgOpaqueData_PollOption) GetName() string { @@ -21805,7 +22978,7 @@ type VerifiedNameCertificate_Details struct { func (x *VerifiedNameCertificate_Details) Reset() { *x = VerifiedNameCertificate_Details{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[214] + mi := &file_binary_proto_def_proto_msgTypes[225] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21818,7 +22991,7 @@ func (x *VerifiedNameCertificate_Details) String() string { func (*VerifiedNameCertificate_Details) ProtoMessage() {} func (x *VerifiedNameCertificate_Details) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[214] + mi := &file_binary_proto_def_proto_msgTypes[225] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21831,7 +23004,7 @@ func (x *VerifiedNameCertificate_Details) ProtoReflect() protoreflect.Message { // Deprecated: Use VerifiedNameCertificate_Details.ProtoReflect.Descriptor instead. func (*VerifiedNameCertificate_Details) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{143, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{149, 0} } func (x *VerifiedNameCertificate_Details) GetSerial() uint64 { @@ -21883,7 +23056,7 @@ type ClientPayload_WebInfo struct { func (x *ClientPayload_WebInfo) Reset() { *x = ClientPayload_WebInfo{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[215] + mi := &file_binary_proto_def_proto_msgTypes[226] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21896,7 +23069,7 @@ func (x *ClientPayload_WebInfo) String() string { func (*ClientPayload_WebInfo) ProtoMessage() {} func (x *ClientPayload_WebInfo) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[215] + mi := &file_binary_proto_def_proto_msgTypes[226] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21909,7 +23082,7 @@ func (x *ClientPayload_WebInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientPayload_WebInfo.ProtoReflect.Descriptor instead. func (*ClientPayload_WebInfo) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 0} } func (x *ClientPayload_WebInfo) GetRefToken() string { @@ -21963,7 +23136,7 @@ type ClientPayload_UserAgent struct { func (x *ClientPayload_UserAgent) Reset() { *x = ClientPayload_UserAgent{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[216] + mi := &file_binary_proto_def_proto_msgTypes[227] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -21976,7 +23149,7 @@ func (x *ClientPayload_UserAgent) String() string { func (*ClientPayload_UserAgent) ProtoMessage() {} func (x *ClientPayload_UserAgent) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[216] + mi := &file_binary_proto_def_proto_msgTypes[227] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -21989,7 +23162,7 @@ func (x *ClientPayload_UserAgent) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientPayload_UserAgent.ProtoReflect.Descriptor instead. func (*ClientPayload_UserAgent) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 1} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 1} } func (x *ClientPayload_UserAgent) GetPlatform() ClientPayload_UserAgent_Platform { @@ -22083,6 +23256,69 @@ func (x *ClientPayload_UserAgent) GetDeviceBoard() string { return "" } +type ClientPayload_InteropData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccountId *uint64 `protobuf:"varint,1,opt,name=accountId" json:"accountId,omitempty"` + IntegratorId *uint32 `protobuf:"varint,2,opt,name=integratorId" json:"integratorId,omitempty"` + Token []byte `protobuf:"bytes,3,opt,name=token" json:"token,omitempty"` +} + +func (x *ClientPayload_InteropData) Reset() { + *x = ClientPayload_InteropData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[228] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_InteropData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_InteropData) ProtoMessage() {} + +func (x *ClientPayload_InteropData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[228] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_InteropData.ProtoReflect.Descriptor instead. +func (*ClientPayload_InteropData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 2} +} + +func (x *ClientPayload_InteropData) GetAccountId() uint64 { + if x != nil && x.AccountId != nil { + return *x.AccountId + } + return 0 +} + +func (x *ClientPayload_InteropData) GetIntegratorId() uint32 { + if x != nil && x.IntegratorId != nil { + return *x.IntegratorId + } + return 0 +} + +func (x *ClientPayload_InteropData) GetToken() []byte { + if x != nil { + return x.Token + } + return nil +} + type ClientPayload_DevicePairingRegistrationData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -22101,7 +23337,7 @@ type ClientPayload_DevicePairingRegistrationData struct { func (x *ClientPayload_DevicePairingRegistrationData) Reset() { *x = ClientPayload_DevicePairingRegistrationData{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[217] + mi := &file_binary_proto_def_proto_msgTypes[229] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22114,7 +23350,7 @@ func (x *ClientPayload_DevicePairingRegistrationData) String() string { func (*ClientPayload_DevicePairingRegistrationData) ProtoMessage() {} func (x *ClientPayload_DevicePairingRegistrationData) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[217] + mi := &file_binary_proto_def_proto_msgTypes[229] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22127,7 +23363,7 @@ func (x *ClientPayload_DevicePairingRegistrationData) ProtoReflect() protoreflec // Deprecated: Use ClientPayload_DevicePairingRegistrationData.ProtoReflect.Descriptor instead. func (*ClientPayload_DevicePairingRegistrationData) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 2} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 3} } func (x *ClientPayload_DevicePairingRegistrationData) GetERegid() []byte { @@ -22198,7 +23434,7 @@ type ClientPayload_DNSSource struct { func (x *ClientPayload_DNSSource) Reset() { *x = ClientPayload_DNSSource{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[218] + mi := &file_binary_proto_def_proto_msgTypes[230] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22211,7 +23447,7 @@ func (x *ClientPayload_DNSSource) String() string { func (*ClientPayload_DNSSource) ProtoMessage() {} func (x *ClientPayload_DNSSource) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[218] + mi := &file_binary_proto_def_proto_msgTypes[230] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22224,7 +23460,7 @@ func (x *ClientPayload_DNSSource) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientPayload_DNSSource.ProtoReflect.Descriptor instead. func (*ClientPayload_DNSSource) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 3} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 4} } func (x *ClientPayload_DNSSource) GetDnsMethod() ClientPayload_DNSSource_DNSResolutionMethod { @@ -22262,7 +23498,7 @@ type ClientPayload_WebInfo_WebdPayload struct { func (x *ClientPayload_WebInfo_WebdPayload) Reset() { *x = ClientPayload_WebInfo_WebdPayload{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[219] + mi := &file_binary_proto_def_proto_msgTypes[231] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22275,7 +23511,7 @@ func (x *ClientPayload_WebInfo_WebdPayload) String() string { func (*ClientPayload_WebInfo_WebdPayload) ProtoMessage() {} func (x *ClientPayload_WebInfo_WebdPayload) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[219] + mi := &file_binary_proto_def_proto_msgTypes[231] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22288,7 +23524,7 @@ func (x *ClientPayload_WebInfo_WebdPayload) ProtoReflect() protoreflect.Message // Deprecated: Use ClientPayload_WebInfo_WebdPayload.ProtoReflect.Descriptor instead. func (*ClientPayload_WebInfo_WebdPayload) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 0, 0} } func (x *ClientPayload_WebInfo_WebdPayload) GetUsesParticipantInKey() bool { @@ -22383,7 +23619,7 @@ type ClientPayload_UserAgent_AppVersion struct { func (x *ClientPayload_UserAgent_AppVersion) Reset() { *x = ClientPayload_UserAgent_AppVersion{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[220] + mi := &file_binary_proto_def_proto_msgTypes[232] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22396,7 +23632,7 @@ func (x *ClientPayload_UserAgent_AppVersion) String() string { func (*ClientPayload_UserAgent_AppVersion) ProtoMessage() {} func (x *ClientPayload_UserAgent_AppVersion) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[220] + mi := &file_binary_proto_def_proto_msgTypes[232] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22409,7 +23645,7 @@ func (x *ClientPayload_UserAgent_AppVersion) ProtoReflect() protoreflect.Message // Deprecated: Use ClientPayload_UserAgent_AppVersion.ProtoReflect.Descriptor instead. func (*ClientPayload_UserAgent_AppVersion) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{152, 1, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 1, 0} } func (x *ClientPayload_UserAgent_AppVersion) GetPrimary() uint32 { @@ -22462,7 +23698,7 @@ type NoiseCertificate_Details struct { func (x *NoiseCertificate_Details) Reset() { *x = NoiseCertificate_Details{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[221] + mi := &file_binary_proto_def_proto_msgTypes[233] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22475,7 +23711,7 @@ func (x *NoiseCertificate_Details) String() string { func (*NoiseCertificate_Details) ProtoMessage() {} func (x *NoiseCertificate_Details) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[221] + mi := &file_binary_proto_def_proto_msgTypes[233] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22488,7 +23724,7 @@ func (x *NoiseCertificate_Details) ProtoReflect() protoreflect.Message { // Deprecated: Use NoiseCertificate_Details.ProtoReflect.Descriptor instead. func (*NoiseCertificate_Details) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{166, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{173, 0} } func (x *NoiseCertificate_Details) GetSerial() uint32 { @@ -22538,7 +23774,7 @@ type CertChain_NoiseCertificate struct { func (x *CertChain_NoiseCertificate) Reset() { *x = CertChain_NoiseCertificate{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[222] + mi := &file_binary_proto_def_proto_msgTypes[234] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22551,7 +23787,7 @@ func (x *CertChain_NoiseCertificate) String() string { func (*CertChain_NoiseCertificate) ProtoMessage() {} func (x *CertChain_NoiseCertificate) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[222] + mi := &file_binary_proto_def_proto_msgTypes[234] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22564,7 +23800,7 @@ func (x *CertChain_NoiseCertificate) ProtoReflect() protoreflect.Message { // Deprecated: Use CertChain_NoiseCertificate.ProtoReflect.Descriptor instead. func (*CertChain_NoiseCertificate) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{167, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{174, 0} } func (x *CertChain_NoiseCertificate) GetDetails() []byte { @@ -22596,7 +23832,7 @@ type CertChain_NoiseCertificate_Details struct { func (x *CertChain_NoiseCertificate_Details) Reset() { *x = CertChain_NoiseCertificate_Details{} if protoimpl.UnsafeEnabled { - mi := &file_binary_proto_def_proto_msgTypes[223] + mi := &file_binary_proto_def_proto_msgTypes[235] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -22609,7 +23845,7 @@ func (x *CertChain_NoiseCertificate_Details) String() string { func (*CertChain_NoiseCertificate_Details) ProtoMessage() {} func (x *CertChain_NoiseCertificate_Details) ProtoReflect() protoreflect.Message { - mi := &file_binary_proto_def_proto_msgTypes[223] + mi := &file_binary_proto_def_proto_msgTypes[235] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -22622,7 +23858,7 @@ func (x *CertChain_NoiseCertificate_Details) ProtoReflect() protoreflect.Message // Deprecated: Use CertChain_NoiseCertificate_Details.ProtoReflect.Descriptor instead. func (*CertChain_NoiseCertificate_Details) Descriptor() ([]byte, []int) { - return file_binary_proto_def_proto_rawDescGZIP(), []int{167, 0, 0} + return file_binary_proto_def_proto_rawDescGZIP(), []int{174, 0, 0} } func (x *CertChain_NoiseCertificate_Details) GetSerial() uint32 { @@ -22677,8 +23913,8 @@ func file_binary_proto_def_proto_rawDescGZIP() []byte { return file_binary_proto_def_proto_rawDescData } -var file_binary_proto_def_proto_enumTypes = make([]protoimpl.EnumInfo, 56) -var file_binary_proto_def_proto_msgTypes = make([]protoimpl.MessageInfo, 224) +var file_binary_proto_def_proto_enumTypes = make([]protoimpl.EnumInfo, 59) +var file_binary_proto_def_proto_msgTypes = make([]protoimpl.MessageInfo, 236) var file_binary_proto_def_proto_goTypes = []interface{}{ (KeepType)(0), // 0: proto.KeepType (PeerDataOperationRequestType)(0), // 1: proto.PeerDataOperationRequestType @@ -22690,697 +23926,731 @@ var file_binary_proto_def_proto_goTypes = []interface{}{ (ListResponseMessage_ListType)(0), // 7: proto.ListResponseMessage.ListType (ListMessage_ListType)(0), // 8: proto.ListMessage.ListType (InvoiceMessage_AttachmentType)(0), // 9: proto.InvoiceMessage.AttachmentType - (InteractiveMessage_ShopMessage_Surface)(0), // 10: proto.InteractiveMessage.ShopMessage.Surface - (HistorySyncNotification_HistorySyncType)(0), // 11: proto.HistorySyncNotification.HistorySyncType - (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType)(0), // 12: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType - (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType)(0), // 13: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType - (GroupInviteMessage_GroupType)(0), // 14: proto.GroupInviteMessage.GroupType - (ExtendedTextMessage_PreviewType)(0), // 15: proto.ExtendedTextMessage.PreviewType - (ExtendedTextMessage_InviteLinkGroupType)(0), // 16: proto.ExtendedTextMessage.InviteLinkGroupType - (ExtendedTextMessage_FontType)(0), // 17: proto.ExtendedTextMessage.FontType - (ButtonsResponseMessage_Type)(0), // 18: proto.ButtonsResponseMessage.Type - (ButtonsMessage_HeaderType)(0), // 19: proto.ButtonsMessage.HeaderType - (ButtonsMessage_Button_Type)(0), // 20: proto.ButtonsMessage.Button.Type - (DisappearingMode_Initiator)(0), // 21: proto.DisappearingMode.Initiator - (ContextInfo_ExternalAdReplyInfo_MediaType)(0), // 22: proto.ContextInfo.ExternalAdReplyInfo.MediaType - (ContextInfo_AdReplyInfo_MediaType)(0), // 23: proto.ContextInfo.AdReplyInfo.MediaType - (PaymentBackground_Type)(0), // 24: proto.PaymentBackground.Type - (VideoMessage_Attribution)(0), // 25: proto.VideoMessage.Attribution - (ScheduledCallEditMessage_EditType)(0), // 26: proto.ScheduledCallEditMessage.EditType - (ScheduledCallCreationMessage_CallType)(0), // 27: proto.ScheduledCallCreationMessage.CallType - (ProtocolMessage_Type)(0), // 28: proto.ProtocolMessage.Type - (PinMessage_PinMessageType)(0), // 29: proto.PinMessage.PinMessageType - (PastParticipant_LeaveReason)(0), // 30: proto.PastParticipant.LeaveReason - (HistorySync_HistorySyncType)(0), // 31: proto.HistorySync.HistorySyncType - (GroupParticipant_Rank)(0), // 32: proto.GroupParticipant.Rank - (Conversation_EndOfHistoryTransferType)(0), // 33: proto.Conversation.EndOfHistoryTransferType - (MediaRetryNotification_ResultType)(0), // 34: proto.MediaRetryNotification.ResultType - (SyncdMutation_SyncdOperation)(0), // 35: proto.SyncdMutation.SyncdOperation - (BizIdentityInfo_VerifiedLevelValue)(0), // 36: proto.BizIdentityInfo.VerifiedLevelValue - (BizIdentityInfo_HostStorageType)(0), // 37: proto.BizIdentityInfo.HostStorageType - (BizIdentityInfo_ActualActorsType)(0), // 38: proto.BizIdentityInfo.ActualActorsType - (BizAccountLinkInfo_HostStorageType)(0), // 39: proto.BizAccountLinkInfo.HostStorageType - (BizAccountLinkInfo_AccountType)(0), // 40: proto.BizAccountLinkInfo.AccountType - (ClientPayload_Product)(0), // 41: proto.ClientPayload.Product - (ClientPayload_IOSAppExtension)(0), // 42: proto.ClientPayload.IOSAppExtension - (ClientPayload_ConnectType)(0), // 43: proto.ClientPayload.ConnectType - (ClientPayload_ConnectReason)(0), // 44: proto.ClientPayload.ConnectReason - (ClientPayload_WebInfo_WebSubPlatform)(0), // 45: proto.ClientPayload.WebInfo.WebSubPlatform - (ClientPayload_UserAgent_ReleaseChannel)(0), // 46: proto.ClientPayload.UserAgent.ReleaseChannel - (ClientPayload_UserAgent_Platform)(0), // 47: proto.ClientPayload.UserAgent.Platform - (ClientPayload_DNSSource_DNSResolutionMethod)(0), // 48: proto.ClientPayload.DNSSource.DNSResolutionMethod - (WebMessageInfo_StubType)(0), // 49: proto.WebMessageInfo.StubType - (WebMessageInfo_Status)(0), // 50: proto.WebMessageInfo.Status - (WebMessageInfo_BizPrivacyStatus)(0), // 51: proto.WebMessageInfo.BizPrivacyStatus - (WebFeatures_Flag)(0), // 52: proto.WebFeatures.Flag - (PaymentInfo_TxnStatus)(0), // 53: proto.PaymentInfo.TxnStatus - (PaymentInfo_Status)(0), // 54: proto.PaymentInfo.Status - (PaymentInfo_Currency)(0), // 55: proto.PaymentInfo.Currency - (*ADVSignedKeyIndexList)(nil), // 56: proto.ADVSignedKeyIndexList - (*ADVSignedDeviceIdentity)(nil), // 57: proto.ADVSignedDeviceIdentity - (*ADVSignedDeviceIdentityHMAC)(nil), // 58: proto.ADVSignedDeviceIdentityHMAC - (*ADVKeyIndexList)(nil), // 59: proto.ADVKeyIndexList - (*ADVDeviceIdentity)(nil), // 60: proto.ADVDeviceIdentity - (*DeviceProps)(nil), // 61: proto.DeviceProps - (*PeerDataOperationRequestMessage)(nil), // 62: proto.PeerDataOperationRequestMessage - (*PaymentInviteMessage)(nil), // 63: proto.PaymentInviteMessage - (*OrderMessage)(nil), // 64: proto.OrderMessage - (*LocationMessage)(nil), // 65: proto.LocationMessage - (*LiveLocationMessage)(nil), // 66: proto.LiveLocationMessage - (*ListResponseMessage)(nil), // 67: proto.ListResponseMessage - (*ListMessage)(nil), // 68: proto.ListMessage - (*KeepInChatMessage)(nil), // 69: proto.KeepInChatMessage - (*InvoiceMessage)(nil), // 70: proto.InvoiceMessage - (*InteractiveResponseMessage)(nil), // 71: proto.InteractiveResponseMessage - (*InteractiveMessage)(nil), // 72: proto.InteractiveMessage - (*InitialSecurityNotificationSettingSync)(nil), // 73: proto.InitialSecurityNotificationSettingSync - (*ImageMessage)(nil), // 74: proto.ImageMessage - (*HistorySyncNotification)(nil), // 75: proto.HistorySyncNotification - (*HighlyStructuredMessage)(nil), // 76: proto.HighlyStructuredMessage - (*GroupInviteMessage)(nil), // 77: proto.GroupInviteMessage - (*FutureProofMessage)(nil), // 78: proto.FutureProofMessage - (*ExtendedTextMessage)(nil), // 79: proto.ExtendedTextMessage - (*EncReactionMessage)(nil), // 80: proto.EncReactionMessage - (*DocumentMessage)(nil), // 81: proto.DocumentMessage - (*DeviceSentMessage)(nil), // 82: proto.DeviceSentMessage - (*DeclinePaymentRequestMessage)(nil), // 83: proto.DeclinePaymentRequestMessage - (*ContactsArrayMessage)(nil), // 84: proto.ContactsArrayMessage - (*ContactMessage)(nil), // 85: proto.ContactMessage - (*Chat)(nil), // 86: proto.Chat - (*CancelPaymentRequestMessage)(nil), // 87: proto.CancelPaymentRequestMessage - (*Call)(nil), // 88: proto.Call - (*ButtonsResponseMessage)(nil), // 89: proto.ButtonsResponseMessage - (*ButtonsMessage)(nil), // 90: proto.ButtonsMessage - (*AudioMessage)(nil), // 91: proto.AudioMessage - (*AppStateSyncKey)(nil), // 92: proto.AppStateSyncKey - (*AppStateSyncKeyShare)(nil), // 93: proto.AppStateSyncKeyShare - (*AppStateSyncKeyRequest)(nil), // 94: proto.AppStateSyncKeyRequest - (*AppStateSyncKeyId)(nil), // 95: proto.AppStateSyncKeyId - (*AppStateSyncKeyFingerprint)(nil), // 96: proto.AppStateSyncKeyFingerprint - (*AppStateSyncKeyData)(nil), // 97: proto.AppStateSyncKeyData - (*AppStateFatalExceptionNotification)(nil), // 98: proto.AppStateFatalExceptionNotification - (*Location)(nil), // 99: proto.Location - (*InteractiveAnnotation)(nil), // 100: proto.InteractiveAnnotation - (*HydratedTemplateButton)(nil), // 101: proto.HydratedTemplateButton - (*GroupMention)(nil), // 102: proto.GroupMention - (*DisappearingMode)(nil), // 103: proto.DisappearingMode - (*DeviceListMetadata)(nil), // 104: proto.DeviceListMetadata - (*ContextInfo)(nil), // 105: proto.ContextInfo - (*ActionLink)(nil), // 106: proto.ActionLink - (*TemplateButton)(nil), // 107: proto.TemplateButton - (*Point)(nil), // 108: proto.Point - (*PaymentBackground)(nil), // 109: proto.PaymentBackground - (*Money)(nil), // 110: proto.Money - (*Message)(nil), // 111: proto.Message - (*MessageContextInfo)(nil), // 112: proto.MessageContextInfo - (*VideoMessage)(nil), // 113: proto.VideoMessage - (*TemplateMessage)(nil), // 114: proto.TemplateMessage - (*TemplateButtonReplyMessage)(nil), // 115: proto.TemplateButtonReplyMessage - (*StickerSyncRMRMessage)(nil), // 116: proto.StickerSyncRMRMessage - (*StickerMessage)(nil), // 117: proto.StickerMessage - (*SenderKeyDistributionMessage)(nil), // 118: proto.SenderKeyDistributionMessage - (*SendPaymentMessage)(nil), // 119: proto.SendPaymentMessage - (*ScheduledCallEditMessage)(nil), // 120: proto.ScheduledCallEditMessage - (*ScheduledCallCreationMessage)(nil), // 121: proto.ScheduledCallCreationMessage - (*RequestPhoneNumberMessage)(nil), // 122: proto.RequestPhoneNumberMessage - (*RequestPaymentMessage)(nil), // 123: proto.RequestPaymentMessage - (*ReactionMessage)(nil), // 124: proto.ReactionMessage - (*ProtocolMessage)(nil), // 125: proto.ProtocolMessage - (*ProductMessage)(nil), // 126: proto.ProductMessage - (*PollVoteMessage)(nil), // 127: proto.PollVoteMessage - (*PollUpdateMessage)(nil), // 128: proto.PollUpdateMessage - (*PollUpdateMessageMetadata)(nil), // 129: proto.PollUpdateMessageMetadata - (*PollEncValue)(nil), // 130: proto.PollEncValue - (*PollCreationMessage)(nil), // 131: proto.PollCreationMessage - (*PinMessage)(nil), // 132: proto.PinMessage - (*PeerDataOperationRequestResponseMessage)(nil), // 133: proto.PeerDataOperationRequestResponseMessage - (*EphemeralSetting)(nil), // 134: proto.EphemeralSetting - (*WallpaperSettings)(nil), // 135: proto.WallpaperSettings - (*StickerMetadata)(nil), // 136: proto.StickerMetadata - (*Pushname)(nil), // 137: proto.Pushname - (*PastParticipants)(nil), // 138: proto.PastParticipants - (*PastParticipant)(nil), // 139: proto.PastParticipant - (*HistorySync)(nil), // 140: proto.HistorySync - (*HistorySyncMsg)(nil), // 141: proto.HistorySyncMsg - (*GroupParticipant)(nil), // 142: proto.GroupParticipant - (*GlobalSettings)(nil), // 143: proto.GlobalSettings - (*Conversation)(nil), // 144: proto.Conversation - (*AvatarUserSettings)(nil), // 145: proto.AvatarUserSettings - (*AutoDownloadSettings)(nil), // 146: proto.AutoDownloadSettings - (*MsgRowOpaqueData)(nil), // 147: proto.MsgRowOpaqueData - (*MsgOpaqueData)(nil), // 148: proto.MsgOpaqueData - (*ServerErrorReceipt)(nil), // 149: proto.ServerErrorReceipt - (*MediaRetryNotification)(nil), // 150: proto.MediaRetryNotification - (*MessageKey)(nil), // 151: proto.MessageKey - (*SyncdVersion)(nil), // 152: proto.SyncdVersion - (*SyncdValue)(nil), // 153: proto.SyncdValue - (*SyncdSnapshot)(nil), // 154: proto.SyncdSnapshot - (*SyncdRecord)(nil), // 155: proto.SyncdRecord - (*SyncdPatch)(nil), // 156: proto.SyncdPatch - (*SyncdMutations)(nil), // 157: proto.SyncdMutations - (*SyncdMutation)(nil), // 158: proto.SyncdMutation - (*SyncdIndex)(nil), // 159: proto.SyncdIndex - (*KeyId)(nil), // 160: proto.KeyId - (*ExternalBlobReference)(nil), // 161: proto.ExternalBlobReference - (*ExitCode)(nil), // 162: proto.ExitCode - (*SyncActionValue)(nil), // 163: proto.SyncActionValue - (*UserStatusMuteAction)(nil), // 164: proto.UserStatusMuteAction - (*UnarchiveChatsSetting)(nil), // 165: proto.UnarchiveChatsSetting - (*TimeFormatAction)(nil), // 166: proto.TimeFormatAction - (*SyncActionMessage)(nil), // 167: proto.SyncActionMessage - (*SyncActionMessageRange)(nil), // 168: proto.SyncActionMessageRange - (*SubscriptionAction)(nil), // 169: proto.SubscriptionAction - (*StickerAction)(nil), // 170: proto.StickerAction - (*StarAction)(nil), // 171: proto.StarAction - (*SecurityNotificationSetting)(nil), // 172: proto.SecurityNotificationSetting - (*RemoveRecentStickerAction)(nil), // 173: proto.RemoveRecentStickerAction - (*RecentEmojiWeightsAction)(nil), // 174: proto.RecentEmojiWeightsAction - (*QuickReplyAction)(nil), // 175: proto.QuickReplyAction - (*PushNameSetting)(nil), // 176: proto.PushNameSetting - (*PrimaryVersionAction)(nil), // 177: proto.PrimaryVersionAction - (*PrimaryFeature)(nil), // 178: proto.PrimaryFeature - (*PnForLidChatAction)(nil), // 179: proto.PnForLidChatAction - (*PinAction)(nil), // 180: proto.PinAction - (*NuxAction)(nil), // 181: proto.NuxAction - (*MuteAction)(nil), // 182: proto.MuteAction - (*MarkChatAsReadAction)(nil), // 183: proto.MarkChatAsReadAction - (*LocaleSetting)(nil), // 184: proto.LocaleSetting - (*LabelEditAction)(nil), // 185: proto.LabelEditAction - (*LabelAssociationAction)(nil), // 186: proto.LabelAssociationAction - (*KeyExpiration)(nil), // 187: proto.KeyExpiration - (*DeleteMessageForMeAction)(nil), // 188: proto.DeleteMessageForMeAction - (*DeleteChatAction)(nil), // 189: proto.DeleteChatAction - (*ContactAction)(nil), // 190: proto.ContactAction - (*ClearChatAction)(nil), // 191: proto.ClearChatAction - (*ChatAssignmentOpenedStatusAction)(nil), // 192: proto.ChatAssignmentOpenedStatusAction - (*ChatAssignmentAction)(nil), // 193: proto.ChatAssignmentAction - (*ArchiveChatAction)(nil), // 194: proto.ArchiveChatAction - (*AndroidUnsupportedActions)(nil), // 195: proto.AndroidUnsupportedActions - (*AgentAction)(nil), // 196: proto.AgentAction - (*SyncActionData)(nil), // 197: proto.SyncActionData - (*RecentEmojiWeight)(nil), // 198: proto.RecentEmojiWeight - (*VerifiedNameCertificate)(nil), // 199: proto.VerifiedNameCertificate - (*LocalizedName)(nil), // 200: proto.LocalizedName - (*BizIdentityInfo)(nil), // 201: proto.BizIdentityInfo - (*BizAccountPayload)(nil), // 202: proto.BizAccountPayload - (*BizAccountLinkInfo)(nil), // 203: proto.BizAccountLinkInfo - (*HandshakeMessage)(nil), // 204: proto.HandshakeMessage - (*HandshakeServerHello)(nil), // 205: proto.HandshakeServerHello - (*HandshakeClientHello)(nil), // 206: proto.HandshakeClientHello - (*HandshakeClientFinish)(nil), // 207: proto.HandshakeClientFinish - (*ClientPayload)(nil), // 208: proto.ClientPayload - (*WebNotificationsInfo)(nil), // 209: proto.WebNotificationsInfo - (*WebMessageInfo)(nil), // 210: proto.WebMessageInfo - (*WebFeatures)(nil), // 211: proto.WebFeatures - (*UserReceipt)(nil), // 212: proto.UserReceipt - (*StatusPSA)(nil), // 213: proto.StatusPSA - (*Reaction)(nil), // 214: proto.Reaction - (*PollUpdate)(nil), // 215: proto.PollUpdate - (*PollAdditionalMetadata)(nil), // 216: proto.PollAdditionalMetadata - (*PhotoChange)(nil), // 217: proto.PhotoChange - (*PaymentInfo)(nil), // 218: proto.PaymentInfo - (*NotificationMessageInfo)(nil), // 219: proto.NotificationMessageInfo - (*MediaData)(nil), // 220: proto.MediaData - (*KeepInChat)(nil), // 221: proto.KeepInChat - (*NoiseCertificate)(nil), // 222: proto.NoiseCertificate - (*CertChain)(nil), // 223: proto.CertChain - (*DeviceProps_HistorySyncConfig)(nil), // 224: proto.DeviceProps.HistorySyncConfig - (*DeviceProps_AppVersion)(nil), // 225: proto.DeviceProps.AppVersion - (*PeerDataOperationRequestMessage_RequestUrlPreview)(nil), // 226: proto.PeerDataOperationRequestMessage.RequestUrlPreview - (*PeerDataOperationRequestMessage_RequestStickerReupload)(nil), // 227: proto.PeerDataOperationRequestMessage.RequestStickerReupload - (*ListResponseMessage_SingleSelectReply)(nil), // 228: proto.ListResponseMessage.SingleSelectReply - (*ListMessage_Section)(nil), // 229: proto.ListMessage.Section - (*ListMessage_Row)(nil), // 230: proto.ListMessage.Row - (*ListMessage_Product)(nil), // 231: proto.ListMessage.Product - (*ListMessage_ProductSection)(nil), // 232: proto.ListMessage.ProductSection - (*ListMessage_ProductListInfo)(nil), // 233: proto.ListMessage.ProductListInfo - (*ListMessage_ProductListHeaderImage)(nil), // 234: proto.ListMessage.ProductListHeaderImage - (*InteractiveResponseMessage_NativeFlowResponseMessage)(nil), // 235: proto.InteractiveResponseMessage.NativeFlowResponseMessage - (*InteractiveResponseMessage_Body)(nil), // 236: proto.InteractiveResponseMessage.Body - (*InteractiveMessage_ShopMessage)(nil), // 237: proto.InteractiveMessage.ShopMessage - (*InteractiveMessage_NativeFlowMessage)(nil), // 238: proto.InteractiveMessage.NativeFlowMessage - (*InteractiveMessage_Header)(nil), // 239: proto.InteractiveMessage.Header - (*InteractiveMessage_Footer)(nil), // 240: proto.InteractiveMessage.Footer - (*InteractiveMessage_CollectionMessage)(nil), // 241: proto.InteractiveMessage.CollectionMessage - (*InteractiveMessage_Body)(nil), // 242: proto.InteractiveMessage.Body - (*InteractiveMessage_NativeFlowMessage_NativeFlowButton)(nil), // 243: proto.InteractiveMessage.NativeFlowMessage.NativeFlowButton - (*HighlyStructuredMessage_HSMLocalizableParameter)(nil), // 244: proto.HighlyStructuredMessage.HSMLocalizableParameter - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime)(nil), // 245: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency)(nil), // 246: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch)(nil), // 247: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch - (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent)(nil), // 248: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent - (*ButtonsMessage_Button)(nil), // 249: proto.ButtonsMessage.Button - (*ButtonsMessage_Button_NativeFlowInfo)(nil), // 250: proto.ButtonsMessage.Button.NativeFlowInfo - (*ButtonsMessage_Button_ButtonText)(nil), // 251: proto.ButtonsMessage.Button.ButtonText - (*HydratedTemplateButton_HydratedURLButton)(nil), // 252: proto.HydratedTemplateButton.HydratedURLButton - (*HydratedTemplateButton_HydratedQuickReplyButton)(nil), // 253: proto.HydratedTemplateButton.HydratedQuickReplyButton - (*HydratedTemplateButton_HydratedCallButton)(nil), // 254: proto.HydratedTemplateButton.HydratedCallButton - (*ContextInfo_UTMInfo)(nil), // 255: proto.ContextInfo.UTMInfo - (*ContextInfo_ExternalAdReplyInfo)(nil), // 256: proto.ContextInfo.ExternalAdReplyInfo - (*ContextInfo_AdReplyInfo)(nil), // 257: proto.ContextInfo.AdReplyInfo - (*TemplateButton_URLButton)(nil), // 258: proto.TemplateButton.URLButton - (*TemplateButton_QuickReplyButton)(nil), // 259: proto.TemplateButton.QuickReplyButton - (*TemplateButton_CallButton)(nil), // 260: proto.TemplateButton.CallButton - (*PaymentBackground_MediaData)(nil), // 261: proto.PaymentBackground.MediaData - (*TemplateMessage_HydratedFourRowTemplate)(nil), // 262: proto.TemplateMessage.HydratedFourRowTemplate - (*TemplateMessage_FourRowTemplate)(nil), // 263: proto.TemplateMessage.FourRowTemplate - (*ProductMessage_ProductSnapshot)(nil), // 264: proto.ProductMessage.ProductSnapshot - (*ProductMessage_CatalogSnapshot)(nil), // 265: proto.ProductMessage.CatalogSnapshot - (*PollCreationMessage_Option)(nil), // 266: proto.PollCreationMessage.Option - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult)(nil), // 267: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult - (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse)(nil), // 268: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse - (*MsgOpaqueData_PollOption)(nil), // 269: proto.MsgOpaqueData.PollOption - (*VerifiedNameCertificate_Details)(nil), // 270: proto.VerifiedNameCertificate.Details - (*ClientPayload_WebInfo)(nil), // 271: proto.ClientPayload.WebInfo - (*ClientPayload_UserAgent)(nil), // 272: proto.ClientPayload.UserAgent - (*ClientPayload_DevicePairingRegistrationData)(nil), // 273: proto.ClientPayload.DevicePairingRegistrationData - (*ClientPayload_DNSSource)(nil), // 274: proto.ClientPayload.DNSSource - (*ClientPayload_WebInfo_WebdPayload)(nil), // 275: proto.ClientPayload.WebInfo.WebdPayload - (*ClientPayload_UserAgent_AppVersion)(nil), // 276: proto.ClientPayload.UserAgent.AppVersion - (*NoiseCertificate_Details)(nil), // 277: proto.NoiseCertificate.Details - (*CertChain_NoiseCertificate)(nil), // 278: proto.CertChain.NoiseCertificate - (*CertChain_NoiseCertificate_Details)(nil), // 279: proto.CertChain.NoiseCertificate.Details + (InteractiveResponseMessage_Body_Format)(0), // 10: proto.InteractiveResponseMessage.Body.Format + (InteractiveMessage_ShopMessage_Surface)(0), // 11: proto.InteractiveMessage.ShopMessage.Surface + (HistorySyncNotification_HistorySyncType)(0), // 12: proto.HistorySyncNotification.HistorySyncType + (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType)(0), // 13: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType)(0), // 14: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + (GroupInviteMessage_GroupType)(0), // 15: proto.GroupInviteMessage.GroupType + (ExtendedTextMessage_PreviewType)(0), // 16: proto.ExtendedTextMessage.PreviewType + (ExtendedTextMessage_InviteLinkGroupType)(0), // 17: proto.ExtendedTextMessage.InviteLinkGroupType + (ExtendedTextMessage_FontType)(0), // 18: proto.ExtendedTextMessage.FontType + (ButtonsResponseMessage_Type)(0), // 19: proto.ButtonsResponseMessage.Type + (ButtonsMessage_HeaderType)(0), // 20: proto.ButtonsMessage.HeaderType + (ButtonsMessage_Button_Type)(0), // 21: proto.ButtonsMessage.Button.Type + (DisappearingMode_Initiator)(0), // 22: proto.DisappearingMode.Initiator + (ContextInfo_ExternalAdReplyInfo_MediaType)(0), // 23: proto.ContextInfo.ExternalAdReplyInfo.MediaType + (ContextInfo_AdReplyInfo_MediaType)(0), // 24: proto.ContextInfo.AdReplyInfo.MediaType + (PaymentBackground_Type)(0), // 25: proto.PaymentBackground.Type + (VideoMessage_Attribution)(0), // 26: proto.VideoMessage.Attribution + (ScheduledCallEditMessage_EditType)(0), // 27: proto.ScheduledCallEditMessage.EditType + (ScheduledCallCreationMessage_CallType)(0), // 28: proto.ScheduledCallCreationMessage.CallType + (ProtocolMessage_Type)(0), // 29: proto.ProtocolMessage.Type + (PinMessage_PinMessageType)(0), // 30: proto.PinMessage.PinMessageType + (PastParticipant_LeaveReason)(0), // 31: proto.PastParticipant.LeaveReason + (HistorySync_HistorySyncType)(0), // 32: proto.HistorySync.HistorySyncType + (GroupParticipant_Rank)(0), // 33: proto.GroupParticipant.Rank + (Conversation_EndOfHistoryTransferType)(0), // 34: proto.Conversation.EndOfHistoryTransferType + (MediaRetryNotification_ResultType)(0), // 35: proto.MediaRetryNotification.ResultType + (SyncdMutation_SyncdOperation)(0), // 36: proto.SyncdMutation.SyncdOperation + (MarketingMessageAction_MarketingMessagePrototypeType)(0), // 37: proto.MarketingMessageAction.MarketingMessagePrototypeType + (BizIdentityInfo_VerifiedLevelValue)(0), // 38: proto.BizIdentityInfo.VerifiedLevelValue + (BizIdentityInfo_HostStorageType)(0), // 39: proto.BizIdentityInfo.HostStorageType + (BizIdentityInfo_ActualActorsType)(0), // 40: proto.BizIdentityInfo.ActualActorsType + (BizAccountLinkInfo_HostStorageType)(0), // 41: proto.BizAccountLinkInfo.HostStorageType + (BizAccountLinkInfo_AccountType)(0), // 42: proto.BizAccountLinkInfo.AccountType + (ClientPayload_Product)(0), // 43: proto.ClientPayload.Product + (ClientPayload_IOSAppExtension)(0), // 44: proto.ClientPayload.IOSAppExtension + (ClientPayload_ConnectType)(0), // 45: proto.ClientPayload.ConnectType + (ClientPayload_ConnectReason)(0), // 46: proto.ClientPayload.ConnectReason + (ClientPayload_WebInfo_WebSubPlatform)(0), // 47: proto.ClientPayload.WebInfo.WebSubPlatform + (ClientPayload_UserAgent_ReleaseChannel)(0), // 48: proto.ClientPayload.UserAgent.ReleaseChannel + (ClientPayload_UserAgent_Platform)(0), // 49: proto.ClientPayload.UserAgent.Platform + (ClientPayload_DNSSource_DNSResolutionMethod)(0), // 50: proto.ClientPayload.DNSSource.DNSResolutionMethod + (WebMessageInfo_StubType)(0), // 51: proto.WebMessageInfo.StubType + (WebMessageInfo_Status)(0), // 52: proto.WebMessageInfo.Status + (WebMessageInfo_BizPrivacyStatus)(0), // 53: proto.WebMessageInfo.BizPrivacyStatus + (WebFeatures_Flag)(0), // 54: proto.WebFeatures.Flag + (PinInChat_PinMessageType)(0), // 55: proto.PinInChat.PinMessageType + (PaymentInfo_TxnStatus)(0), // 56: proto.PaymentInfo.TxnStatus + (PaymentInfo_Status)(0), // 57: proto.PaymentInfo.Status + (PaymentInfo_Currency)(0), // 58: proto.PaymentInfo.Currency + (*ADVSignedKeyIndexList)(nil), // 59: proto.ADVSignedKeyIndexList + (*ADVSignedDeviceIdentity)(nil), // 60: proto.ADVSignedDeviceIdentity + (*ADVSignedDeviceIdentityHMAC)(nil), // 61: proto.ADVSignedDeviceIdentityHMAC + (*ADVKeyIndexList)(nil), // 62: proto.ADVKeyIndexList + (*ADVDeviceIdentity)(nil), // 63: proto.ADVDeviceIdentity + (*DeviceProps)(nil), // 64: proto.DeviceProps + (*PaymentInviteMessage)(nil), // 65: proto.PaymentInviteMessage + (*OrderMessage)(nil), // 66: proto.OrderMessage + (*LocationMessage)(nil), // 67: proto.LocationMessage + (*LiveLocationMessage)(nil), // 68: proto.LiveLocationMessage + (*ListResponseMessage)(nil), // 69: proto.ListResponseMessage + (*ListMessage)(nil), // 70: proto.ListMessage + (*KeepInChatMessage)(nil), // 71: proto.KeepInChatMessage + (*InvoiceMessage)(nil), // 72: proto.InvoiceMessage + (*InteractiveResponseMessage)(nil), // 73: proto.InteractiveResponseMessage + (*InteractiveMessage)(nil), // 74: proto.InteractiveMessage + (*InitialSecurityNotificationSettingSync)(nil), // 75: proto.InitialSecurityNotificationSettingSync + (*ImageMessage)(nil), // 76: proto.ImageMessage + (*HistorySyncNotification)(nil), // 77: proto.HistorySyncNotification + (*HighlyStructuredMessage)(nil), // 78: proto.HighlyStructuredMessage + (*GroupInviteMessage)(nil), // 79: proto.GroupInviteMessage + (*FutureProofMessage)(nil), // 80: proto.FutureProofMessage + (*ExtendedTextMessage)(nil), // 81: proto.ExtendedTextMessage + (*EncReactionMessage)(nil), // 82: proto.EncReactionMessage + (*DocumentMessage)(nil), // 83: proto.DocumentMessage + (*DeviceSentMessage)(nil), // 84: proto.DeviceSentMessage + (*DeclinePaymentRequestMessage)(nil), // 85: proto.DeclinePaymentRequestMessage + (*ContactsArrayMessage)(nil), // 86: proto.ContactsArrayMessage + (*ContactMessageV2)(nil), // 87: proto.ContactMessageV2 + (*ContactMessage)(nil), // 88: proto.ContactMessage + (*Chat)(nil), // 89: proto.Chat + (*CancelPaymentRequestMessage)(nil), // 90: proto.CancelPaymentRequestMessage + (*Call)(nil), // 91: proto.Call + (*ButtonsResponseMessage)(nil), // 92: proto.ButtonsResponseMessage + (*ButtonsMessage)(nil), // 93: proto.ButtonsMessage + (*AudioMessage)(nil), // 94: proto.AudioMessage + (*AppStateSyncKey)(nil), // 95: proto.AppStateSyncKey + (*AppStateSyncKeyShare)(nil), // 96: proto.AppStateSyncKeyShare + (*AppStateSyncKeyRequest)(nil), // 97: proto.AppStateSyncKeyRequest + (*AppStateSyncKeyId)(nil), // 98: proto.AppStateSyncKeyId + (*AppStateSyncKeyFingerprint)(nil), // 99: proto.AppStateSyncKeyFingerprint + (*AppStateSyncKeyData)(nil), // 100: proto.AppStateSyncKeyData + (*AppStateFatalExceptionNotification)(nil), // 101: proto.AppStateFatalExceptionNotification + (*Location)(nil), // 102: proto.Location + (*InteractiveAnnotation)(nil), // 103: proto.InteractiveAnnotation + (*HydratedTemplateButton)(nil), // 104: proto.HydratedTemplateButton + (*GroupMention)(nil), // 105: proto.GroupMention + (*DisappearingMode)(nil), // 106: proto.DisappearingMode + (*DeviceListMetadata)(nil), // 107: proto.DeviceListMetadata + (*ContextInfo)(nil), // 108: proto.ContextInfo + (*ActionLink)(nil), // 109: proto.ActionLink + (*TemplateButton)(nil), // 110: proto.TemplateButton + (*Point)(nil), // 111: proto.Point + (*PaymentBackground)(nil), // 112: proto.PaymentBackground + (*Money)(nil), // 113: proto.Money + (*Message)(nil), // 114: proto.Message + (*MessageContextInfo)(nil), // 115: proto.MessageContextInfo + (*VideoMessage)(nil), // 116: proto.VideoMessage + (*TemplateMessage)(nil), // 117: proto.TemplateMessage + (*TemplateButtonReplyMessage)(nil), // 118: proto.TemplateButtonReplyMessage + (*StickerSyncRMRMessage)(nil), // 119: proto.StickerSyncRMRMessage + (*StickerMessage)(nil), // 120: proto.StickerMessage + (*SenderKeyDistributionMessage)(nil), // 121: proto.SenderKeyDistributionMessage + (*SendPaymentMessage)(nil), // 122: proto.SendPaymentMessage + (*ScheduledCallEditMessage)(nil), // 123: proto.ScheduledCallEditMessage + (*ScheduledCallCreationMessage)(nil), // 124: proto.ScheduledCallCreationMessage + (*RequestPhoneNumberMessage)(nil), // 125: proto.RequestPhoneNumberMessage + (*RequestPaymentMessage)(nil), // 126: proto.RequestPaymentMessage + (*ReactionMessage)(nil), // 127: proto.ReactionMessage + (*ProtocolMessage)(nil), // 128: proto.ProtocolMessage + (*ProductMessage)(nil), // 129: proto.ProductMessage + (*PollVoteMessage)(nil), // 130: proto.PollVoteMessage + (*PollUpdateMessage)(nil), // 131: proto.PollUpdateMessage + (*PollUpdateMessageMetadata)(nil), // 132: proto.PollUpdateMessageMetadata + (*PollEncValue)(nil), // 133: proto.PollEncValue + (*PollCreationMessage)(nil), // 134: proto.PollCreationMessage + (*PinMessage)(nil), // 135: proto.PinMessage + (*PeerDataOperationRequestResponseMessage)(nil), // 136: proto.PeerDataOperationRequestResponseMessage + (*PeerDataOperationRequestMessage)(nil), // 137: proto.PeerDataOperationRequestMessage + (*EphemeralSetting)(nil), // 138: proto.EphemeralSetting + (*WallpaperSettings)(nil), // 139: proto.WallpaperSettings + (*StickerMetadata)(nil), // 140: proto.StickerMetadata + (*Pushname)(nil), // 141: proto.Pushname + (*PastParticipants)(nil), // 142: proto.PastParticipants + (*PastParticipant)(nil), // 143: proto.PastParticipant + (*NotificationSettings)(nil), // 144: proto.NotificationSettings + (*HistorySync)(nil), // 145: proto.HistorySync + (*HistorySyncMsg)(nil), // 146: proto.HistorySyncMsg + (*GroupParticipant)(nil), // 147: proto.GroupParticipant + (*GlobalSettings)(nil), // 148: proto.GlobalSettings + (*Conversation)(nil), // 149: proto.Conversation + (*AvatarUserSettings)(nil), // 150: proto.AvatarUserSettings + (*AutoDownloadSettings)(nil), // 151: proto.AutoDownloadSettings + (*MsgRowOpaqueData)(nil), // 152: proto.MsgRowOpaqueData + (*MsgOpaqueData)(nil), // 153: proto.MsgOpaqueData + (*ServerErrorReceipt)(nil), // 154: proto.ServerErrorReceipt + (*MediaRetryNotification)(nil), // 155: proto.MediaRetryNotification + (*MessageKey)(nil), // 156: proto.MessageKey + (*SyncdVersion)(nil), // 157: proto.SyncdVersion + (*SyncdValue)(nil), // 158: proto.SyncdValue + (*SyncdSnapshot)(nil), // 159: proto.SyncdSnapshot + (*SyncdRecord)(nil), // 160: proto.SyncdRecord + (*SyncdPatch)(nil), // 161: proto.SyncdPatch + (*SyncdMutations)(nil), // 162: proto.SyncdMutations + (*SyncdMutation)(nil), // 163: proto.SyncdMutation + (*SyncdIndex)(nil), // 164: proto.SyncdIndex + (*KeyId)(nil), // 165: proto.KeyId + (*ExternalBlobReference)(nil), // 166: proto.ExternalBlobReference + (*ExitCode)(nil), // 167: proto.ExitCode + (*SyncActionValue)(nil), // 168: proto.SyncActionValue + (*UserStatusMuteAction)(nil), // 169: proto.UserStatusMuteAction + (*UnarchiveChatsSetting)(nil), // 170: proto.UnarchiveChatsSetting + (*TimeFormatAction)(nil), // 171: proto.TimeFormatAction + (*SyncActionMessage)(nil), // 172: proto.SyncActionMessage + (*SyncActionMessageRange)(nil), // 173: proto.SyncActionMessageRange + (*SubscriptionAction)(nil), // 174: proto.SubscriptionAction + (*StickerAction)(nil), // 175: proto.StickerAction + (*StarAction)(nil), // 176: proto.StarAction + (*SecurityNotificationSetting)(nil), // 177: proto.SecurityNotificationSetting + (*RemoveRecentStickerAction)(nil), // 178: proto.RemoveRecentStickerAction + (*RecentEmojiWeightsAction)(nil), // 179: proto.RecentEmojiWeightsAction + (*QuickReplyAction)(nil), // 180: proto.QuickReplyAction + (*PushNameSetting)(nil), // 181: proto.PushNameSetting + (*PrivacySettingRelayAllCalls)(nil), // 182: proto.PrivacySettingRelayAllCalls + (*PrimaryVersionAction)(nil), // 183: proto.PrimaryVersionAction + (*PrimaryFeature)(nil), // 184: proto.PrimaryFeature + (*PnForLidChatAction)(nil), // 185: proto.PnForLidChatAction + (*PinAction)(nil), // 186: proto.PinAction + (*NuxAction)(nil), // 187: proto.NuxAction + (*MuteAction)(nil), // 188: proto.MuteAction + (*MarketingMessageBroadcastAction)(nil), // 189: proto.MarketingMessageBroadcastAction + (*MarketingMessageAction)(nil), // 190: proto.MarketingMessageAction + (*MarkChatAsReadAction)(nil), // 191: proto.MarkChatAsReadAction + (*LocaleSetting)(nil), // 192: proto.LocaleSetting + (*LabelEditAction)(nil), // 193: proto.LabelEditAction + (*LabelAssociationAction)(nil), // 194: proto.LabelAssociationAction + (*KeyExpiration)(nil), // 195: proto.KeyExpiration + (*ExternalWebBetaAction)(nil), // 196: proto.ExternalWebBetaAction + (*DeleteMessageForMeAction)(nil), // 197: proto.DeleteMessageForMeAction + (*DeleteChatAction)(nil), // 198: proto.DeleteChatAction + (*ContactAction)(nil), // 199: proto.ContactAction + (*ClearChatAction)(nil), // 200: proto.ClearChatAction + (*ChatAssignmentOpenedStatusAction)(nil), // 201: proto.ChatAssignmentOpenedStatusAction + (*ChatAssignmentAction)(nil), // 202: proto.ChatAssignmentAction + (*ArchiveChatAction)(nil), // 203: proto.ArchiveChatAction + (*AndroidUnsupportedActions)(nil), // 204: proto.AndroidUnsupportedActions + (*AgentAction)(nil), // 205: proto.AgentAction + (*SyncActionData)(nil), // 206: proto.SyncActionData + (*RecentEmojiWeight)(nil), // 207: proto.RecentEmojiWeight + (*VerifiedNameCertificate)(nil), // 208: proto.VerifiedNameCertificate + (*LocalizedName)(nil), // 209: proto.LocalizedName + (*BizIdentityInfo)(nil), // 210: proto.BizIdentityInfo + (*BizAccountPayload)(nil), // 211: proto.BizAccountPayload + (*BizAccountLinkInfo)(nil), // 212: proto.BizAccountLinkInfo + (*HandshakeMessage)(nil), // 213: proto.HandshakeMessage + (*HandshakeServerHello)(nil), // 214: proto.HandshakeServerHello + (*HandshakeClientHello)(nil), // 215: proto.HandshakeClientHello + (*HandshakeClientFinish)(nil), // 216: proto.HandshakeClientFinish + (*ClientPayload)(nil), // 217: proto.ClientPayload + (*WebNotificationsInfo)(nil), // 218: proto.WebNotificationsInfo + (*WebMessageInfo)(nil), // 219: proto.WebMessageInfo + (*WebFeatures)(nil), // 220: proto.WebFeatures + (*UserReceipt)(nil), // 221: proto.UserReceipt + (*StatusPSA)(nil), // 222: proto.StatusPSA + (*Reaction)(nil), // 223: proto.Reaction + (*PollUpdate)(nil), // 224: proto.PollUpdate + (*PollAdditionalMetadata)(nil), // 225: proto.PollAdditionalMetadata + (*PinInChat)(nil), // 226: proto.PinInChat + (*PhotoChange)(nil), // 227: proto.PhotoChange + (*PaymentInfo)(nil), // 228: proto.PaymentInfo + (*NotificationMessageInfo)(nil), // 229: proto.NotificationMessageInfo + (*MediaData)(nil), // 230: proto.MediaData + (*KeepInChat)(nil), // 231: proto.KeepInChat + (*NoiseCertificate)(nil), // 232: proto.NoiseCertificate + (*CertChain)(nil), // 233: proto.CertChain + (*DeviceProps_HistorySyncConfig)(nil), // 234: proto.DeviceProps.HistorySyncConfig + (*DeviceProps_AppVersion)(nil), // 235: proto.DeviceProps.AppVersion + (*ListResponseMessage_SingleSelectReply)(nil), // 236: proto.ListResponseMessage.SingleSelectReply + (*ListMessage_Section)(nil), // 237: proto.ListMessage.Section + (*ListMessage_Row)(nil), // 238: proto.ListMessage.Row + (*ListMessage_Product)(nil), // 239: proto.ListMessage.Product + (*ListMessage_ProductSection)(nil), // 240: proto.ListMessage.ProductSection + (*ListMessage_ProductListInfo)(nil), // 241: proto.ListMessage.ProductListInfo + (*ListMessage_ProductListHeaderImage)(nil), // 242: proto.ListMessage.ProductListHeaderImage + (*InteractiveResponseMessage_NativeFlowResponseMessage)(nil), // 243: proto.InteractiveResponseMessage.NativeFlowResponseMessage + (*InteractiveResponseMessage_Body)(nil), // 244: proto.InteractiveResponseMessage.Body + (*InteractiveMessage_ShopMessage)(nil), // 245: proto.InteractiveMessage.ShopMessage + (*InteractiveMessage_NativeFlowMessage)(nil), // 246: proto.InteractiveMessage.NativeFlowMessage + (*InteractiveMessage_Header)(nil), // 247: proto.InteractiveMessage.Header + (*InteractiveMessage_Footer)(nil), // 248: proto.InteractiveMessage.Footer + (*InteractiveMessage_CollectionMessage)(nil), // 249: proto.InteractiveMessage.CollectionMessage + (*InteractiveMessage_Body)(nil), // 250: proto.InteractiveMessage.Body + (*InteractiveMessage_NativeFlowMessage_NativeFlowButton)(nil), // 251: proto.InteractiveMessage.NativeFlowMessage.NativeFlowButton + (*HighlyStructuredMessage_HSMLocalizableParameter)(nil), // 252: proto.HighlyStructuredMessage.HSMLocalizableParameter + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime)(nil), // 253: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency)(nil), // 254: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch)(nil), // 255: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent)(nil), // 256: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + (*ButtonsMessage_Button)(nil), // 257: proto.ButtonsMessage.Button + (*ButtonsMessage_Button_NativeFlowInfo)(nil), // 258: proto.ButtonsMessage.Button.NativeFlowInfo + (*ButtonsMessage_Button_ButtonText)(nil), // 259: proto.ButtonsMessage.Button.ButtonText + (*HydratedTemplateButton_HydratedURLButton)(nil), // 260: proto.HydratedTemplateButton.HydratedURLButton + (*HydratedTemplateButton_HydratedQuickReplyButton)(nil), // 261: proto.HydratedTemplateButton.HydratedQuickReplyButton + (*HydratedTemplateButton_HydratedCallButton)(nil), // 262: proto.HydratedTemplateButton.HydratedCallButton + (*ContextInfo_UTMInfo)(nil), // 263: proto.ContextInfo.UTMInfo + (*ContextInfo_ExternalAdReplyInfo)(nil), // 264: proto.ContextInfo.ExternalAdReplyInfo + (*ContextInfo_AdReplyInfo)(nil), // 265: proto.ContextInfo.AdReplyInfo + (*TemplateButton_URLButton)(nil), // 266: proto.TemplateButton.URLButton + (*TemplateButton_QuickReplyButton)(nil), // 267: proto.TemplateButton.QuickReplyButton + (*TemplateButton_CallButton)(nil), // 268: proto.TemplateButton.CallButton + (*PaymentBackground_MediaData)(nil), // 269: proto.PaymentBackground.MediaData + (*TemplateMessage_HydratedFourRowTemplate)(nil), // 270: proto.TemplateMessage.HydratedFourRowTemplate + (*TemplateMessage_FourRowTemplate)(nil), // 271: proto.TemplateMessage.FourRowTemplate + (*ProductMessage_ProductSnapshot)(nil), // 272: proto.ProductMessage.ProductSnapshot + (*ProductMessage_CatalogSnapshot)(nil), // 273: proto.ProductMessage.CatalogSnapshot + (*PollCreationMessage_Option)(nil), // 274: proto.PollCreationMessage.Option + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult)(nil), // 275: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse)(nil), // 276: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.PlaceholderMessageResendResponse + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse)(nil), // 277: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail)(nil), // 278: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.LinkPreviewHighQualityThumbnail + (*PeerDataOperationRequestMessage_RequestStickerReupload)(nil), // 279: proto.PeerDataOperationRequestMessage.RequestStickerReupload + (*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest)(nil), // 280: proto.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest + (*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest)(nil), // 281: proto.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + (*PeerDataOperationRequestMessage_RequestUrlPreview)(nil), // 282: proto.PeerDataOperationRequestMessage.RequestUrlPreview + (*MsgOpaqueData_PollOption)(nil), // 283: proto.MsgOpaqueData.PollOption + (*VerifiedNameCertificate_Details)(nil), // 284: proto.VerifiedNameCertificate.Details + (*ClientPayload_WebInfo)(nil), // 285: proto.ClientPayload.WebInfo + (*ClientPayload_UserAgent)(nil), // 286: proto.ClientPayload.UserAgent + (*ClientPayload_InteropData)(nil), // 287: proto.ClientPayload.InteropData + (*ClientPayload_DevicePairingRegistrationData)(nil), // 288: proto.ClientPayload.DevicePairingRegistrationData + (*ClientPayload_DNSSource)(nil), // 289: proto.ClientPayload.DNSSource + (*ClientPayload_WebInfo_WebdPayload)(nil), // 290: proto.ClientPayload.WebInfo.WebdPayload + (*ClientPayload_UserAgent_AppVersion)(nil), // 291: proto.ClientPayload.UserAgent.AppVersion + (*NoiseCertificate_Details)(nil), // 292: proto.NoiseCertificate.Details + (*CertChain_NoiseCertificate)(nil), // 293: proto.CertChain.NoiseCertificate + (*CertChain_NoiseCertificate_Details)(nil), // 294: proto.CertChain.NoiseCertificate.Details } var file_binary_proto_def_proto_depIdxs = []int32{ - 225, // 0: proto.DeviceProps.version:type_name -> proto.DeviceProps.AppVersion + 235, // 0: proto.DeviceProps.version:type_name -> proto.DeviceProps.AppVersion 3, // 1: proto.DeviceProps.platformType:type_name -> proto.DeviceProps.PlatformType - 224, // 2: proto.DeviceProps.historySyncConfig:type_name -> proto.DeviceProps.HistorySyncConfig - 1, // 3: proto.PeerDataOperationRequestMessage.peerDataOperationRequestType:type_name -> proto.PeerDataOperationRequestType - 227, // 4: proto.PeerDataOperationRequestMessage.requestStickerReupload:type_name -> proto.PeerDataOperationRequestMessage.RequestStickerReupload - 226, // 5: proto.PeerDataOperationRequestMessage.requestUrlPreview:type_name -> proto.PeerDataOperationRequestMessage.RequestUrlPreview - 4, // 6: proto.PaymentInviteMessage.serviceType:type_name -> proto.PaymentInviteMessage.ServiceType - 6, // 7: proto.OrderMessage.status:type_name -> proto.OrderMessage.OrderStatus - 5, // 8: proto.OrderMessage.surface:type_name -> proto.OrderMessage.OrderSurface - 105, // 9: proto.OrderMessage.contextInfo:type_name -> proto.ContextInfo - 105, // 10: proto.LocationMessage.contextInfo:type_name -> proto.ContextInfo - 105, // 11: proto.LiveLocationMessage.contextInfo:type_name -> proto.ContextInfo - 7, // 12: proto.ListResponseMessage.listType:type_name -> proto.ListResponseMessage.ListType - 228, // 13: proto.ListResponseMessage.singleSelectReply:type_name -> proto.ListResponseMessage.SingleSelectReply - 105, // 14: proto.ListResponseMessage.contextInfo:type_name -> proto.ContextInfo - 8, // 15: proto.ListMessage.listType:type_name -> proto.ListMessage.ListType - 229, // 16: proto.ListMessage.sections:type_name -> proto.ListMessage.Section - 233, // 17: proto.ListMessage.productListInfo:type_name -> proto.ListMessage.ProductListInfo - 105, // 18: proto.ListMessage.contextInfo:type_name -> proto.ContextInfo - 151, // 19: proto.KeepInChatMessage.key:type_name -> proto.MessageKey - 0, // 20: proto.KeepInChatMessage.keepType:type_name -> proto.KeepType - 9, // 21: proto.InvoiceMessage.attachmentType:type_name -> proto.InvoiceMessage.AttachmentType - 236, // 22: proto.InteractiveResponseMessage.body:type_name -> proto.InteractiveResponseMessage.Body - 105, // 23: proto.InteractiveResponseMessage.contextInfo:type_name -> proto.ContextInfo - 235, // 24: proto.InteractiveResponseMessage.nativeFlowResponseMessage:type_name -> proto.InteractiveResponseMessage.NativeFlowResponseMessage - 239, // 25: proto.InteractiveMessage.header:type_name -> proto.InteractiveMessage.Header - 242, // 26: proto.InteractiveMessage.body:type_name -> proto.InteractiveMessage.Body - 240, // 27: proto.InteractiveMessage.footer:type_name -> proto.InteractiveMessage.Footer - 105, // 28: proto.InteractiveMessage.contextInfo:type_name -> proto.ContextInfo - 237, // 29: proto.InteractiveMessage.shopStorefrontMessage:type_name -> proto.InteractiveMessage.ShopMessage - 241, // 30: proto.InteractiveMessage.collectionMessage:type_name -> proto.InteractiveMessage.CollectionMessage - 238, // 31: proto.InteractiveMessage.nativeFlowMessage:type_name -> proto.InteractiveMessage.NativeFlowMessage - 100, // 32: proto.ImageMessage.interactiveAnnotations:type_name -> proto.InteractiveAnnotation - 105, // 33: proto.ImageMessage.contextInfo:type_name -> proto.ContextInfo - 11, // 34: proto.HistorySyncNotification.syncType:type_name -> proto.HistorySyncNotification.HistorySyncType - 244, // 35: proto.HighlyStructuredMessage.localizableParams:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter - 114, // 36: proto.HighlyStructuredMessage.hydratedHsm:type_name -> proto.TemplateMessage - 105, // 37: proto.GroupInviteMessage.contextInfo:type_name -> proto.ContextInfo - 14, // 38: proto.GroupInviteMessage.groupType:type_name -> proto.GroupInviteMessage.GroupType - 111, // 39: proto.FutureProofMessage.message:type_name -> proto.Message - 17, // 40: proto.ExtendedTextMessage.font:type_name -> proto.ExtendedTextMessage.FontType - 15, // 41: proto.ExtendedTextMessage.previewType:type_name -> proto.ExtendedTextMessage.PreviewType - 105, // 42: proto.ExtendedTextMessage.contextInfo:type_name -> proto.ContextInfo - 16, // 43: proto.ExtendedTextMessage.inviteLinkGroupType:type_name -> proto.ExtendedTextMessage.InviteLinkGroupType - 16, // 44: proto.ExtendedTextMessage.inviteLinkGroupTypeV2:type_name -> proto.ExtendedTextMessage.InviteLinkGroupType - 151, // 45: proto.EncReactionMessage.targetMessageKey:type_name -> proto.MessageKey - 105, // 46: proto.DocumentMessage.contextInfo:type_name -> proto.ContextInfo - 111, // 47: proto.DeviceSentMessage.message:type_name -> proto.Message - 151, // 48: proto.DeclinePaymentRequestMessage.key:type_name -> proto.MessageKey - 85, // 49: proto.ContactsArrayMessage.contacts:type_name -> proto.ContactMessage - 105, // 50: proto.ContactsArrayMessage.contextInfo:type_name -> proto.ContextInfo - 105, // 51: proto.ContactMessage.contextInfo:type_name -> proto.ContextInfo - 151, // 52: proto.CancelPaymentRequestMessage.key:type_name -> proto.MessageKey - 105, // 53: proto.ButtonsResponseMessage.contextInfo:type_name -> proto.ContextInfo - 18, // 54: proto.ButtonsResponseMessage.type:type_name -> proto.ButtonsResponseMessage.Type - 105, // 55: proto.ButtonsMessage.contextInfo:type_name -> proto.ContextInfo - 249, // 56: proto.ButtonsMessage.buttons:type_name -> proto.ButtonsMessage.Button - 19, // 57: proto.ButtonsMessage.headerType:type_name -> proto.ButtonsMessage.HeaderType - 81, // 58: proto.ButtonsMessage.documentMessage:type_name -> proto.DocumentMessage - 74, // 59: proto.ButtonsMessage.imageMessage:type_name -> proto.ImageMessage - 113, // 60: proto.ButtonsMessage.videoMessage:type_name -> proto.VideoMessage - 65, // 61: proto.ButtonsMessage.locationMessage:type_name -> proto.LocationMessage - 105, // 62: proto.AudioMessage.contextInfo:type_name -> proto.ContextInfo - 95, // 63: proto.AppStateSyncKey.keyId:type_name -> proto.AppStateSyncKeyId - 97, // 64: proto.AppStateSyncKey.keyData:type_name -> proto.AppStateSyncKeyData - 92, // 65: proto.AppStateSyncKeyShare.keys:type_name -> proto.AppStateSyncKey - 95, // 66: proto.AppStateSyncKeyRequest.keyIds:type_name -> proto.AppStateSyncKeyId - 96, // 67: proto.AppStateSyncKeyData.fingerprint:type_name -> proto.AppStateSyncKeyFingerprint - 108, // 68: proto.InteractiveAnnotation.polygonVertices:type_name -> proto.Point - 99, // 69: proto.InteractiveAnnotation.location:type_name -> proto.Location - 253, // 70: proto.HydratedTemplateButton.quickReplyButton:type_name -> proto.HydratedTemplateButton.HydratedQuickReplyButton - 252, // 71: proto.HydratedTemplateButton.urlButton:type_name -> proto.HydratedTemplateButton.HydratedURLButton - 254, // 72: proto.HydratedTemplateButton.callButton:type_name -> proto.HydratedTemplateButton.HydratedCallButton - 21, // 73: proto.DisappearingMode.initiator:type_name -> proto.DisappearingMode.Initiator - 111, // 74: proto.ContextInfo.quotedMessage:type_name -> proto.Message - 257, // 75: proto.ContextInfo.quotedAd:type_name -> proto.ContextInfo.AdReplyInfo - 151, // 76: proto.ContextInfo.placeholderKey:type_name -> proto.MessageKey - 256, // 77: proto.ContextInfo.externalAdReply:type_name -> proto.ContextInfo.ExternalAdReplyInfo - 103, // 78: proto.ContextInfo.disappearingMode:type_name -> proto.DisappearingMode - 106, // 79: proto.ContextInfo.actionLink:type_name -> proto.ActionLink - 102, // 80: proto.ContextInfo.groupMentions:type_name -> proto.GroupMention - 255, // 81: proto.ContextInfo.utm:type_name -> proto.ContextInfo.UTMInfo - 259, // 82: proto.TemplateButton.quickReplyButton:type_name -> proto.TemplateButton.QuickReplyButton - 258, // 83: proto.TemplateButton.urlButton:type_name -> proto.TemplateButton.URLButton - 260, // 84: proto.TemplateButton.callButton:type_name -> proto.TemplateButton.CallButton - 261, // 85: proto.PaymentBackground.mediaData:type_name -> proto.PaymentBackground.MediaData - 24, // 86: proto.PaymentBackground.type:type_name -> proto.PaymentBackground.Type - 118, // 87: proto.Message.senderKeyDistributionMessage:type_name -> proto.SenderKeyDistributionMessage - 74, // 88: proto.Message.imageMessage:type_name -> proto.ImageMessage - 85, // 89: proto.Message.contactMessage:type_name -> proto.ContactMessage - 65, // 90: proto.Message.locationMessage:type_name -> proto.LocationMessage - 79, // 91: proto.Message.extendedTextMessage:type_name -> proto.ExtendedTextMessage - 81, // 92: proto.Message.documentMessage:type_name -> proto.DocumentMessage - 91, // 93: proto.Message.audioMessage:type_name -> proto.AudioMessage - 113, // 94: proto.Message.videoMessage:type_name -> proto.VideoMessage - 88, // 95: proto.Message.call:type_name -> proto.Call - 86, // 96: proto.Message.chat:type_name -> proto.Chat - 125, // 97: proto.Message.protocolMessage:type_name -> proto.ProtocolMessage - 84, // 98: proto.Message.contactsArrayMessage:type_name -> proto.ContactsArrayMessage - 76, // 99: proto.Message.highlyStructuredMessage:type_name -> proto.HighlyStructuredMessage - 118, // 100: proto.Message.fastRatchetKeySenderKeyDistributionMessage:type_name -> proto.SenderKeyDistributionMessage - 119, // 101: proto.Message.sendPaymentMessage:type_name -> proto.SendPaymentMessage - 66, // 102: proto.Message.liveLocationMessage:type_name -> proto.LiveLocationMessage - 123, // 103: proto.Message.requestPaymentMessage:type_name -> proto.RequestPaymentMessage - 83, // 104: proto.Message.declinePaymentRequestMessage:type_name -> proto.DeclinePaymentRequestMessage - 87, // 105: proto.Message.cancelPaymentRequestMessage:type_name -> proto.CancelPaymentRequestMessage - 114, // 106: proto.Message.templateMessage:type_name -> proto.TemplateMessage - 117, // 107: proto.Message.stickerMessage:type_name -> proto.StickerMessage - 77, // 108: proto.Message.groupInviteMessage:type_name -> proto.GroupInviteMessage - 115, // 109: proto.Message.templateButtonReplyMessage:type_name -> proto.TemplateButtonReplyMessage - 126, // 110: proto.Message.productMessage:type_name -> proto.ProductMessage - 82, // 111: proto.Message.deviceSentMessage:type_name -> proto.DeviceSentMessage - 112, // 112: proto.Message.messageContextInfo:type_name -> proto.MessageContextInfo - 68, // 113: proto.Message.listMessage:type_name -> proto.ListMessage - 78, // 114: proto.Message.viewOnceMessage:type_name -> proto.FutureProofMessage - 64, // 115: proto.Message.orderMessage:type_name -> proto.OrderMessage - 67, // 116: proto.Message.listResponseMessage:type_name -> proto.ListResponseMessage - 78, // 117: proto.Message.ephemeralMessage:type_name -> proto.FutureProofMessage - 70, // 118: proto.Message.invoiceMessage:type_name -> proto.InvoiceMessage - 90, // 119: proto.Message.buttonsMessage:type_name -> proto.ButtonsMessage - 89, // 120: proto.Message.buttonsResponseMessage:type_name -> proto.ButtonsResponseMessage - 63, // 121: proto.Message.paymentInviteMessage:type_name -> proto.PaymentInviteMessage - 72, // 122: proto.Message.interactiveMessage:type_name -> proto.InteractiveMessage - 124, // 123: proto.Message.reactionMessage:type_name -> proto.ReactionMessage - 116, // 124: proto.Message.stickerSyncRmrMessage:type_name -> proto.StickerSyncRMRMessage - 71, // 125: proto.Message.interactiveResponseMessage:type_name -> proto.InteractiveResponseMessage - 131, // 126: proto.Message.pollCreationMessage:type_name -> proto.PollCreationMessage - 128, // 127: proto.Message.pollUpdateMessage:type_name -> proto.PollUpdateMessage - 69, // 128: proto.Message.keepInChatMessage:type_name -> proto.KeepInChatMessage - 78, // 129: proto.Message.documentWithCaptionMessage:type_name -> proto.FutureProofMessage - 122, // 130: proto.Message.requestPhoneNumberMessage:type_name -> proto.RequestPhoneNumberMessage - 78, // 131: proto.Message.viewOnceMessageV2:type_name -> proto.FutureProofMessage - 80, // 132: proto.Message.encReactionMessage:type_name -> proto.EncReactionMessage - 78, // 133: proto.Message.editedMessage:type_name -> proto.FutureProofMessage - 78, // 134: proto.Message.viewOnceMessageV2Extension:type_name -> proto.FutureProofMessage - 131, // 135: proto.Message.pollCreationMessageV2:type_name -> proto.PollCreationMessage - 121, // 136: proto.Message.scheduledCallCreationMessage:type_name -> proto.ScheduledCallCreationMessage - 78, // 137: proto.Message.groupMentionedMessage:type_name -> proto.FutureProofMessage - 132, // 138: proto.Message.pinMessage:type_name -> proto.PinMessage - 131, // 139: proto.Message.pollCreationMessageV3:type_name -> proto.PollCreationMessage - 120, // 140: proto.Message.scheduledCallEditMessage:type_name -> proto.ScheduledCallEditMessage - 104, // 141: proto.MessageContextInfo.deviceListMetadata:type_name -> proto.DeviceListMetadata - 100, // 142: proto.VideoMessage.interactiveAnnotations:type_name -> proto.InteractiveAnnotation - 105, // 143: proto.VideoMessage.contextInfo:type_name -> proto.ContextInfo - 25, // 144: proto.VideoMessage.gifAttribution:type_name -> proto.VideoMessage.Attribution - 105, // 145: proto.TemplateMessage.contextInfo:type_name -> proto.ContextInfo - 262, // 146: proto.TemplateMessage.hydratedTemplate:type_name -> proto.TemplateMessage.HydratedFourRowTemplate - 263, // 147: proto.TemplateMessage.fourRowTemplate:type_name -> proto.TemplateMessage.FourRowTemplate - 262, // 148: proto.TemplateMessage.hydratedFourRowTemplate:type_name -> proto.TemplateMessage.HydratedFourRowTemplate - 72, // 149: proto.TemplateMessage.interactiveMessageTemplate:type_name -> proto.InteractiveMessage - 105, // 150: proto.TemplateButtonReplyMessage.contextInfo:type_name -> proto.ContextInfo - 105, // 151: proto.StickerMessage.contextInfo:type_name -> proto.ContextInfo - 111, // 152: proto.SendPaymentMessage.noteMessage:type_name -> proto.Message - 151, // 153: proto.SendPaymentMessage.requestMessageKey:type_name -> proto.MessageKey - 109, // 154: proto.SendPaymentMessage.background:type_name -> proto.PaymentBackground - 151, // 155: proto.ScheduledCallEditMessage.key:type_name -> proto.MessageKey - 26, // 156: proto.ScheduledCallEditMessage.editType:type_name -> proto.ScheduledCallEditMessage.EditType - 27, // 157: proto.ScheduledCallCreationMessage.callType:type_name -> proto.ScheduledCallCreationMessage.CallType - 105, // 158: proto.RequestPhoneNumberMessage.contextInfo:type_name -> proto.ContextInfo - 111, // 159: proto.RequestPaymentMessage.noteMessage:type_name -> proto.Message - 110, // 160: proto.RequestPaymentMessage.amount:type_name -> proto.Money - 109, // 161: proto.RequestPaymentMessage.background:type_name -> proto.PaymentBackground - 151, // 162: proto.ReactionMessage.key:type_name -> proto.MessageKey - 151, // 163: proto.ProtocolMessage.key:type_name -> proto.MessageKey - 28, // 164: proto.ProtocolMessage.type:type_name -> proto.ProtocolMessage.Type - 75, // 165: proto.ProtocolMessage.historySyncNotification:type_name -> proto.HistorySyncNotification - 93, // 166: proto.ProtocolMessage.appStateSyncKeyShare:type_name -> proto.AppStateSyncKeyShare - 94, // 167: proto.ProtocolMessage.appStateSyncKeyRequest:type_name -> proto.AppStateSyncKeyRequest - 73, // 168: proto.ProtocolMessage.initialSecurityNotificationSettingSync:type_name -> proto.InitialSecurityNotificationSettingSync - 98, // 169: proto.ProtocolMessage.appStateFatalExceptionNotification:type_name -> proto.AppStateFatalExceptionNotification - 103, // 170: proto.ProtocolMessage.disappearingMode:type_name -> proto.DisappearingMode - 111, // 171: proto.ProtocolMessage.editedMessage:type_name -> proto.Message - 62, // 172: proto.ProtocolMessage.peerDataOperationRequestMessage:type_name -> proto.PeerDataOperationRequestMessage - 133, // 173: proto.ProtocolMessage.peerDataOperationRequestResponseMessage:type_name -> proto.PeerDataOperationRequestResponseMessage - 264, // 174: proto.ProductMessage.product:type_name -> proto.ProductMessage.ProductSnapshot - 265, // 175: proto.ProductMessage.catalog:type_name -> proto.ProductMessage.CatalogSnapshot - 105, // 176: proto.ProductMessage.contextInfo:type_name -> proto.ContextInfo - 151, // 177: proto.PollUpdateMessage.pollCreationMessageKey:type_name -> proto.MessageKey - 130, // 178: proto.PollUpdateMessage.vote:type_name -> proto.PollEncValue - 129, // 179: proto.PollUpdateMessage.metadata:type_name -> proto.PollUpdateMessageMetadata - 266, // 180: proto.PollCreationMessage.options:type_name -> proto.PollCreationMessage.Option - 105, // 181: proto.PollCreationMessage.contextInfo:type_name -> proto.ContextInfo - 151, // 182: proto.PinMessage.key:type_name -> proto.MessageKey - 29, // 183: proto.PinMessage.pinMessageType:type_name -> proto.PinMessage.PinMessageType - 1, // 184: proto.PeerDataOperationRequestResponseMessage.peerDataOperationRequestType:type_name -> proto.PeerDataOperationRequestType - 267, // 185: proto.PeerDataOperationRequestResponseMessage.peerDataOperationResult:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult - 139, // 186: proto.PastParticipants.pastParticipants:type_name -> proto.PastParticipant - 30, // 187: proto.PastParticipant.leaveReason:type_name -> proto.PastParticipant.LeaveReason - 31, // 188: proto.HistorySync.syncType:type_name -> proto.HistorySync.HistorySyncType - 144, // 189: proto.HistorySync.conversations:type_name -> proto.Conversation - 210, // 190: proto.HistorySync.statusV3Messages:type_name -> proto.WebMessageInfo - 137, // 191: proto.HistorySync.pushnames:type_name -> proto.Pushname - 143, // 192: proto.HistorySync.globalSettings:type_name -> proto.GlobalSettings - 136, // 193: proto.HistorySync.recentStickers:type_name -> proto.StickerMetadata - 138, // 194: proto.HistorySync.pastParticipants:type_name -> proto.PastParticipants - 210, // 195: proto.HistorySyncMsg.message:type_name -> proto.WebMessageInfo - 32, // 196: proto.GroupParticipant.rank:type_name -> proto.GroupParticipant.Rank - 135, // 197: proto.GlobalSettings.lightThemeWallpaper:type_name -> proto.WallpaperSettings - 2, // 198: proto.GlobalSettings.mediaVisibility:type_name -> proto.MediaVisibility - 135, // 199: proto.GlobalSettings.darkThemeWallpaper:type_name -> proto.WallpaperSettings - 146, // 200: proto.GlobalSettings.autoDownloadWiFi:type_name -> proto.AutoDownloadSettings - 146, // 201: proto.GlobalSettings.autoDownloadCellular:type_name -> proto.AutoDownloadSettings - 146, // 202: proto.GlobalSettings.autoDownloadRoaming:type_name -> proto.AutoDownloadSettings - 145, // 203: proto.GlobalSettings.avatarUserSettings:type_name -> proto.AvatarUserSettings - 141, // 204: proto.Conversation.messages:type_name -> proto.HistorySyncMsg - 33, // 205: proto.Conversation.endOfHistoryTransferType:type_name -> proto.Conversation.EndOfHistoryTransferType - 103, // 206: proto.Conversation.disappearingMode:type_name -> proto.DisappearingMode - 142, // 207: proto.Conversation.participant:type_name -> proto.GroupParticipant - 135, // 208: proto.Conversation.wallpaper:type_name -> proto.WallpaperSettings - 2, // 209: proto.Conversation.mediaVisibility:type_name -> proto.MediaVisibility - 148, // 210: proto.MsgRowOpaqueData.currentMsg:type_name -> proto.MsgOpaqueData - 148, // 211: proto.MsgRowOpaqueData.quotedMsg:type_name -> proto.MsgOpaqueData - 269, // 212: proto.MsgOpaqueData.pollOptions:type_name -> proto.MsgOpaqueData.PollOption - 130, // 213: proto.MsgOpaqueData.encPollVote:type_name -> proto.PollEncValue - 34, // 214: proto.MediaRetryNotification.result:type_name -> proto.MediaRetryNotification.ResultType - 152, // 215: proto.SyncdSnapshot.version:type_name -> proto.SyncdVersion - 155, // 216: proto.SyncdSnapshot.records:type_name -> proto.SyncdRecord - 160, // 217: proto.SyncdSnapshot.keyId:type_name -> proto.KeyId - 159, // 218: proto.SyncdRecord.index:type_name -> proto.SyncdIndex - 153, // 219: proto.SyncdRecord.value:type_name -> proto.SyncdValue - 160, // 220: proto.SyncdRecord.keyId:type_name -> proto.KeyId - 152, // 221: proto.SyncdPatch.version:type_name -> proto.SyncdVersion - 158, // 222: proto.SyncdPatch.mutations:type_name -> proto.SyncdMutation - 161, // 223: proto.SyncdPatch.externalMutations:type_name -> proto.ExternalBlobReference - 160, // 224: proto.SyncdPatch.keyId:type_name -> proto.KeyId - 162, // 225: proto.SyncdPatch.exitCode:type_name -> proto.ExitCode - 158, // 226: proto.SyncdMutations.mutations:type_name -> proto.SyncdMutation - 35, // 227: proto.SyncdMutation.operation:type_name -> proto.SyncdMutation.SyncdOperation - 155, // 228: proto.SyncdMutation.record:type_name -> proto.SyncdRecord - 171, // 229: proto.SyncActionValue.starAction:type_name -> proto.StarAction - 190, // 230: proto.SyncActionValue.contactAction:type_name -> proto.ContactAction - 182, // 231: proto.SyncActionValue.muteAction:type_name -> proto.MuteAction - 180, // 232: proto.SyncActionValue.pinAction:type_name -> proto.PinAction - 172, // 233: proto.SyncActionValue.securityNotificationSetting:type_name -> proto.SecurityNotificationSetting - 176, // 234: proto.SyncActionValue.pushNameSetting:type_name -> proto.PushNameSetting - 175, // 235: proto.SyncActionValue.quickReplyAction:type_name -> proto.QuickReplyAction - 174, // 236: proto.SyncActionValue.recentEmojiWeightsAction:type_name -> proto.RecentEmojiWeightsAction - 185, // 237: proto.SyncActionValue.labelEditAction:type_name -> proto.LabelEditAction - 186, // 238: proto.SyncActionValue.labelAssociationAction:type_name -> proto.LabelAssociationAction - 184, // 239: proto.SyncActionValue.localeSetting:type_name -> proto.LocaleSetting - 194, // 240: proto.SyncActionValue.archiveChatAction:type_name -> proto.ArchiveChatAction - 188, // 241: proto.SyncActionValue.deleteMessageForMeAction:type_name -> proto.DeleteMessageForMeAction - 187, // 242: proto.SyncActionValue.keyExpiration:type_name -> proto.KeyExpiration - 183, // 243: proto.SyncActionValue.markChatAsReadAction:type_name -> proto.MarkChatAsReadAction - 191, // 244: proto.SyncActionValue.clearChatAction:type_name -> proto.ClearChatAction - 189, // 245: proto.SyncActionValue.deleteChatAction:type_name -> proto.DeleteChatAction - 165, // 246: proto.SyncActionValue.unarchiveChatsSetting:type_name -> proto.UnarchiveChatsSetting - 178, // 247: proto.SyncActionValue.primaryFeature:type_name -> proto.PrimaryFeature - 195, // 248: proto.SyncActionValue.androidUnsupportedActions:type_name -> proto.AndroidUnsupportedActions - 196, // 249: proto.SyncActionValue.agentAction:type_name -> proto.AgentAction - 169, // 250: proto.SyncActionValue.subscriptionAction:type_name -> proto.SubscriptionAction - 164, // 251: proto.SyncActionValue.userStatusMuteAction:type_name -> proto.UserStatusMuteAction - 166, // 252: proto.SyncActionValue.timeFormatAction:type_name -> proto.TimeFormatAction - 181, // 253: proto.SyncActionValue.nuxAction:type_name -> proto.NuxAction - 177, // 254: proto.SyncActionValue.primaryVersionAction:type_name -> proto.PrimaryVersionAction - 170, // 255: proto.SyncActionValue.stickerAction:type_name -> proto.StickerAction - 173, // 256: proto.SyncActionValue.removeRecentStickerAction:type_name -> proto.RemoveRecentStickerAction - 193, // 257: proto.SyncActionValue.chatAssignment:type_name -> proto.ChatAssignmentAction - 192, // 258: proto.SyncActionValue.chatAssignmentOpenedStatus:type_name -> proto.ChatAssignmentOpenedStatusAction - 179, // 259: proto.SyncActionValue.pnForLidChatAction:type_name -> proto.PnForLidChatAction - 151, // 260: proto.SyncActionMessage.key:type_name -> proto.MessageKey - 167, // 261: proto.SyncActionMessageRange.messages:type_name -> proto.SyncActionMessage - 198, // 262: proto.RecentEmojiWeightsAction.weights:type_name -> proto.RecentEmojiWeight - 168, // 263: proto.MarkChatAsReadAction.messageRange:type_name -> proto.SyncActionMessageRange - 168, // 264: proto.DeleteChatAction.messageRange:type_name -> proto.SyncActionMessageRange - 168, // 265: proto.ClearChatAction.messageRange:type_name -> proto.SyncActionMessageRange - 168, // 266: proto.ArchiveChatAction.messageRange:type_name -> proto.SyncActionMessageRange - 163, // 267: proto.SyncActionData.value:type_name -> proto.SyncActionValue - 36, // 268: proto.BizIdentityInfo.vlevel:type_name -> proto.BizIdentityInfo.VerifiedLevelValue - 199, // 269: proto.BizIdentityInfo.vnameCert:type_name -> proto.VerifiedNameCertificate - 37, // 270: proto.BizIdentityInfo.hostStorage:type_name -> proto.BizIdentityInfo.HostStorageType - 38, // 271: proto.BizIdentityInfo.actualActors:type_name -> proto.BizIdentityInfo.ActualActorsType - 199, // 272: proto.BizAccountPayload.vnameCert:type_name -> proto.VerifiedNameCertificate - 39, // 273: proto.BizAccountLinkInfo.hostStorage:type_name -> proto.BizAccountLinkInfo.HostStorageType - 40, // 274: proto.BizAccountLinkInfo.accountType:type_name -> proto.BizAccountLinkInfo.AccountType - 206, // 275: proto.HandshakeMessage.clientHello:type_name -> proto.HandshakeClientHello - 205, // 276: proto.HandshakeMessage.serverHello:type_name -> proto.HandshakeServerHello - 207, // 277: proto.HandshakeMessage.clientFinish:type_name -> proto.HandshakeClientFinish - 272, // 278: proto.ClientPayload.userAgent:type_name -> proto.ClientPayload.UserAgent - 271, // 279: proto.ClientPayload.webInfo:type_name -> proto.ClientPayload.WebInfo - 43, // 280: proto.ClientPayload.connectType:type_name -> proto.ClientPayload.ConnectType - 44, // 281: proto.ClientPayload.connectReason:type_name -> proto.ClientPayload.ConnectReason - 274, // 282: proto.ClientPayload.dnsSource:type_name -> proto.ClientPayload.DNSSource - 273, // 283: proto.ClientPayload.devicePairingData:type_name -> proto.ClientPayload.DevicePairingRegistrationData - 41, // 284: proto.ClientPayload.product:type_name -> proto.ClientPayload.Product - 42, // 285: proto.ClientPayload.iosAppExtension:type_name -> proto.ClientPayload.IOSAppExtension - 210, // 286: proto.WebNotificationsInfo.notifyMessages:type_name -> proto.WebMessageInfo - 151, // 287: proto.WebMessageInfo.key:type_name -> proto.MessageKey - 111, // 288: proto.WebMessageInfo.message:type_name -> proto.Message - 50, // 289: proto.WebMessageInfo.status:type_name -> proto.WebMessageInfo.Status - 49, // 290: proto.WebMessageInfo.messageStubType:type_name -> proto.WebMessageInfo.StubType - 218, // 291: proto.WebMessageInfo.paymentInfo:type_name -> proto.PaymentInfo - 66, // 292: proto.WebMessageInfo.finalLiveLocation:type_name -> proto.LiveLocationMessage - 218, // 293: proto.WebMessageInfo.quotedPaymentInfo:type_name -> proto.PaymentInfo - 51, // 294: proto.WebMessageInfo.bizPrivacyStatus:type_name -> proto.WebMessageInfo.BizPrivacyStatus - 220, // 295: proto.WebMessageInfo.mediaData:type_name -> proto.MediaData - 217, // 296: proto.WebMessageInfo.photoChange:type_name -> proto.PhotoChange - 212, // 297: proto.WebMessageInfo.userReceipt:type_name -> proto.UserReceipt - 214, // 298: proto.WebMessageInfo.reactions:type_name -> proto.Reaction - 220, // 299: proto.WebMessageInfo.quotedStickerData:type_name -> proto.MediaData - 213, // 300: proto.WebMessageInfo.statusPsa:type_name -> proto.StatusPSA - 215, // 301: proto.WebMessageInfo.pollUpdates:type_name -> proto.PollUpdate - 216, // 302: proto.WebMessageInfo.pollAdditionalMetadata:type_name -> proto.PollAdditionalMetadata - 221, // 303: proto.WebMessageInfo.keepInChat:type_name -> proto.KeepInChat - 52, // 304: proto.WebFeatures.labelsDisplay:type_name -> proto.WebFeatures.Flag - 52, // 305: proto.WebFeatures.voipIndividualOutgoing:type_name -> proto.WebFeatures.Flag - 52, // 306: proto.WebFeatures.groupsV3:type_name -> proto.WebFeatures.Flag - 52, // 307: proto.WebFeatures.groupsV3Create:type_name -> proto.WebFeatures.Flag - 52, // 308: proto.WebFeatures.changeNumberV2:type_name -> proto.WebFeatures.Flag - 52, // 309: proto.WebFeatures.queryStatusV3Thumbnail:type_name -> proto.WebFeatures.Flag - 52, // 310: proto.WebFeatures.liveLocations:type_name -> proto.WebFeatures.Flag - 52, // 311: proto.WebFeatures.queryVname:type_name -> proto.WebFeatures.Flag - 52, // 312: proto.WebFeatures.voipIndividualIncoming:type_name -> proto.WebFeatures.Flag - 52, // 313: proto.WebFeatures.quickRepliesQuery:type_name -> proto.WebFeatures.Flag - 52, // 314: proto.WebFeatures.payments:type_name -> proto.WebFeatures.Flag - 52, // 315: proto.WebFeatures.stickerPackQuery:type_name -> proto.WebFeatures.Flag - 52, // 316: proto.WebFeatures.liveLocationsFinal:type_name -> proto.WebFeatures.Flag - 52, // 317: proto.WebFeatures.labelsEdit:type_name -> proto.WebFeatures.Flag - 52, // 318: proto.WebFeatures.mediaUpload:type_name -> proto.WebFeatures.Flag - 52, // 319: proto.WebFeatures.mediaUploadRichQuickReplies:type_name -> proto.WebFeatures.Flag - 52, // 320: proto.WebFeatures.vnameV2:type_name -> proto.WebFeatures.Flag - 52, // 321: proto.WebFeatures.videoPlaybackUrl:type_name -> proto.WebFeatures.Flag - 52, // 322: proto.WebFeatures.statusRanking:type_name -> proto.WebFeatures.Flag - 52, // 323: proto.WebFeatures.voipIndividualVideo:type_name -> proto.WebFeatures.Flag - 52, // 324: proto.WebFeatures.thirdPartyStickers:type_name -> proto.WebFeatures.Flag - 52, // 325: proto.WebFeatures.frequentlyForwardedSetting:type_name -> proto.WebFeatures.Flag - 52, // 326: proto.WebFeatures.groupsV4JoinPermission:type_name -> proto.WebFeatures.Flag - 52, // 327: proto.WebFeatures.recentStickers:type_name -> proto.WebFeatures.Flag - 52, // 328: proto.WebFeatures.catalog:type_name -> proto.WebFeatures.Flag - 52, // 329: proto.WebFeatures.starredStickers:type_name -> proto.WebFeatures.Flag - 52, // 330: proto.WebFeatures.voipGroupCall:type_name -> proto.WebFeatures.Flag - 52, // 331: proto.WebFeatures.templateMessage:type_name -> proto.WebFeatures.Flag - 52, // 332: proto.WebFeatures.templateMessageInteractivity:type_name -> proto.WebFeatures.Flag - 52, // 333: proto.WebFeatures.ephemeralMessages:type_name -> proto.WebFeatures.Flag - 52, // 334: proto.WebFeatures.e2ENotificationSync:type_name -> proto.WebFeatures.Flag - 52, // 335: proto.WebFeatures.recentStickersV2:type_name -> proto.WebFeatures.Flag - 52, // 336: proto.WebFeatures.recentStickersV3:type_name -> proto.WebFeatures.Flag - 52, // 337: proto.WebFeatures.userNotice:type_name -> proto.WebFeatures.Flag - 52, // 338: proto.WebFeatures.support:type_name -> proto.WebFeatures.Flag - 52, // 339: proto.WebFeatures.groupUiiCleanup:type_name -> proto.WebFeatures.Flag - 52, // 340: proto.WebFeatures.groupDogfoodingInternalOnly:type_name -> proto.WebFeatures.Flag - 52, // 341: proto.WebFeatures.settingsSync:type_name -> proto.WebFeatures.Flag - 52, // 342: proto.WebFeatures.archiveV2:type_name -> proto.WebFeatures.Flag - 52, // 343: proto.WebFeatures.ephemeralAllowGroupMembers:type_name -> proto.WebFeatures.Flag - 52, // 344: proto.WebFeatures.ephemeral24HDuration:type_name -> proto.WebFeatures.Flag - 52, // 345: proto.WebFeatures.mdForceUpgrade:type_name -> proto.WebFeatures.Flag - 52, // 346: proto.WebFeatures.disappearingMode:type_name -> proto.WebFeatures.Flag - 52, // 347: proto.WebFeatures.externalMdOptInAvailable:type_name -> proto.WebFeatures.Flag - 52, // 348: proto.WebFeatures.noDeleteMessageTimeLimit:type_name -> proto.WebFeatures.Flag - 151, // 349: proto.Reaction.key:type_name -> proto.MessageKey - 151, // 350: proto.PollUpdate.pollUpdateMessageKey:type_name -> proto.MessageKey - 127, // 351: proto.PollUpdate.vote:type_name -> proto.PollVoteMessage - 55, // 352: proto.PaymentInfo.currencyDeprecated:type_name -> proto.PaymentInfo.Currency - 54, // 353: proto.PaymentInfo.status:type_name -> proto.PaymentInfo.Status - 151, // 354: proto.PaymentInfo.requestMessageKey:type_name -> proto.MessageKey - 53, // 355: proto.PaymentInfo.txnStatus:type_name -> proto.PaymentInfo.TxnStatus - 110, // 356: proto.PaymentInfo.primaryAmount:type_name -> proto.Money - 110, // 357: proto.PaymentInfo.exchangeAmount:type_name -> proto.Money - 151, // 358: proto.NotificationMessageInfo.key:type_name -> proto.MessageKey - 111, // 359: proto.NotificationMessageInfo.message:type_name -> proto.Message - 0, // 360: proto.KeepInChat.keepType:type_name -> proto.KeepType - 151, // 361: proto.KeepInChat.key:type_name -> proto.MessageKey - 278, // 362: proto.CertChain.leaf:type_name -> proto.CertChain.NoiseCertificate - 278, // 363: proto.CertChain.intermediate:type_name -> proto.CertChain.NoiseCertificate - 230, // 364: proto.ListMessage.Section.rows:type_name -> proto.ListMessage.Row - 231, // 365: proto.ListMessage.ProductSection.products:type_name -> proto.ListMessage.Product - 232, // 366: proto.ListMessage.ProductListInfo.productSections:type_name -> proto.ListMessage.ProductSection - 234, // 367: proto.ListMessage.ProductListInfo.headerImage:type_name -> proto.ListMessage.ProductListHeaderImage - 10, // 368: proto.InteractiveMessage.ShopMessage.surface:type_name -> proto.InteractiveMessage.ShopMessage.Surface - 243, // 369: proto.InteractiveMessage.NativeFlowMessage.buttons:type_name -> proto.InteractiveMessage.NativeFlowMessage.NativeFlowButton - 81, // 370: proto.InteractiveMessage.Header.documentMessage:type_name -> proto.DocumentMessage - 74, // 371: proto.InteractiveMessage.Header.imageMessage:type_name -> proto.ImageMessage - 113, // 372: proto.InteractiveMessage.Header.videoMessage:type_name -> proto.VideoMessage - 246, // 373: proto.HighlyStructuredMessage.HSMLocalizableParameter.currency:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency - 245, // 374: proto.HighlyStructuredMessage.HSMLocalizableParameter.dateTime:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime - 248, // 375: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.component:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent - 247, // 376: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.unixEpoch:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch - 12, // 377: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.dayOfWeek:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType - 13, // 378: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.calendar:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType - 251, // 379: proto.ButtonsMessage.Button.buttonText:type_name -> proto.ButtonsMessage.Button.ButtonText - 20, // 380: proto.ButtonsMessage.Button.type:type_name -> proto.ButtonsMessage.Button.Type - 250, // 381: proto.ButtonsMessage.Button.nativeFlowInfo:type_name -> proto.ButtonsMessage.Button.NativeFlowInfo - 22, // 382: proto.ContextInfo.ExternalAdReplyInfo.mediaType:type_name -> proto.ContextInfo.ExternalAdReplyInfo.MediaType - 23, // 383: proto.ContextInfo.AdReplyInfo.mediaType:type_name -> proto.ContextInfo.AdReplyInfo.MediaType - 76, // 384: proto.TemplateButton.URLButton.displayText:type_name -> proto.HighlyStructuredMessage - 76, // 385: proto.TemplateButton.URLButton.url:type_name -> proto.HighlyStructuredMessage - 76, // 386: proto.TemplateButton.QuickReplyButton.displayText:type_name -> proto.HighlyStructuredMessage - 76, // 387: proto.TemplateButton.CallButton.displayText:type_name -> proto.HighlyStructuredMessage - 76, // 388: proto.TemplateButton.CallButton.phoneNumber:type_name -> proto.HighlyStructuredMessage - 101, // 389: proto.TemplateMessage.HydratedFourRowTemplate.hydratedButtons:type_name -> proto.HydratedTemplateButton - 81, // 390: proto.TemplateMessage.HydratedFourRowTemplate.documentMessage:type_name -> proto.DocumentMessage - 74, // 391: proto.TemplateMessage.HydratedFourRowTemplate.imageMessage:type_name -> proto.ImageMessage - 113, // 392: proto.TemplateMessage.HydratedFourRowTemplate.videoMessage:type_name -> proto.VideoMessage - 65, // 393: proto.TemplateMessage.HydratedFourRowTemplate.locationMessage:type_name -> proto.LocationMessage - 76, // 394: proto.TemplateMessage.FourRowTemplate.content:type_name -> proto.HighlyStructuredMessage - 76, // 395: proto.TemplateMessage.FourRowTemplate.footer:type_name -> proto.HighlyStructuredMessage - 107, // 396: proto.TemplateMessage.FourRowTemplate.buttons:type_name -> proto.TemplateButton - 81, // 397: proto.TemplateMessage.FourRowTemplate.documentMessage:type_name -> proto.DocumentMessage - 76, // 398: proto.TemplateMessage.FourRowTemplate.highlyStructuredMessage:type_name -> proto.HighlyStructuredMessage - 74, // 399: proto.TemplateMessage.FourRowTemplate.imageMessage:type_name -> proto.ImageMessage - 113, // 400: proto.TemplateMessage.FourRowTemplate.videoMessage:type_name -> proto.VideoMessage - 65, // 401: proto.TemplateMessage.FourRowTemplate.locationMessage:type_name -> proto.LocationMessage - 74, // 402: proto.ProductMessage.ProductSnapshot.productImage:type_name -> proto.ImageMessage - 74, // 403: proto.ProductMessage.CatalogSnapshot.catalogImage:type_name -> proto.ImageMessage - 34, // 404: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.mediaUploadResult:type_name -> proto.MediaRetryNotification.ResultType - 117, // 405: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.stickerMessage:type_name -> proto.StickerMessage - 268, // 406: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.linkPreviewResponse:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse - 200, // 407: proto.VerifiedNameCertificate.Details.localizedNames:type_name -> proto.LocalizedName - 275, // 408: proto.ClientPayload.WebInfo.webdPayload:type_name -> proto.ClientPayload.WebInfo.WebdPayload - 45, // 409: proto.ClientPayload.WebInfo.webSubPlatform:type_name -> proto.ClientPayload.WebInfo.WebSubPlatform - 47, // 410: proto.ClientPayload.UserAgent.platform:type_name -> proto.ClientPayload.UserAgent.Platform - 276, // 411: proto.ClientPayload.UserAgent.appVersion:type_name -> proto.ClientPayload.UserAgent.AppVersion - 46, // 412: proto.ClientPayload.UserAgent.releaseChannel:type_name -> proto.ClientPayload.UserAgent.ReleaseChannel - 48, // 413: proto.ClientPayload.DNSSource.dnsMethod:type_name -> proto.ClientPayload.DNSSource.DNSResolutionMethod - 414, // [414:414] is the sub-list for method output_type - 414, // [414:414] is the sub-list for method input_type - 414, // [414:414] is the sub-list for extension type_name - 414, // [414:414] is the sub-list for extension extendee - 0, // [0:414] is the sub-list for field type_name + 234, // 2: proto.DeviceProps.historySyncConfig:type_name -> proto.DeviceProps.HistorySyncConfig + 4, // 3: proto.PaymentInviteMessage.serviceType:type_name -> proto.PaymentInviteMessage.ServiceType + 6, // 4: proto.OrderMessage.status:type_name -> proto.OrderMessage.OrderStatus + 5, // 5: proto.OrderMessage.surface:type_name -> proto.OrderMessage.OrderSurface + 108, // 6: proto.OrderMessage.contextInfo:type_name -> proto.ContextInfo + 108, // 7: proto.LocationMessage.contextInfo:type_name -> proto.ContextInfo + 108, // 8: proto.LiveLocationMessage.contextInfo:type_name -> proto.ContextInfo + 7, // 9: proto.ListResponseMessage.listType:type_name -> proto.ListResponseMessage.ListType + 236, // 10: proto.ListResponseMessage.singleSelectReply:type_name -> proto.ListResponseMessage.SingleSelectReply + 108, // 11: proto.ListResponseMessage.contextInfo:type_name -> proto.ContextInfo + 8, // 12: proto.ListMessage.listType:type_name -> proto.ListMessage.ListType + 237, // 13: proto.ListMessage.sections:type_name -> proto.ListMessage.Section + 241, // 14: proto.ListMessage.productListInfo:type_name -> proto.ListMessage.ProductListInfo + 108, // 15: proto.ListMessage.contextInfo:type_name -> proto.ContextInfo + 156, // 16: proto.KeepInChatMessage.key:type_name -> proto.MessageKey + 0, // 17: proto.KeepInChatMessage.keepType:type_name -> proto.KeepType + 9, // 18: proto.InvoiceMessage.attachmentType:type_name -> proto.InvoiceMessage.AttachmentType + 244, // 19: proto.InteractiveResponseMessage.body:type_name -> proto.InteractiveResponseMessage.Body + 108, // 20: proto.InteractiveResponseMessage.contextInfo:type_name -> proto.ContextInfo + 243, // 21: proto.InteractiveResponseMessage.nativeFlowResponseMessage:type_name -> proto.InteractiveResponseMessage.NativeFlowResponseMessage + 247, // 22: proto.InteractiveMessage.header:type_name -> proto.InteractiveMessage.Header + 250, // 23: proto.InteractiveMessage.body:type_name -> proto.InteractiveMessage.Body + 248, // 24: proto.InteractiveMessage.footer:type_name -> proto.InteractiveMessage.Footer + 108, // 25: proto.InteractiveMessage.contextInfo:type_name -> proto.ContextInfo + 245, // 26: proto.InteractiveMessage.shopStorefrontMessage:type_name -> proto.InteractiveMessage.ShopMessage + 249, // 27: proto.InteractiveMessage.collectionMessage:type_name -> proto.InteractiveMessage.CollectionMessage + 246, // 28: proto.InteractiveMessage.nativeFlowMessage:type_name -> proto.InteractiveMessage.NativeFlowMessage + 103, // 29: proto.ImageMessage.interactiveAnnotations:type_name -> proto.InteractiveAnnotation + 108, // 30: proto.ImageMessage.contextInfo:type_name -> proto.ContextInfo + 12, // 31: proto.HistorySyncNotification.syncType:type_name -> proto.HistorySyncNotification.HistorySyncType + 252, // 32: proto.HighlyStructuredMessage.localizableParams:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter + 117, // 33: proto.HighlyStructuredMessage.hydratedHsm:type_name -> proto.TemplateMessage + 108, // 34: proto.GroupInviteMessage.contextInfo:type_name -> proto.ContextInfo + 15, // 35: proto.GroupInviteMessage.groupType:type_name -> proto.GroupInviteMessage.GroupType + 114, // 36: proto.FutureProofMessage.message:type_name -> proto.Message + 18, // 37: proto.ExtendedTextMessage.font:type_name -> proto.ExtendedTextMessage.FontType + 16, // 38: proto.ExtendedTextMessage.previewType:type_name -> proto.ExtendedTextMessage.PreviewType + 108, // 39: proto.ExtendedTextMessage.contextInfo:type_name -> proto.ContextInfo + 17, // 40: proto.ExtendedTextMessage.inviteLinkGroupType:type_name -> proto.ExtendedTextMessage.InviteLinkGroupType + 17, // 41: proto.ExtendedTextMessage.inviteLinkGroupTypeV2:type_name -> proto.ExtendedTextMessage.InviteLinkGroupType + 156, // 42: proto.EncReactionMessage.targetMessageKey:type_name -> proto.MessageKey + 108, // 43: proto.DocumentMessage.contextInfo:type_name -> proto.ContextInfo + 114, // 44: proto.DeviceSentMessage.message:type_name -> proto.Message + 156, // 45: proto.DeclinePaymentRequestMessage.key:type_name -> proto.MessageKey + 88, // 46: proto.ContactsArrayMessage.contacts:type_name -> proto.ContactMessage + 108, // 47: proto.ContactsArrayMessage.contextInfo:type_name -> proto.ContextInfo + 108, // 48: proto.ContactMessageV2.contextInfo:type_name -> proto.ContextInfo + 108, // 49: proto.ContactMessage.contextInfo:type_name -> proto.ContextInfo + 156, // 50: proto.CancelPaymentRequestMessage.key:type_name -> proto.MessageKey + 108, // 51: proto.ButtonsResponseMessage.contextInfo:type_name -> proto.ContextInfo + 19, // 52: proto.ButtonsResponseMessage.type:type_name -> proto.ButtonsResponseMessage.Type + 108, // 53: proto.ButtonsMessage.contextInfo:type_name -> proto.ContextInfo + 257, // 54: proto.ButtonsMessage.buttons:type_name -> proto.ButtonsMessage.Button + 20, // 55: proto.ButtonsMessage.headerType:type_name -> proto.ButtonsMessage.HeaderType + 83, // 56: proto.ButtonsMessage.documentMessage:type_name -> proto.DocumentMessage + 76, // 57: proto.ButtonsMessage.imageMessage:type_name -> proto.ImageMessage + 116, // 58: proto.ButtonsMessage.videoMessage:type_name -> proto.VideoMessage + 67, // 59: proto.ButtonsMessage.locationMessage:type_name -> proto.LocationMessage + 108, // 60: proto.AudioMessage.contextInfo:type_name -> proto.ContextInfo + 98, // 61: proto.AppStateSyncKey.keyId:type_name -> proto.AppStateSyncKeyId + 100, // 62: proto.AppStateSyncKey.keyData:type_name -> proto.AppStateSyncKeyData + 95, // 63: proto.AppStateSyncKeyShare.keys:type_name -> proto.AppStateSyncKey + 98, // 64: proto.AppStateSyncKeyRequest.keyIds:type_name -> proto.AppStateSyncKeyId + 99, // 65: proto.AppStateSyncKeyData.fingerprint:type_name -> proto.AppStateSyncKeyFingerprint + 111, // 66: proto.InteractiveAnnotation.polygonVertices:type_name -> proto.Point + 102, // 67: proto.InteractiveAnnotation.location:type_name -> proto.Location + 261, // 68: proto.HydratedTemplateButton.quickReplyButton:type_name -> proto.HydratedTemplateButton.HydratedQuickReplyButton + 260, // 69: proto.HydratedTemplateButton.urlButton:type_name -> proto.HydratedTemplateButton.HydratedURLButton + 262, // 70: proto.HydratedTemplateButton.callButton:type_name -> proto.HydratedTemplateButton.HydratedCallButton + 22, // 71: proto.DisappearingMode.initiator:type_name -> proto.DisappearingMode.Initiator + 114, // 72: proto.ContextInfo.quotedMessage:type_name -> proto.Message + 265, // 73: proto.ContextInfo.quotedAd:type_name -> proto.ContextInfo.AdReplyInfo + 156, // 74: proto.ContextInfo.placeholderKey:type_name -> proto.MessageKey + 264, // 75: proto.ContextInfo.externalAdReply:type_name -> proto.ContextInfo.ExternalAdReplyInfo + 106, // 76: proto.ContextInfo.disappearingMode:type_name -> proto.DisappearingMode + 109, // 77: proto.ContextInfo.actionLink:type_name -> proto.ActionLink + 105, // 78: proto.ContextInfo.groupMentions:type_name -> proto.GroupMention + 263, // 79: proto.ContextInfo.utm:type_name -> proto.ContextInfo.UTMInfo + 267, // 80: proto.TemplateButton.quickReplyButton:type_name -> proto.TemplateButton.QuickReplyButton + 266, // 81: proto.TemplateButton.urlButton:type_name -> proto.TemplateButton.URLButton + 268, // 82: proto.TemplateButton.callButton:type_name -> proto.TemplateButton.CallButton + 269, // 83: proto.PaymentBackground.mediaData:type_name -> proto.PaymentBackground.MediaData + 25, // 84: proto.PaymentBackground.type:type_name -> proto.PaymentBackground.Type + 121, // 85: proto.Message.senderKeyDistributionMessage:type_name -> proto.SenderKeyDistributionMessage + 76, // 86: proto.Message.imageMessage:type_name -> proto.ImageMessage + 88, // 87: proto.Message.contactMessage:type_name -> proto.ContactMessage + 67, // 88: proto.Message.locationMessage:type_name -> proto.LocationMessage + 81, // 89: proto.Message.extendedTextMessage:type_name -> proto.ExtendedTextMessage + 83, // 90: proto.Message.documentMessage:type_name -> proto.DocumentMessage + 94, // 91: proto.Message.audioMessage:type_name -> proto.AudioMessage + 116, // 92: proto.Message.videoMessage:type_name -> proto.VideoMessage + 91, // 93: proto.Message.call:type_name -> proto.Call + 89, // 94: proto.Message.chat:type_name -> proto.Chat + 128, // 95: proto.Message.protocolMessage:type_name -> proto.ProtocolMessage + 86, // 96: proto.Message.contactsArrayMessage:type_name -> proto.ContactsArrayMessage + 78, // 97: proto.Message.highlyStructuredMessage:type_name -> proto.HighlyStructuredMessage + 121, // 98: proto.Message.fastRatchetKeySenderKeyDistributionMessage:type_name -> proto.SenderKeyDistributionMessage + 122, // 99: proto.Message.sendPaymentMessage:type_name -> proto.SendPaymentMessage + 68, // 100: proto.Message.liveLocationMessage:type_name -> proto.LiveLocationMessage + 126, // 101: proto.Message.requestPaymentMessage:type_name -> proto.RequestPaymentMessage + 85, // 102: proto.Message.declinePaymentRequestMessage:type_name -> proto.DeclinePaymentRequestMessage + 90, // 103: proto.Message.cancelPaymentRequestMessage:type_name -> proto.CancelPaymentRequestMessage + 117, // 104: proto.Message.templateMessage:type_name -> proto.TemplateMessage + 120, // 105: proto.Message.stickerMessage:type_name -> proto.StickerMessage + 79, // 106: proto.Message.groupInviteMessage:type_name -> proto.GroupInviteMessage + 118, // 107: proto.Message.templateButtonReplyMessage:type_name -> proto.TemplateButtonReplyMessage + 129, // 108: proto.Message.productMessage:type_name -> proto.ProductMessage + 84, // 109: proto.Message.deviceSentMessage:type_name -> proto.DeviceSentMessage + 115, // 110: proto.Message.messageContextInfo:type_name -> proto.MessageContextInfo + 70, // 111: proto.Message.listMessage:type_name -> proto.ListMessage + 80, // 112: proto.Message.viewOnceMessage:type_name -> proto.FutureProofMessage + 66, // 113: proto.Message.orderMessage:type_name -> proto.OrderMessage + 69, // 114: proto.Message.listResponseMessage:type_name -> proto.ListResponseMessage + 80, // 115: proto.Message.ephemeralMessage:type_name -> proto.FutureProofMessage + 72, // 116: proto.Message.invoiceMessage:type_name -> proto.InvoiceMessage + 93, // 117: proto.Message.buttonsMessage:type_name -> proto.ButtonsMessage + 92, // 118: proto.Message.buttonsResponseMessage:type_name -> proto.ButtonsResponseMessage + 65, // 119: proto.Message.paymentInviteMessage:type_name -> proto.PaymentInviteMessage + 74, // 120: proto.Message.interactiveMessage:type_name -> proto.InteractiveMessage + 127, // 121: proto.Message.reactionMessage:type_name -> proto.ReactionMessage + 119, // 122: proto.Message.stickerSyncRmrMessage:type_name -> proto.StickerSyncRMRMessage + 73, // 123: proto.Message.interactiveResponseMessage:type_name -> proto.InteractiveResponseMessage + 134, // 124: proto.Message.pollCreationMessage:type_name -> proto.PollCreationMessage + 131, // 125: proto.Message.pollUpdateMessage:type_name -> proto.PollUpdateMessage + 71, // 126: proto.Message.keepInChatMessage:type_name -> proto.KeepInChatMessage + 80, // 127: proto.Message.documentWithCaptionMessage:type_name -> proto.FutureProofMessage + 125, // 128: proto.Message.requestPhoneNumberMessage:type_name -> proto.RequestPhoneNumberMessage + 80, // 129: proto.Message.viewOnceMessageV2:type_name -> proto.FutureProofMessage + 82, // 130: proto.Message.encReactionMessage:type_name -> proto.EncReactionMessage + 80, // 131: proto.Message.editedMessage:type_name -> proto.FutureProofMessage + 80, // 132: proto.Message.viewOnceMessageV2Extension:type_name -> proto.FutureProofMessage + 134, // 133: proto.Message.pollCreationMessageV2:type_name -> proto.PollCreationMessage + 124, // 134: proto.Message.scheduledCallCreationMessage:type_name -> proto.ScheduledCallCreationMessage + 80, // 135: proto.Message.groupMentionedMessage:type_name -> proto.FutureProofMessage + 135, // 136: proto.Message.pinMessage:type_name -> proto.PinMessage + 134, // 137: proto.Message.pollCreationMessageV3:type_name -> proto.PollCreationMessage + 123, // 138: proto.Message.scheduledCallEditMessage:type_name -> proto.ScheduledCallEditMessage + 116, // 139: proto.Message.ptvMessage:type_name -> proto.VideoMessage + 107, // 140: proto.MessageContextInfo.deviceListMetadata:type_name -> proto.DeviceListMetadata + 103, // 141: proto.VideoMessage.interactiveAnnotations:type_name -> proto.InteractiveAnnotation + 108, // 142: proto.VideoMessage.contextInfo:type_name -> proto.ContextInfo + 26, // 143: proto.VideoMessage.gifAttribution:type_name -> proto.VideoMessage.Attribution + 108, // 144: proto.TemplateMessage.contextInfo:type_name -> proto.ContextInfo + 270, // 145: proto.TemplateMessage.hydratedTemplate:type_name -> proto.TemplateMessage.HydratedFourRowTemplate + 271, // 146: proto.TemplateMessage.fourRowTemplate:type_name -> proto.TemplateMessage.FourRowTemplate + 270, // 147: proto.TemplateMessage.hydratedFourRowTemplate:type_name -> proto.TemplateMessage.HydratedFourRowTemplate + 74, // 148: proto.TemplateMessage.interactiveMessageTemplate:type_name -> proto.InteractiveMessage + 108, // 149: proto.TemplateButtonReplyMessage.contextInfo:type_name -> proto.ContextInfo + 108, // 150: proto.StickerMessage.contextInfo:type_name -> proto.ContextInfo + 114, // 151: proto.SendPaymentMessage.noteMessage:type_name -> proto.Message + 156, // 152: proto.SendPaymentMessage.requestMessageKey:type_name -> proto.MessageKey + 112, // 153: proto.SendPaymentMessage.background:type_name -> proto.PaymentBackground + 156, // 154: proto.ScheduledCallEditMessage.key:type_name -> proto.MessageKey + 27, // 155: proto.ScheduledCallEditMessage.editType:type_name -> proto.ScheduledCallEditMessage.EditType + 28, // 156: proto.ScheduledCallCreationMessage.callType:type_name -> proto.ScheduledCallCreationMessage.CallType + 108, // 157: proto.RequestPhoneNumberMessage.contextInfo:type_name -> proto.ContextInfo + 114, // 158: proto.RequestPaymentMessage.noteMessage:type_name -> proto.Message + 113, // 159: proto.RequestPaymentMessage.amount:type_name -> proto.Money + 112, // 160: proto.RequestPaymentMessage.background:type_name -> proto.PaymentBackground + 156, // 161: proto.ReactionMessage.key:type_name -> proto.MessageKey + 156, // 162: proto.ProtocolMessage.key:type_name -> proto.MessageKey + 29, // 163: proto.ProtocolMessage.type:type_name -> proto.ProtocolMessage.Type + 77, // 164: proto.ProtocolMessage.historySyncNotification:type_name -> proto.HistorySyncNotification + 96, // 165: proto.ProtocolMessage.appStateSyncKeyShare:type_name -> proto.AppStateSyncKeyShare + 97, // 166: proto.ProtocolMessage.appStateSyncKeyRequest:type_name -> proto.AppStateSyncKeyRequest + 75, // 167: proto.ProtocolMessage.initialSecurityNotificationSettingSync:type_name -> proto.InitialSecurityNotificationSettingSync + 101, // 168: proto.ProtocolMessage.appStateFatalExceptionNotification:type_name -> proto.AppStateFatalExceptionNotification + 106, // 169: proto.ProtocolMessage.disappearingMode:type_name -> proto.DisappearingMode + 114, // 170: proto.ProtocolMessage.editedMessage:type_name -> proto.Message + 137, // 171: proto.ProtocolMessage.peerDataOperationRequestMessage:type_name -> proto.PeerDataOperationRequestMessage + 136, // 172: proto.ProtocolMessage.peerDataOperationRequestResponseMessage:type_name -> proto.PeerDataOperationRequestResponseMessage + 272, // 173: proto.ProductMessage.product:type_name -> proto.ProductMessage.ProductSnapshot + 273, // 174: proto.ProductMessage.catalog:type_name -> proto.ProductMessage.CatalogSnapshot + 108, // 175: proto.ProductMessage.contextInfo:type_name -> proto.ContextInfo + 156, // 176: proto.PollUpdateMessage.pollCreationMessageKey:type_name -> proto.MessageKey + 133, // 177: proto.PollUpdateMessage.vote:type_name -> proto.PollEncValue + 132, // 178: proto.PollUpdateMessage.metadata:type_name -> proto.PollUpdateMessageMetadata + 274, // 179: proto.PollCreationMessage.options:type_name -> proto.PollCreationMessage.Option + 108, // 180: proto.PollCreationMessage.contextInfo:type_name -> proto.ContextInfo + 156, // 181: proto.PinMessage.key:type_name -> proto.MessageKey + 30, // 182: proto.PinMessage.pinMessageType:type_name -> proto.PinMessage.PinMessageType + 1, // 183: proto.PeerDataOperationRequestResponseMessage.peerDataOperationRequestType:type_name -> proto.PeerDataOperationRequestType + 275, // 184: proto.PeerDataOperationRequestResponseMessage.peerDataOperationResult:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + 1, // 185: proto.PeerDataOperationRequestMessage.peerDataOperationRequestType:type_name -> proto.PeerDataOperationRequestType + 279, // 186: proto.PeerDataOperationRequestMessage.requestStickerReupload:type_name -> proto.PeerDataOperationRequestMessage.RequestStickerReupload + 282, // 187: proto.PeerDataOperationRequestMessage.requestUrlPreview:type_name -> proto.PeerDataOperationRequestMessage.RequestUrlPreview + 281, // 188: proto.PeerDataOperationRequestMessage.historySyncOnDemandRequest:type_name -> proto.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + 280, // 189: proto.PeerDataOperationRequestMessage.placeholderMessageResendRequest:type_name -> proto.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest + 143, // 190: proto.PastParticipants.pastParticipants:type_name -> proto.PastParticipant + 31, // 191: proto.PastParticipant.leaveReason:type_name -> proto.PastParticipant.LeaveReason + 32, // 192: proto.HistorySync.syncType:type_name -> proto.HistorySync.HistorySyncType + 149, // 193: proto.HistorySync.conversations:type_name -> proto.Conversation + 219, // 194: proto.HistorySync.statusV3Messages:type_name -> proto.WebMessageInfo + 141, // 195: proto.HistorySync.pushnames:type_name -> proto.Pushname + 148, // 196: proto.HistorySync.globalSettings:type_name -> proto.GlobalSettings + 140, // 197: proto.HistorySync.recentStickers:type_name -> proto.StickerMetadata + 142, // 198: proto.HistorySync.pastParticipants:type_name -> proto.PastParticipants + 219, // 199: proto.HistorySyncMsg.message:type_name -> proto.WebMessageInfo + 33, // 200: proto.GroupParticipant.rank:type_name -> proto.GroupParticipant.Rank + 139, // 201: proto.GlobalSettings.lightThemeWallpaper:type_name -> proto.WallpaperSettings + 2, // 202: proto.GlobalSettings.mediaVisibility:type_name -> proto.MediaVisibility + 139, // 203: proto.GlobalSettings.darkThemeWallpaper:type_name -> proto.WallpaperSettings + 151, // 204: proto.GlobalSettings.autoDownloadWiFi:type_name -> proto.AutoDownloadSettings + 151, // 205: proto.GlobalSettings.autoDownloadCellular:type_name -> proto.AutoDownloadSettings + 151, // 206: proto.GlobalSettings.autoDownloadRoaming:type_name -> proto.AutoDownloadSettings + 150, // 207: proto.GlobalSettings.avatarUserSettings:type_name -> proto.AvatarUserSettings + 144, // 208: proto.GlobalSettings.individualNotificationSettings:type_name -> proto.NotificationSettings + 144, // 209: proto.GlobalSettings.groupNotificationSettings:type_name -> proto.NotificationSettings + 146, // 210: proto.Conversation.messages:type_name -> proto.HistorySyncMsg + 34, // 211: proto.Conversation.endOfHistoryTransferType:type_name -> proto.Conversation.EndOfHistoryTransferType + 106, // 212: proto.Conversation.disappearingMode:type_name -> proto.DisappearingMode + 147, // 213: proto.Conversation.participant:type_name -> proto.GroupParticipant + 139, // 214: proto.Conversation.wallpaper:type_name -> proto.WallpaperSettings + 2, // 215: proto.Conversation.mediaVisibility:type_name -> proto.MediaVisibility + 153, // 216: proto.MsgRowOpaqueData.currentMsg:type_name -> proto.MsgOpaqueData + 153, // 217: proto.MsgRowOpaqueData.quotedMsg:type_name -> proto.MsgOpaqueData + 283, // 218: proto.MsgOpaqueData.pollOptions:type_name -> proto.MsgOpaqueData.PollOption + 133, // 219: proto.MsgOpaqueData.encPollVote:type_name -> proto.PollEncValue + 35, // 220: proto.MediaRetryNotification.result:type_name -> proto.MediaRetryNotification.ResultType + 157, // 221: proto.SyncdSnapshot.version:type_name -> proto.SyncdVersion + 160, // 222: proto.SyncdSnapshot.records:type_name -> proto.SyncdRecord + 165, // 223: proto.SyncdSnapshot.keyId:type_name -> proto.KeyId + 164, // 224: proto.SyncdRecord.index:type_name -> proto.SyncdIndex + 158, // 225: proto.SyncdRecord.value:type_name -> proto.SyncdValue + 165, // 226: proto.SyncdRecord.keyId:type_name -> proto.KeyId + 157, // 227: proto.SyncdPatch.version:type_name -> proto.SyncdVersion + 163, // 228: proto.SyncdPatch.mutations:type_name -> proto.SyncdMutation + 166, // 229: proto.SyncdPatch.externalMutations:type_name -> proto.ExternalBlobReference + 165, // 230: proto.SyncdPatch.keyId:type_name -> proto.KeyId + 167, // 231: proto.SyncdPatch.exitCode:type_name -> proto.ExitCode + 163, // 232: proto.SyncdMutations.mutations:type_name -> proto.SyncdMutation + 36, // 233: proto.SyncdMutation.operation:type_name -> proto.SyncdMutation.SyncdOperation + 160, // 234: proto.SyncdMutation.record:type_name -> proto.SyncdRecord + 176, // 235: proto.SyncActionValue.starAction:type_name -> proto.StarAction + 199, // 236: proto.SyncActionValue.contactAction:type_name -> proto.ContactAction + 188, // 237: proto.SyncActionValue.muteAction:type_name -> proto.MuteAction + 186, // 238: proto.SyncActionValue.pinAction:type_name -> proto.PinAction + 177, // 239: proto.SyncActionValue.securityNotificationSetting:type_name -> proto.SecurityNotificationSetting + 181, // 240: proto.SyncActionValue.pushNameSetting:type_name -> proto.PushNameSetting + 180, // 241: proto.SyncActionValue.quickReplyAction:type_name -> proto.QuickReplyAction + 179, // 242: proto.SyncActionValue.recentEmojiWeightsAction:type_name -> proto.RecentEmojiWeightsAction + 193, // 243: proto.SyncActionValue.labelEditAction:type_name -> proto.LabelEditAction + 194, // 244: proto.SyncActionValue.labelAssociationAction:type_name -> proto.LabelAssociationAction + 192, // 245: proto.SyncActionValue.localeSetting:type_name -> proto.LocaleSetting + 203, // 246: proto.SyncActionValue.archiveChatAction:type_name -> proto.ArchiveChatAction + 197, // 247: proto.SyncActionValue.deleteMessageForMeAction:type_name -> proto.DeleteMessageForMeAction + 195, // 248: proto.SyncActionValue.keyExpiration:type_name -> proto.KeyExpiration + 191, // 249: proto.SyncActionValue.markChatAsReadAction:type_name -> proto.MarkChatAsReadAction + 200, // 250: proto.SyncActionValue.clearChatAction:type_name -> proto.ClearChatAction + 198, // 251: proto.SyncActionValue.deleteChatAction:type_name -> proto.DeleteChatAction + 170, // 252: proto.SyncActionValue.unarchiveChatsSetting:type_name -> proto.UnarchiveChatsSetting + 184, // 253: proto.SyncActionValue.primaryFeature:type_name -> proto.PrimaryFeature + 204, // 254: proto.SyncActionValue.androidUnsupportedActions:type_name -> proto.AndroidUnsupportedActions + 205, // 255: proto.SyncActionValue.agentAction:type_name -> proto.AgentAction + 174, // 256: proto.SyncActionValue.subscriptionAction:type_name -> proto.SubscriptionAction + 169, // 257: proto.SyncActionValue.userStatusMuteAction:type_name -> proto.UserStatusMuteAction + 171, // 258: proto.SyncActionValue.timeFormatAction:type_name -> proto.TimeFormatAction + 187, // 259: proto.SyncActionValue.nuxAction:type_name -> proto.NuxAction + 183, // 260: proto.SyncActionValue.primaryVersionAction:type_name -> proto.PrimaryVersionAction + 175, // 261: proto.SyncActionValue.stickerAction:type_name -> proto.StickerAction + 178, // 262: proto.SyncActionValue.removeRecentStickerAction:type_name -> proto.RemoveRecentStickerAction + 202, // 263: proto.SyncActionValue.chatAssignment:type_name -> proto.ChatAssignmentAction + 201, // 264: proto.SyncActionValue.chatAssignmentOpenedStatus:type_name -> proto.ChatAssignmentOpenedStatusAction + 185, // 265: proto.SyncActionValue.pnForLidChatAction:type_name -> proto.PnForLidChatAction + 190, // 266: proto.SyncActionValue.marketingMessageAction:type_name -> proto.MarketingMessageAction + 189, // 267: proto.SyncActionValue.marketingMessageBroadcastAction:type_name -> proto.MarketingMessageBroadcastAction + 196, // 268: proto.SyncActionValue.externalWebBetaAction:type_name -> proto.ExternalWebBetaAction + 182, // 269: proto.SyncActionValue.privacySettingRelayAllCalls:type_name -> proto.PrivacySettingRelayAllCalls + 156, // 270: proto.SyncActionMessage.key:type_name -> proto.MessageKey + 172, // 271: proto.SyncActionMessageRange.messages:type_name -> proto.SyncActionMessage + 207, // 272: proto.RecentEmojiWeightsAction.weights:type_name -> proto.RecentEmojiWeight + 37, // 273: proto.MarketingMessageAction.type:type_name -> proto.MarketingMessageAction.MarketingMessagePrototypeType + 173, // 274: proto.MarkChatAsReadAction.messageRange:type_name -> proto.SyncActionMessageRange + 173, // 275: proto.DeleteChatAction.messageRange:type_name -> proto.SyncActionMessageRange + 173, // 276: proto.ClearChatAction.messageRange:type_name -> proto.SyncActionMessageRange + 173, // 277: proto.ArchiveChatAction.messageRange:type_name -> proto.SyncActionMessageRange + 168, // 278: proto.SyncActionData.value:type_name -> proto.SyncActionValue + 38, // 279: proto.BizIdentityInfo.vlevel:type_name -> proto.BizIdentityInfo.VerifiedLevelValue + 208, // 280: proto.BizIdentityInfo.vnameCert:type_name -> proto.VerifiedNameCertificate + 39, // 281: proto.BizIdentityInfo.hostStorage:type_name -> proto.BizIdentityInfo.HostStorageType + 40, // 282: proto.BizIdentityInfo.actualActors:type_name -> proto.BizIdentityInfo.ActualActorsType + 208, // 283: proto.BizAccountPayload.vnameCert:type_name -> proto.VerifiedNameCertificate + 41, // 284: proto.BizAccountLinkInfo.hostStorage:type_name -> proto.BizAccountLinkInfo.HostStorageType + 42, // 285: proto.BizAccountLinkInfo.accountType:type_name -> proto.BizAccountLinkInfo.AccountType + 215, // 286: proto.HandshakeMessage.clientHello:type_name -> proto.HandshakeClientHello + 214, // 287: proto.HandshakeMessage.serverHello:type_name -> proto.HandshakeServerHello + 216, // 288: proto.HandshakeMessage.clientFinish:type_name -> proto.HandshakeClientFinish + 286, // 289: proto.ClientPayload.userAgent:type_name -> proto.ClientPayload.UserAgent + 285, // 290: proto.ClientPayload.webInfo:type_name -> proto.ClientPayload.WebInfo + 45, // 291: proto.ClientPayload.connectType:type_name -> proto.ClientPayload.ConnectType + 46, // 292: proto.ClientPayload.connectReason:type_name -> proto.ClientPayload.ConnectReason + 289, // 293: proto.ClientPayload.dnsSource:type_name -> proto.ClientPayload.DNSSource + 288, // 294: proto.ClientPayload.devicePairingData:type_name -> proto.ClientPayload.DevicePairingRegistrationData + 43, // 295: proto.ClientPayload.product:type_name -> proto.ClientPayload.Product + 44, // 296: proto.ClientPayload.iosAppExtension:type_name -> proto.ClientPayload.IOSAppExtension + 287, // 297: proto.ClientPayload.interopData:type_name -> proto.ClientPayload.InteropData + 219, // 298: proto.WebNotificationsInfo.notifyMessages:type_name -> proto.WebMessageInfo + 156, // 299: proto.WebMessageInfo.key:type_name -> proto.MessageKey + 114, // 300: proto.WebMessageInfo.message:type_name -> proto.Message + 52, // 301: proto.WebMessageInfo.status:type_name -> proto.WebMessageInfo.Status + 51, // 302: proto.WebMessageInfo.messageStubType:type_name -> proto.WebMessageInfo.StubType + 228, // 303: proto.WebMessageInfo.paymentInfo:type_name -> proto.PaymentInfo + 68, // 304: proto.WebMessageInfo.finalLiveLocation:type_name -> proto.LiveLocationMessage + 228, // 305: proto.WebMessageInfo.quotedPaymentInfo:type_name -> proto.PaymentInfo + 53, // 306: proto.WebMessageInfo.bizPrivacyStatus:type_name -> proto.WebMessageInfo.BizPrivacyStatus + 230, // 307: proto.WebMessageInfo.mediaData:type_name -> proto.MediaData + 227, // 308: proto.WebMessageInfo.photoChange:type_name -> proto.PhotoChange + 221, // 309: proto.WebMessageInfo.userReceipt:type_name -> proto.UserReceipt + 223, // 310: proto.WebMessageInfo.reactions:type_name -> proto.Reaction + 230, // 311: proto.WebMessageInfo.quotedStickerData:type_name -> proto.MediaData + 222, // 312: proto.WebMessageInfo.statusPsa:type_name -> proto.StatusPSA + 224, // 313: proto.WebMessageInfo.pollUpdates:type_name -> proto.PollUpdate + 225, // 314: proto.WebMessageInfo.pollAdditionalMetadata:type_name -> proto.PollAdditionalMetadata + 231, // 315: proto.WebMessageInfo.keepInChat:type_name -> proto.KeepInChat + 226, // 316: proto.WebMessageInfo.pinInChat:type_name -> proto.PinInChat + 54, // 317: proto.WebFeatures.labelsDisplay:type_name -> proto.WebFeatures.Flag + 54, // 318: proto.WebFeatures.voipIndividualOutgoing:type_name -> proto.WebFeatures.Flag + 54, // 319: proto.WebFeatures.groupsV3:type_name -> proto.WebFeatures.Flag + 54, // 320: proto.WebFeatures.groupsV3Create:type_name -> proto.WebFeatures.Flag + 54, // 321: proto.WebFeatures.changeNumberV2:type_name -> proto.WebFeatures.Flag + 54, // 322: proto.WebFeatures.queryStatusV3Thumbnail:type_name -> proto.WebFeatures.Flag + 54, // 323: proto.WebFeatures.liveLocations:type_name -> proto.WebFeatures.Flag + 54, // 324: proto.WebFeatures.queryVname:type_name -> proto.WebFeatures.Flag + 54, // 325: proto.WebFeatures.voipIndividualIncoming:type_name -> proto.WebFeatures.Flag + 54, // 326: proto.WebFeatures.quickRepliesQuery:type_name -> proto.WebFeatures.Flag + 54, // 327: proto.WebFeatures.payments:type_name -> proto.WebFeatures.Flag + 54, // 328: proto.WebFeatures.stickerPackQuery:type_name -> proto.WebFeatures.Flag + 54, // 329: proto.WebFeatures.liveLocationsFinal:type_name -> proto.WebFeatures.Flag + 54, // 330: proto.WebFeatures.labelsEdit:type_name -> proto.WebFeatures.Flag + 54, // 331: proto.WebFeatures.mediaUpload:type_name -> proto.WebFeatures.Flag + 54, // 332: proto.WebFeatures.mediaUploadRichQuickReplies:type_name -> proto.WebFeatures.Flag + 54, // 333: proto.WebFeatures.vnameV2:type_name -> proto.WebFeatures.Flag + 54, // 334: proto.WebFeatures.videoPlaybackUrl:type_name -> proto.WebFeatures.Flag + 54, // 335: proto.WebFeatures.statusRanking:type_name -> proto.WebFeatures.Flag + 54, // 336: proto.WebFeatures.voipIndividualVideo:type_name -> proto.WebFeatures.Flag + 54, // 337: proto.WebFeatures.thirdPartyStickers:type_name -> proto.WebFeatures.Flag + 54, // 338: proto.WebFeatures.frequentlyForwardedSetting:type_name -> proto.WebFeatures.Flag + 54, // 339: proto.WebFeatures.groupsV4JoinPermission:type_name -> proto.WebFeatures.Flag + 54, // 340: proto.WebFeatures.recentStickers:type_name -> proto.WebFeatures.Flag + 54, // 341: proto.WebFeatures.catalog:type_name -> proto.WebFeatures.Flag + 54, // 342: proto.WebFeatures.starredStickers:type_name -> proto.WebFeatures.Flag + 54, // 343: proto.WebFeatures.voipGroupCall:type_name -> proto.WebFeatures.Flag + 54, // 344: proto.WebFeatures.templateMessage:type_name -> proto.WebFeatures.Flag + 54, // 345: proto.WebFeatures.templateMessageInteractivity:type_name -> proto.WebFeatures.Flag + 54, // 346: proto.WebFeatures.ephemeralMessages:type_name -> proto.WebFeatures.Flag + 54, // 347: proto.WebFeatures.e2ENotificationSync:type_name -> proto.WebFeatures.Flag + 54, // 348: proto.WebFeatures.recentStickersV2:type_name -> proto.WebFeatures.Flag + 54, // 349: proto.WebFeatures.recentStickersV3:type_name -> proto.WebFeatures.Flag + 54, // 350: proto.WebFeatures.userNotice:type_name -> proto.WebFeatures.Flag + 54, // 351: proto.WebFeatures.support:type_name -> proto.WebFeatures.Flag + 54, // 352: proto.WebFeatures.groupUiiCleanup:type_name -> proto.WebFeatures.Flag + 54, // 353: proto.WebFeatures.groupDogfoodingInternalOnly:type_name -> proto.WebFeatures.Flag + 54, // 354: proto.WebFeatures.settingsSync:type_name -> proto.WebFeatures.Flag + 54, // 355: proto.WebFeatures.archiveV2:type_name -> proto.WebFeatures.Flag + 54, // 356: proto.WebFeatures.ephemeralAllowGroupMembers:type_name -> proto.WebFeatures.Flag + 54, // 357: proto.WebFeatures.ephemeral24HDuration:type_name -> proto.WebFeatures.Flag + 54, // 358: proto.WebFeatures.mdForceUpgrade:type_name -> proto.WebFeatures.Flag + 54, // 359: proto.WebFeatures.disappearingMode:type_name -> proto.WebFeatures.Flag + 54, // 360: proto.WebFeatures.externalMdOptInAvailable:type_name -> proto.WebFeatures.Flag + 54, // 361: proto.WebFeatures.noDeleteMessageTimeLimit:type_name -> proto.WebFeatures.Flag + 156, // 362: proto.Reaction.key:type_name -> proto.MessageKey + 156, // 363: proto.PollUpdate.pollUpdateMessageKey:type_name -> proto.MessageKey + 130, // 364: proto.PollUpdate.vote:type_name -> proto.PollVoteMessage + 55, // 365: proto.PinInChat.pinMessageType:type_name -> proto.PinInChat.PinMessageType + 156, // 366: proto.PinInChat.key:type_name -> proto.MessageKey + 58, // 367: proto.PaymentInfo.currencyDeprecated:type_name -> proto.PaymentInfo.Currency + 57, // 368: proto.PaymentInfo.status:type_name -> proto.PaymentInfo.Status + 156, // 369: proto.PaymentInfo.requestMessageKey:type_name -> proto.MessageKey + 56, // 370: proto.PaymentInfo.txnStatus:type_name -> proto.PaymentInfo.TxnStatus + 113, // 371: proto.PaymentInfo.primaryAmount:type_name -> proto.Money + 113, // 372: proto.PaymentInfo.exchangeAmount:type_name -> proto.Money + 156, // 373: proto.NotificationMessageInfo.key:type_name -> proto.MessageKey + 114, // 374: proto.NotificationMessageInfo.message:type_name -> proto.Message + 0, // 375: proto.KeepInChat.keepType:type_name -> proto.KeepType + 156, // 376: proto.KeepInChat.key:type_name -> proto.MessageKey + 293, // 377: proto.CertChain.leaf:type_name -> proto.CertChain.NoiseCertificate + 293, // 378: proto.CertChain.intermediate:type_name -> proto.CertChain.NoiseCertificate + 238, // 379: proto.ListMessage.Section.rows:type_name -> proto.ListMessage.Row + 239, // 380: proto.ListMessage.ProductSection.products:type_name -> proto.ListMessage.Product + 240, // 381: proto.ListMessage.ProductListInfo.productSections:type_name -> proto.ListMessage.ProductSection + 242, // 382: proto.ListMessage.ProductListInfo.headerImage:type_name -> proto.ListMessage.ProductListHeaderImage + 10, // 383: proto.InteractiveResponseMessage.Body.format:type_name -> proto.InteractiveResponseMessage.Body.Format + 11, // 384: proto.InteractiveMessage.ShopMessage.surface:type_name -> proto.InteractiveMessage.ShopMessage.Surface + 251, // 385: proto.InteractiveMessage.NativeFlowMessage.buttons:type_name -> proto.InteractiveMessage.NativeFlowMessage.NativeFlowButton + 83, // 386: proto.InteractiveMessage.Header.documentMessage:type_name -> proto.DocumentMessage + 76, // 387: proto.InteractiveMessage.Header.imageMessage:type_name -> proto.ImageMessage + 116, // 388: proto.InteractiveMessage.Header.videoMessage:type_name -> proto.VideoMessage + 254, // 389: proto.HighlyStructuredMessage.HSMLocalizableParameter.currency:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + 253, // 390: proto.HighlyStructuredMessage.HSMLocalizableParameter.dateTime:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + 256, // 391: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.component:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + 255, // 392: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.unixEpoch:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + 13, // 393: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.dayOfWeek:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + 14, // 394: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.calendar:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + 259, // 395: proto.ButtonsMessage.Button.buttonText:type_name -> proto.ButtonsMessage.Button.ButtonText + 21, // 396: proto.ButtonsMessage.Button.type:type_name -> proto.ButtonsMessage.Button.Type + 258, // 397: proto.ButtonsMessage.Button.nativeFlowInfo:type_name -> proto.ButtonsMessage.Button.NativeFlowInfo + 23, // 398: proto.ContextInfo.ExternalAdReplyInfo.mediaType:type_name -> proto.ContextInfo.ExternalAdReplyInfo.MediaType + 24, // 399: proto.ContextInfo.AdReplyInfo.mediaType:type_name -> proto.ContextInfo.AdReplyInfo.MediaType + 78, // 400: proto.TemplateButton.URLButton.displayText:type_name -> proto.HighlyStructuredMessage + 78, // 401: proto.TemplateButton.URLButton.url:type_name -> proto.HighlyStructuredMessage + 78, // 402: proto.TemplateButton.QuickReplyButton.displayText:type_name -> proto.HighlyStructuredMessage + 78, // 403: proto.TemplateButton.CallButton.displayText:type_name -> proto.HighlyStructuredMessage + 78, // 404: proto.TemplateButton.CallButton.phoneNumber:type_name -> proto.HighlyStructuredMessage + 104, // 405: proto.TemplateMessage.HydratedFourRowTemplate.hydratedButtons:type_name -> proto.HydratedTemplateButton + 83, // 406: proto.TemplateMessage.HydratedFourRowTemplate.documentMessage:type_name -> proto.DocumentMessage + 76, // 407: proto.TemplateMessage.HydratedFourRowTemplate.imageMessage:type_name -> proto.ImageMessage + 116, // 408: proto.TemplateMessage.HydratedFourRowTemplate.videoMessage:type_name -> proto.VideoMessage + 67, // 409: proto.TemplateMessage.HydratedFourRowTemplate.locationMessage:type_name -> proto.LocationMessage + 78, // 410: proto.TemplateMessage.FourRowTemplate.content:type_name -> proto.HighlyStructuredMessage + 78, // 411: proto.TemplateMessage.FourRowTemplate.footer:type_name -> proto.HighlyStructuredMessage + 110, // 412: proto.TemplateMessage.FourRowTemplate.buttons:type_name -> proto.TemplateButton + 83, // 413: proto.TemplateMessage.FourRowTemplate.documentMessage:type_name -> proto.DocumentMessage + 78, // 414: proto.TemplateMessage.FourRowTemplate.highlyStructuredMessage:type_name -> proto.HighlyStructuredMessage + 76, // 415: proto.TemplateMessage.FourRowTemplate.imageMessage:type_name -> proto.ImageMessage + 116, // 416: proto.TemplateMessage.FourRowTemplate.videoMessage:type_name -> proto.VideoMessage + 67, // 417: proto.TemplateMessage.FourRowTemplate.locationMessage:type_name -> proto.LocationMessage + 76, // 418: proto.ProductMessage.ProductSnapshot.productImage:type_name -> proto.ImageMessage + 76, // 419: proto.ProductMessage.CatalogSnapshot.catalogImage:type_name -> proto.ImageMessage + 35, // 420: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.mediaUploadResult:type_name -> proto.MediaRetryNotification.ResultType + 120, // 421: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.stickerMessage:type_name -> proto.StickerMessage + 277, // 422: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.linkPreviewResponse:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + 276, // 423: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.placeholderMessageResendResponse:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.PlaceholderMessageResendResponse + 278, // 424: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.hqThumbnail:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.LinkPreviewHighQualityThumbnail + 156, // 425: proto.PeerDataOperationRequestMessage.PlaceholderMessageResendRequest.messageKey:type_name -> proto.MessageKey + 209, // 426: proto.VerifiedNameCertificate.Details.localizedNames:type_name -> proto.LocalizedName + 290, // 427: proto.ClientPayload.WebInfo.webdPayload:type_name -> proto.ClientPayload.WebInfo.WebdPayload + 47, // 428: proto.ClientPayload.WebInfo.webSubPlatform:type_name -> proto.ClientPayload.WebInfo.WebSubPlatform + 49, // 429: proto.ClientPayload.UserAgent.platform:type_name -> proto.ClientPayload.UserAgent.Platform + 291, // 430: proto.ClientPayload.UserAgent.appVersion:type_name -> proto.ClientPayload.UserAgent.AppVersion + 48, // 431: proto.ClientPayload.UserAgent.releaseChannel:type_name -> proto.ClientPayload.UserAgent.ReleaseChannel + 50, // 432: proto.ClientPayload.DNSSource.dnsMethod:type_name -> proto.ClientPayload.DNSSource.DNSResolutionMethod + 433, // [433:433] is the sub-list for method output_type + 433, // [433:433] is the sub-list for method input_type + 433, // [433:433] is the sub-list for extension type_name + 433, // [433:433] is the sub-list for extension extendee + 0, // [0:433] is the sub-list for field type_name } func init() { file_binary_proto_def_proto_init() } @@ -23462,18 +24732,6 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerDataOperationRequestMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_binary_proto_def_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PaymentInviteMessage); i { case 0: return &v.state @@ -23485,7 +24743,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OrderMessage); i { case 0: return &v.state @@ -23497,7 +24755,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocationMessage); i { case 0: return &v.state @@ -23509,7 +24767,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LiveLocationMessage); i { case 0: return &v.state @@ -23521,7 +24779,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListResponseMessage); i { case 0: return &v.state @@ -23533,7 +24791,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListMessage); i { case 0: return &v.state @@ -23545,7 +24803,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KeepInChatMessage); i { case 0: return &v.state @@ -23557,7 +24815,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InvoiceMessage); i { case 0: return &v.state @@ -23569,7 +24827,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InteractiveResponseMessage); i { case 0: return &v.state @@ -23581,7 +24839,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InteractiveMessage); i { case 0: return &v.state @@ -23593,7 +24851,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InitialSecurityNotificationSettingSync); i { case 0: return &v.state @@ -23605,7 +24863,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ImageMessage); i { case 0: return &v.state @@ -23617,7 +24875,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HistorySyncNotification); i { case 0: return &v.state @@ -23629,7 +24887,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HighlyStructuredMessage); i { case 0: return &v.state @@ -23641,7 +24899,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GroupInviteMessage); i { case 0: return &v.state @@ -23653,7 +24911,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FutureProofMessage); i { case 0: return &v.state @@ -23665,7 +24923,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExtendedTextMessage); i { case 0: return &v.state @@ -23677,7 +24935,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EncReactionMessage); i { case 0: return &v.state @@ -23689,7 +24947,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DocumentMessage); i { case 0: return &v.state @@ -23701,7 +24959,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceSentMessage); i { case 0: return &v.state @@ -23713,7 +24971,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeclinePaymentRequestMessage); i { case 0: return &v.state @@ -23725,7 +24983,7 @@ func file_binary_proto_def_proto_init() { return nil } } - file_binary_proto_def_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_binary_proto_def_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ContactsArrayMessage); i { case 0: return &v.state @@ -23737,6 +24995,18 @@ func file_binary_proto_def_proto_init() { return nil } } + file_binary_proto_def_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContactMessageV2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } file_binary_proto_def_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ContactMessage); i { case 0: @@ -24326,7 +25596,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[78].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EphemeralSetting); i { + switch v := v.(*PeerDataOperationRequestMessage); i { case 0: return &v.state case 1: @@ -24338,7 +25608,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[79].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallpaperSettings); i { + switch v := v.(*EphemeralSetting); i { case 0: return &v.state case 1: @@ -24350,7 +25620,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[80].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StickerMetadata); i { + switch v := v.(*WallpaperSettings); i { case 0: return &v.state case 1: @@ -24362,7 +25632,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[81].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Pushname); i { + switch v := v.(*StickerMetadata); i { case 0: return &v.state case 1: @@ -24374,7 +25644,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[82].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PastParticipants); i { + switch v := v.(*Pushname); i { case 0: return &v.state case 1: @@ -24386,7 +25656,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[83].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PastParticipant); i { + switch v := v.(*PastParticipants); i { case 0: return &v.state case 1: @@ -24398,7 +25668,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[84].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HistorySync); i { + switch v := v.(*PastParticipant); i { case 0: return &v.state case 1: @@ -24410,7 +25680,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[85].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HistorySyncMsg); i { + switch v := v.(*NotificationSettings); i { case 0: return &v.state case 1: @@ -24422,7 +25692,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[86].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupParticipant); i { + switch v := v.(*HistorySync); i { case 0: return &v.state case 1: @@ -24434,7 +25704,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[87].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GlobalSettings); i { + switch v := v.(*HistorySyncMsg); i { case 0: return &v.state case 1: @@ -24446,7 +25716,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[88].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Conversation); i { + switch v := v.(*GroupParticipant); i { case 0: return &v.state case 1: @@ -24458,7 +25728,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[89].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AvatarUserSettings); i { + switch v := v.(*GlobalSettings); i { case 0: return &v.state case 1: @@ -24470,7 +25740,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[90].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AutoDownloadSettings); i { + switch v := v.(*Conversation); i { case 0: return &v.state case 1: @@ -24482,7 +25752,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[91].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgRowOpaqueData); i { + switch v := v.(*AvatarUserSettings); i { case 0: return &v.state case 1: @@ -24494,7 +25764,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[92].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgOpaqueData); i { + switch v := v.(*AutoDownloadSettings); i { case 0: return &v.state case 1: @@ -24506,7 +25776,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[93].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerErrorReceipt); i { + switch v := v.(*MsgRowOpaqueData); i { case 0: return &v.state case 1: @@ -24518,7 +25788,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[94].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaRetryNotification); i { + switch v := v.(*MsgOpaqueData); i { case 0: return &v.state case 1: @@ -24530,7 +25800,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[95].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageKey); i { + switch v := v.(*ServerErrorReceipt); i { case 0: return &v.state case 1: @@ -24542,7 +25812,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[96].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdVersion); i { + switch v := v.(*MediaRetryNotification); i { case 0: return &v.state case 1: @@ -24554,7 +25824,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[97].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdValue); i { + switch v := v.(*MessageKey); i { case 0: return &v.state case 1: @@ -24566,7 +25836,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[98].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdSnapshot); i { + switch v := v.(*SyncdVersion); i { case 0: return &v.state case 1: @@ -24578,7 +25848,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[99].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdRecord); i { + switch v := v.(*SyncdValue); i { case 0: return &v.state case 1: @@ -24590,7 +25860,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[100].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdPatch); i { + switch v := v.(*SyncdSnapshot); i { case 0: return &v.state case 1: @@ -24602,7 +25872,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[101].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdMutations); i { + switch v := v.(*SyncdRecord); i { case 0: return &v.state case 1: @@ -24614,7 +25884,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[102].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdMutation); i { + switch v := v.(*SyncdPatch); i { case 0: return &v.state case 1: @@ -24626,7 +25896,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[103].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncdIndex); i { + switch v := v.(*SyncdMutations); i { case 0: return &v.state case 1: @@ -24638,7 +25908,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[104].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyId); i { + switch v := v.(*SyncdMutation); i { case 0: return &v.state case 1: @@ -24650,7 +25920,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[105].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalBlobReference); i { + switch v := v.(*SyncdIndex); i { case 0: return &v.state case 1: @@ -24662,7 +25932,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[106].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExitCode); i { + switch v := v.(*KeyId); i { case 0: return &v.state case 1: @@ -24674,7 +25944,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[107].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionValue); i { + switch v := v.(*ExternalBlobReference); i { case 0: return &v.state case 1: @@ -24686,7 +25956,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[108].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserStatusMuteAction); i { + switch v := v.(*ExitCode); i { case 0: return &v.state case 1: @@ -24698,7 +25968,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[109].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnarchiveChatsSetting); i { + switch v := v.(*SyncActionValue); i { case 0: return &v.state case 1: @@ -24710,7 +25980,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[110].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TimeFormatAction); i { + switch v := v.(*UserStatusMuteAction); i { case 0: return &v.state case 1: @@ -24722,7 +25992,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[111].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionMessage); i { + switch v := v.(*UnarchiveChatsSetting); i { case 0: return &v.state case 1: @@ -24734,7 +26004,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[112].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionMessageRange); i { + switch v := v.(*TimeFormatAction); i { case 0: return &v.state case 1: @@ -24746,7 +26016,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[113].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionAction); i { + switch v := v.(*SyncActionMessage); i { case 0: return &v.state case 1: @@ -24758,7 +26028,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[114].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StickerAction); i { + switch v := v.(*SyncActionMessageRange); i { case 0: return &v.state case 1: @@ -24770,7 +26040,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[115].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StarAction); i { + switch v := v.(*SubscriptionAction); i { case 0: return &v.state case 1: @@ -24782,7 +26052,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[116].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityNotificationSetting); i { + switch v := v.(*StickerAction); i { case 0: return &v.state case 1: @@ -24794,7 +26064,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[117].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveRecentStickerAction); i { + switch v := v.(*StarAction); i { case 0: return &v.state case 1: @@ -24806,7 +26076,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[118].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RecentEmojiWeightsAction); i { + switch v := v.(*SecurityNotificationSetting); i { case 0: return &v.state case 1: @@ -24818,7 +26088,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[119].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuickReplyAction); i { + switch v := v.(*RemoveRecentStickerAction); i { case 0: return &v.state case 1: @@ -24830,7 +26100,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[120].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PushNameSetting); i { + switch v := v.(*RecentEmojiWeightsAction); i { case 0: return &v.state case 1: @@ -24842,7 +26112,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[121].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrimaryVersionAction); i { + switch v := v.(*QuickReplyAction); i { case 0: return &v.state case 1: @@ -24854,7 +26124,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[122].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrimaryFeature); i { + switch v := v.(*PushNameSetting); i { case 0: return &v.state case 1: @@ -24866,7 +26136,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[123].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PnForLidChatAction); i { + switch v := v.(*PrivacySettingRelayAllCalls); i { case 0: return &v.state case 1: @@ -24878,7 +26148,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[124].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PinAction); i { + switch v := v.(*PrimaryVersionAction); i { case 0: return &v.state case 1: @@ -24890,7 +26160,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[125].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NuxAction); i { + switch v := v.(*PrimaryFeature); i { case 0: return &v.state case 1: @@ -24902,7 +26172,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[126].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MuteAction); i { + switch v := v.(*PnForLidChatAction); i { case 0: return &v.state case 1: @@ -24914,7 +26184,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[127].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarkChatAsReadAction); i { + switch v := v.(*PinAction); i { case 0: return &v.state case 1: @@ -24926,7 +26196,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[128].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocaleSetting); i { + switch v := v.(*NuxAction); i { case 0: return &v.state case 1: @@ -24938,7 +26208,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[129].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelEditAction); i { + switch v := v.(*MuteAction); i { case 0: return &v.state case 1: @@ -24950,7 +26220,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[130].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelAssociationAction); i { + switch v := v.(*MarketingMessageBroadcastAction); i { case 0: return &v.state case 1: @@ -24962,7 +26232,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[131].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyExpiration); i { + switch v := v.(*MarketingMessageAction); i { case 0: return &v.state case 1: @@ -24974,7 +26244,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[132].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteMessageForMeAction); i { + switch v := v.(*MarkChatAsReadAction); i { case 0: return &v.state case 1: @@ -24986,7 +26256,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[133].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteChatAction); i { + switch v := v.(*LocaleSetting); i { case 0: return &v.state case 1: @@ -24998,7 +26268,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[134].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactAction); i { + switch v := v.(*LabelEditAction); i { case 0: return &v.state case 1: @@ -25010,7 +26280,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[135].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearChatAction); i { + switch v := v.(*LabelAssociationAction); i { case 0: return &v.state case 1: @@ -25022,7 +26292,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[136].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatAssignmentOpenedStatusAction); i { + switch v := v.(*KeyExpiration); i { case 0: return &v.state case 1: @@ -25034,7 +26304,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[137].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatAssignmentAction); i { + switch v := v.(*ExternalWebBetaAction); i { case 0: return &v.state case 1: @@ -25046,7 +26316,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[138].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ArchiveChatAction); i { + switch v := v.(*DeleteMessageForMeAction); i { case 0: return &v.state case 1: @@ -25058,7 +26328,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[139].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AndroidUnsupportedActions); i { + switch v := v.(*DeleteChatAction); i { case 0: return &v.state case 1: @@ -25070,7 +26340,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[140].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AgentAction); i { + switch v := v.(*ContactAction); i { case 0: return &v.state case 1: @@ -25082,7 +26352,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[141].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncActionData); i { + switch v := v.(*ClearChatAction); i { case 0: return &v.state case 1: @@ -25094,7 +26364,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[142].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RecentEmojiWeight); i { + switch v := v.(*ChatAssignmentOpenedStatusAction); i { case 0: return &v.state case 1: @@ -25106,7 +26376,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[143].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VerifiedNameCertificate); i { + switch v := v.(*ChatAssignmentAction); i { case 0: return &v.state case 1: @@ -25118,7 +26388,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[144].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocalizedName); i { + switch v := v.(*ArchiveChatAction); i { case 0: return &v.state case 1: @@ -25130,7 +26400,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[145].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BizIdentityInfo); i { + switch v := v.(*AndroidUnsupportedActions); i { case 0: return &v.state case 1: @@ -25142,7 +26412,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[146].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BizAccountPayload); i { + switch v := v.(*AgentAction); i { case 0: return &v.state case 1: @@ -25154,7 +26424,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[147].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BizAccountLinkInfo); i { + switch v := v.(*SyncActionData); i { case 0: return &v.state case 1: @@ -25166,7 +26436,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[148].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HandshakeMessage); i { + switch v := v.(*RecentEmojiWeight); i { case 0: return &v.state case 1: @@ -25178,7 +26448,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[149].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HandshakeServerHello); i { + switch v := v.(*VerifiedNameCertificate); i { case 0: return &v.state case 1: @@ -25190,7 +26460,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[150].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HandshakeClientHello); i { + switch v := v.(*LocalizedName); i { case 0: return &v.state case 1: @@ -25202,7 +26472,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[151].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HandshakeClientFinish); i { + switch v := v.(*BizIdentityInfo); i { case 0: return &v.state case 1: @@ -25214,7 +26484,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[152].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload); i { + switch v := v.(*BizAccountPayload); i { case 0: return &v.state case 1: @@ -25226,7 +26496,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[153].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebNotificationsInfo); i { + switch v := v.(*BizAccountLinkInfo); i { case 0: return &v.state case 1: @@ -25238,7 +26508,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[154].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebMessageInfo); i { + switch v := v.(*HandshakeMessage); i { case 0: return &v.state case 1: @@ -25250,7 +26520,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[155].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebFeatures); i { + switch v := v.(*HandshakeServerHello); i { case 0: return &v.state case 1: @@ -25262,7 +26532,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[156].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserReceipt); i { + switch v := v.(*HandshakeClientHello); i { case 0: return &v.state case 1: @@ -25274,7 +26544,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[157].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusPSA); i { + switch v := v.(*HandshakeClientFinish); i { case 0: return &v.state case 1: @@ -25286,7 +26556,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[158].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Reaction); i { + switch v := v.(*ClientPayload); i { case 0: return &v.state case 1: @@ -25298,7 +26568,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[159].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollUpdate); i { + switch v := v.(*WebNotificationsInfo); i { case 0: return &v.state case 1: @@ -25310,7 +26580,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[160].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollAdditionalMetadata); i { + switch v := v.(*WebMessageInfo); i { case 0: return &v.state case 1: @@ -25322,7 +26592,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[161].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhotoChange); i { + switch v := v.(*WebFeatures); i { case 0: return &v.state case 1: @@ -25334,7 +26604,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[162].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PaymentInfo); i { + switch v := v.(*UserReceipt); i { case 0: return &v.state case 1: @@ -25346,7 +26616,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[163].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NotificationMessageInfo); i { + switch v := v.(*StatusPSA); i { case 0: return &v.state case 1: @@ -25358,7 +26628,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[164].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaData); i { + switch v := v.(*Reaction); i { case 0: return &v.state case 1: @@ -25370,7 +26640,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[165].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeepInChat); i { + switch v := v.(*PollUpdate); i { case 0: return &v.state case 1: @@ -25382,7 +26652,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[166].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NoiseCertificate); i { + switch v := v.(*PollAdditionalMetadata); i { case 0: return &v.state case 1: @@ -25394,7 +26664,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[167].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CertChain); i { + switch v := v.(*PinInChat); i { case 0: return &v.state case 1: @@ -25406,7 +26676,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[168].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeviceProps_HistorySyncConfig); i { + switch v := v.(*PhotoChange); i { case 0: return &v.state case 1: @@ -25418,7 +26688,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[169].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeviceProps_AppVersion); i { + switch v := v.(*PaymentInfo); i { case 0: return &v.state case 1: @@ -25430,7 +26700,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[170].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerDataOperationRequestMessage_RequestUrlPreview); i { + switch v := v.(*NotificationMessageInfo); i { case 0: return &v.state case 1: @@ -25442,7 +26712,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[171].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerDataOperationRequestMessage_RequestStickerReupload); i { + switch v := v.(*MediaData); i { case 0: return &v.state case 1: @@ -25454,7 +26724,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[172].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResponseMessage_SingleSelectReply); i { + switch v := v.(*KeepInChat); i { case 0: return &v.state case 1: @@ -25466,7 +26736,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[173].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMessage_Section); i { + switch v := v.(*NoiseCertificate); i { case 0: return &v.state case 1: @@ -25478,7 +26748,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[174].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMessage_Row); i { + switch v := v.(*CertChain); i { case 0: return &v.state case 1: @@ -25490,7 +26760,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[175].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMessage_Product); i { + switch v := v.(*DeviceProps_HistorySyncConfig); i { case 0: return &v.state case 1: @@ -25502,7 +26772,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[176].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMessage_ProductSection); i { + switch v := v.(*DeviceProps_AppVersion); i { case 0: return &v.state case 1: @@ -25514,7 +26784,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[177].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMessage_ProductListInfo); i { + switch v := v.(*ListResponseMessage_SingleSelectReply); i { case 0: return &v.state case 1: @@ -25526,7 +26796,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[178].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMessage_ProductListHeaderImage); i { + switch v := v.(*ListMessage_Section); i { case 0: return &v.state case 1: @@ -25538,7 +26808,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[179].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveResponseMessage_NativeFlowResponseMessage); i { + switch v := v.(*ListMessage_Row); i { case 0: return &v.state case 1: @@ -25550,7 +26820,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[180].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveResponseMessage_Body); i { + switch v := v.(*ListMessage_Product); i { case 0: return &v.state case 1: @@ -25562,7 +26832,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[181].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_ShopMessage); i { + switch v := v.(*ListMessage_ProductSection); i { case 0: return &v.state case 1: @@ -25574,7 +26844,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[182].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_NativeFlowMessage); i { + switch v := v.(*ListMessage_ProductListInfo); i { case 0: return &v.state case 1: @@ -25586,7 +26856,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[183].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_Header); i { + switch v := v.(*ListMessage_ProductListHeaderImage); i { case 0: return &v.state case 1: @@ -25598,7 +26868,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[184].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_Footer); i { + switch v := v.(*InteractiveResponseMessage_NativeFlowResponseMessage); i { case 0: return &v.state case 1: @@ -25610,7 +26880,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[185].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_CollectionMessage); i { + switch v := v.(*InteractiveResponseMessage_Body); i { case 0: return &v.state case 1: @@ -25622,7 +26892,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[186].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_Body); i { + switch v := v.(*InteractiveMessage_ShopMessage); i { case 0: return &v.state case 1: @@ -25634,7 +26904,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[187].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InteractiveMessage_NativeFlowMessage_NativeFlowButton); i { + switch v := v.(*InteractiveMessage_NativeFlowMessage); i { case 0: return &v.state case 1: @@ -25646,7 +26916,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[188].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter); i { + switch v := v.(*InteractiveMessage_Header); i { case 0: return &v.state case 1: @@ -25658,7 +26928,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[189].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime); i { + switch v := v.(*InteractiveMessage_Footer); i { case 0: return &v.state case 1: @@ -25670,7 +26940,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[190].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency); i { + switch v := v.(*InteractiveMessage_CollectionMessage); i { case 0: return &v.state case 1: @@ -25682,7 +26952,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[191].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch); i { + switch v := v.(*InteractiveMessage_Body); i { case 0: return &v.state case 1: @@ -25694,7 +26964,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[192].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent); i { + switch v := v.(*InteractiveMessage_NativeFlowMessage_NativeFlowButton); i { case 0: return &v.state case 1: @@ -25706,7 +26976,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[193].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonsMessage_Button); i { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter); i { case 0: return &v.state case 1: @@ -25718,7 +26988,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[194].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonsMessage_Button_NativeFlowInfo); i { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime); i { case 0: return &v.state case 1: @@ -25730,7 +27000,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[195].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonsMessage_Button_ButtonText); i { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency); i { case 0: return &v.state case 1: @@ -25742,7 +27012,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[196].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton_HydratedURLButton); i { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch); i { case 0: return &v.state case 1: @@ -25754,7 +27024,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[197].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton_HydratedQuickReplyButton); i { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent); i { case 0: return &v.state case 1: @@ -25766,7 +27036,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[198].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HydratedTemplateButton_HydratedCallButton); i { + switch v := v.(*ButtonsMessage_Button); i { case 0: return &v.state case 1: @@ -25778,7 +27048,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[199].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_UTMInfo); i { + switch v := v.(*ButtonsMessage_Button_NativeFlowInfo); i { case 0: return &v.state case 1: @@ -25790,7 +27060,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[200].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_ExternalAdReplyInfo); i { + switch v := v.(*ButtonsMessage_Button_ButtonText); i { case 0: return &v.state case 1: @@ -25802,7 +27072,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[201].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextInfo_AdReplyInfo); i { + switch v := v.(*HydratedTemplateButton_HydratedURLButton); i { case 0: return &v.state case 1: @@ -25814,7 +27084,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[202].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateButton_URLButton); i { + switch v := v.(*HydratedTemplateButton_HydratedQuickReplyButton); i { case 0: return &v.state case 1: @@ -25826,7 +27096,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[203].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateButton_QuickReplyButton); i { + switch v := v.(*HydratedTemplateButton_HydratedCallButton); i { case 0: return &v.state case 1: @@ -25838,7 +27108,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[204].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateButton_CallButton); i { + switch v := v.(*ContextInfo_UTMInfo); i { case 0: return &v.state case 1: @@ -25850,7 +27120,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[205].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PaymentBackground_MediaData); i { + switch v := v.(*ContextInfo_ExternalAdReplyInfo); i { case 0: return &v.state case 1: @@ -25862,7 +27132,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[206].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateMessage_HydratedFourRowTemplate); i { + switch v := v.(*ContextInfo_AdReplyInfo); i { case 0: return &v.state case 1: @@ -25874,7 +27144,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[207].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TemplateMessage_FourRowTemplate); i { + switch v := v.(*TemplateButton_URLButton); i { case 0: return &v.state case 1: @@ -25886,7 +27156,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[208].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProductMessage_ProductSnapshot); i { + switch v := v.(*TemplateButton_QuickReplyButton); i { case 0: return &v.state case 1: @@ -25898,7 +27168,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[209].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProductMessage_CatalogSnapshot); i { + switch v := v.(*TemplateButton_CallButton); i { case 0: return &v.state case 1: @@ -25910,7 +27180,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[210].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollCreationMessage_Option); i { + switch v := v.(*PaymentBackground_MediaData); i { case 0: return &v.state case 1: @@ -25922,7 +27192,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[211].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult); i { + switch v := v.(*TemplateMessage_HydratedFourRowTemplate); i { case 0: return &v.state case 1: @@ -25934,7 +27204,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[212].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse); i { + switch v := v.(*TemplateMessage_FourRowTemplate); i { case 0: return &v.state case 1: @@ -25946,7 +27216,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[213].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgOpaqueData_PollOption); i { + switch v := v.(*ProductMessage_ProductSnapshot); i { case 0: return &v.state case 1: @@ -25958,7 +27228,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[214].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VerifiedNameCertificate_Details); i { + switch v := v.(*ProductMessage_CatalogSnapshot); i { case 0: return &v.state case 1: @@ -25970,7 +27240,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[215].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload_WebInfo); i { + switch v := v.(*PollCreationMessage_Option); i { case 0: return &v.state case 1: @@ -25982,7 +27252,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[216].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload_UserAgent); i { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult); i { case 0: return &v.state case 1: @@ -25994,7 +27264,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[217].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload_DevicePairingRegistrationData); i { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_PlaceholderMessageResendResponse); i { case 0: return &v.state case 1: @@ -26006,7 +27276,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[218].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload_DNSSource); i { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse); i { case 0: return &v.state case 1: @@ -26018,7 +27288,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[219].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload_WebInfo_WebdPayload); i { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse_LinkPreviewHighQualityThumbnail); i { case 0: return &v.state case 1: @@ -26030,7 +27300,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[220].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPayload_UserAgent_AppVersion); i { + switch v := v.(*PeerDataOperationRequestMessage_RequestStickerReupload); i { case 0: return &v.state case 1: @@ -26042,7 +27312,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[221].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NoiseCertificate_Details); i { + switch v := v.(*PeerDataOperationRequestMessage_PlaceholderMessageResendRequest); i { case 0: return &v.state case 1: @@ -26054,7 +27324,7 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[222].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CertChain_NoiseCertificate); i { + switch v := v.(*PeerDataOperationRequestMessage_HistorySyncOnDemandRequest); i { case 0: return &v.state case 1: @@ -26066,6 +27336,150 @@ func file_binary_proto_def_proto_init() { } } file_binary_proto_def_proto_msgTypes[223].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestMessage_RequestUrlPreview); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[224].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgOpaqueData_PollOption); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[225].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifiedNameCertificate_Details); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[226].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_WebInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[227].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_UserAgent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[228].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_InteropData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[229].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_DevicePairingRegistrationData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[230].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_DNSSource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[231].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_WebInfo_WebdPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[232].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_UserAgent_AppVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[233].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NoiseCertificate_Details); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[234].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertChain_NoiseCertificate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[235].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CertChain_NoiseCertificate_Details); i { case 0: return &v.state @@ -26078,10 +27492,10 @@ func file_binary_proto_def_proto_init() { } } } - file_binary_proto_def_proto_msgTypes[15].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[14].OneofWrappers = []interface{}{ (*InteractiveResponseMessage_NativeFlowResponseMessage_)(nil), } - file_binary_proto_def_proto_msgTypes[16].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[15].OneofWrappers = []interface{}{ (*InteractiveMessage_ShopStorefrontMessage)(nil), (*InteractiveMessage_CollectionMessage_)(nil), (*InteractiveMessage_NativeFlowMessage_)(nil), @@ -26114,28 +27528,28 @@ func file_binary_proto_def_proto_init() { (*TemplateMessage_HydratedFourRowTemplate_)(nil), (*TemplateMessage_InteractiveMessageTemplate)(nil), } - file_binary_proto_def_proto_msgTypes[183].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[188].OneofWrappers = []interface{}{ (*InteractiveMessage_Header_DocumentMessage)(nil), (*InteractiveMessage_Header_ImageMessage)(nil), (*InteractiveMessage_Header_JpegThumbnail)(nil), (*InteractiveMessage_Header_VideoMessage)(nil), } - file_binary_proto_def_proto_msgTypes[188].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[193].OneofWrappers = []interface{}{ (*HighlyStructuredMessage_HSMLocalizableParameter_Currency)(nil), (*HighlyStructuredMessage_HSMLocalizableParameter_DateTime)(nil), } - file_binary_proto_def_proto_msgTypes[189].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[194].OneofWrappers = []interface{}{ (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component)(nil), (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch)(nil), } - file_binary_proto_def_proto_msgTypes[206].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[211].OneofWrappers = []interface{}{ (*TemplateMessage_HydratedFourRowTemplate_DocumentMessage)(nil), (*TemplateMessage_HydratedFourRowTemplate_HydratedTitleText)(nil), (*TemplateMessage_HydratedFourRowTemplate_ImageMessage)(nil), (*TemplateMessage_HydratedFourRowTemplate_VideoMessage)(nil), (*TemplateMessage_HydratedFourRowTemplate_LocationMessage)(nil), } - file_binary_proto_def_proto_msgTypes[207].OneofWrappers = []interface{}{ + file_binary_proto_def_proto_msgTypes[212].OneofWrappers = []interface{}{ (*TemplateMessage_FourRowTemplate_DocumentMessage)(nil), (*TemplateMessage_FourRowTemplate_HighlyStructuredMessage)(nil), (*TemplateMessage_FourRowTemplate_ImageMessage)(nil), @@ -26147,8 +27561,8 @@ func file_binary_proto_def_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_binary_proto_def_proto_rawDesc, - NumEnums: 56, - NumMessages: 224, + NumEnums: 59, + NumMessages: 236, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw b/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw index 1f0474b4..720f8f2b 100644 Binary files a/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw and b/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw differ diff --git a/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto b/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto index 249d4031..4ae48353 100644 --- a/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto +++ b/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto @@ -47,11 +47,17 @@ message DeviceProps { ALOHA = 11; CATALINA = 12; TCL_TV = 13; + IOS_PHONE = 14; + IOS_CATALYST = 15; + ANDROID_PHONE = 16; + ANDROID_AMBIGUOUS = 17; } message HistorySyncConfig { optional uint32 fullSyncDaysLimit = 1; optional uint32 fullSyncSizeMbLimit = 2; optional uint32 storageQuotaMb = 3; + optional bool inlineInitialPayloadInE2EeMsg = 4; + optional uint32 recentSyncDaysLimit = 5; } message AppVersion { @@ -69,20 +75,6 @@ message DeviceProps { optional HistorySyncConfig historySyncConfig = 5; } -message PeerDataOperationRequestMessage { - message RequestUrlPreview { - optional string url = 1; - } - - message RequestStickerReupload { - optional string fileSha256 = 1; - } - - optional PeerDataOperationRequestType peerDataOperationRequestType = 1; - repeated RequestStickerReupload requestStickerReupload = 2; - repeated RequestUrlPreview requestUrlPreview = 3; -} - message PaymentInviteMessage { enum ServiceType { UNKNOWN = 0; @@ -237,7 +229,12 @@ message InteractiveResponseMessage { } message Body { + enum Format { + DEFAULT = 0; + EXTENSIONS_1 = 1; + } optional string text = 1; + optional Format format = 2; } optional Body body = 1; @@ -349,6 +346,7 @@ message HistorySyncNotification { RECENT = 3; PUSH_NAME = 4; NON_BLOCKING_DATA = 5; + ON_DEMAND = 6; } optional bytes fileSha256 = 1; optional uint64 fileLength = 2; @@ -360,6 +358,7 @@ message HistorySyncNotification { optional string originalMessageId = 8; optional uint32 progress = 9; optional int64 oldestMsgInChunkTimestampSec = 10; + optional bytes initialHistBootstrapInlinePayload = 11; } message HighlyStructuredMessage { @@ -458,7 +457,7 @@ message ExtendedTextMessage { BRYNDAN_WRITE = 3; BEBASNEUE_REGULAR = 4; OSWALD_HEAVY = 5; - DAMION_REGULAR = 6; + SYSTEM_BOLD = 6; MORNINGBREEZE_REGULAR = 7; CALISTOGA_REGULAR = 8; EXO2_EXTRABOLD = 9; @@ -535,6 +534,12 @@ message ContactsArrayMessage { optional ContextInfo contextInfo = 17; } +message ContactMessageV2 { + optional string displayName = 1; + optional string vcard = 2; + optional ContextInfo contextInfo = 3; +} + message ContactMessage { optional string displayName = 1; optional string vcard = 16; @@ -630,6 +635,7 @@ message AudioMessage { optional bytes streamingSidecar = 18; optional bytes waveform = 19; optional fixed32 backgroundArgb = 20; + optional bool viewOnce = 21; } message AppStateSyncKey { @@ -923,6 +929,7 @@ message Message { optional PinMessage pinMessage = 63; optional PollCreationMessage pollCreationMessageV3 = 64; optional ScheduledCallEditMessage scheduledCallEditMessage = 65; + optional VideoMessage ptvMessage = 66; } message MessageContextInfo { @@ -930,6 +937,7 @@ message MessageContextInfo { optional int32 deviceListMetadataVersion = 2; optional bytes messageSecret = 3; optional bytes paddingBytes = 4; + optional uint32 messageAddOnDurationInSecs = 5; } message VideoMessage { @@ -1193,10 +1201,26 @@ enum PeerDataOperationRequestType { UPLOAD_STICKER = 0; SEND_RECENT_STICKER_BOOTSTRAP = 1; GENERATE_LINK_PREVIEW = 2; + HISTORY_SYNC_ON_DEMAND = 3; + PLACEHOLDER_MESSAGE_RESEND = 4; } message PeerDataOperationRequestResponseMessage { message PeerDataOperationResult { + message PlaceholderMessageResendResponse { + optional bytes webMessageInfoBytes = 1; + } + message LinkPreviewResponse { + message LinkPreviewHighQualityThumbnail { + optional string directPath = 1; + optional string thumbHash = 2; + optional string encThumbHash = 3; + optional bytes mediaKey = 4; + optional int64 mediaKeyTimestampMs = 5; + optional int32 thumbWidth = 6; + optional int32 thumbHeight = 7; + } + optional string url = 1; optional string title = 2; optional string description = 3; @@ -1204,11 +1228,13 @@ message PeerDataOperationRequestResponseMessage { optional string canonicalUrl = 5; optional string matchText = 6; optional string previewType = 7; + optional LinkPreviewHighQualityThumbnail hqThumbnail = 8; } optional MediaRetryNotification.ResultType mediaUploadResult = 1; optional StickerMessage stickerMessage = 2; optional LinkPreviewResponse linkPreviewResponse = 3; + optional PlaceholderMessageResendResponse placeholderMessageResendResponse = 4; } optional PeerDataOperationRequestType peerDataOperationRequestType = 1; @@ -1216,6 +1242,35 @@ message PeerDataOperationRequestResponseMessage { repeated PeerDataOperationResult peerDataOperationResult = 3; } +message PeerDataOperationRequestMessage { + message RequestStickerReupload { + optional string fileSha256 = 1; + } + + message PlaceholderMessageResendRequest { + optional MessageKey messageKey = 1; + } + + message HistorySyncOnDemandRequest { + optional string chatJid = 1; + optional string oldestMsgId = 2; + optional bool oldestMsgFromMe = 3; + optional int32 onDemandMsgCount = 4; + optional int64 oldestMsgTimestampMs = 5; + } + + message RequestUrlPreview { + optional string url = 1; + optional bool includeHqThumbnail = 2; + } + + optional PeerDataOperationRequestType peerDataOperationRequestType = 1; + repeated RequestStickerReupload requestStickerReupload = 2; + repeated RequestUrlPreview requestUrlPreview = 3; + optional HistorySyncOnDemandRequest historySyncOnDemandRequest = 4; + repeated PlaceholderMessageResendRequest placeholderMessageResendRequest = 5; +} + message EphemeralSetting { optional sfixed32 duration = 1; optional sfixed64 timestamp = 2; @@ -1260,6 +1315,15 @@ message PastParticipant { optional uint64 leaveTs = 3; } +message NotificationSettings { + optional string messageVibrate = 1; + optional string messagePopup = 2; + optional string messageLight = 3; + optional bool lowPriorityNotifications = 4; + optional bool reactionsMuted = 5; + optional string callVibrate = 6; +} + enum MediaVisibility { DEFAULT = 0; OFF = 1; @@ -1273,6 +1337,7 @@ message HistorySync { RECENT = 3; PUSH_NAME = 4; NON_BLOCKING_DATA = 5; + ON_DEMAND = 6; } required HistorySyncType syncType = 1; repeated Conversation conversations = 2; @@ -1314,12 +1379,20 @@ message GlobalSettings { optional int32 disappearingModeDuration = 9; optional int64 disappearingModeTimestamp = 10; optional AvatarUserSettings avatarUserSettings = 11; + optional int32 fontSize = 12; + optional bool securityNotifications = 13; + optional bool autoUnarchiveChats = 14; + optional int32 videoQualityMode = 15; + optional int32 photoQualityMode = 16; + optional NotificationSettings individualNotificationSettings = 17; + optional NotificationSettings groupNotificationSettings = 18; } message Conversation { enum EndOfHistoryTransferType { COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0; COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1; + COMPLETE_ON_DEMAND_SYNC_BUT_MORE_MSG_REMAIN_ON_PRIMARY = 2; } required string id = 1; repeated HistorySyncMsg messages = 2; @@ -1356,8 +1429,8 @@ message Conversation { optional string description = 33; optional bool support = 34; optional bool isParentGroup = 35; - optional bool isDefaultSubgroup = 36; optional string parentGroupId = 37; + optional bool isDefaultSubgroup = 36; optional string displayName = 38; optional string pnJid = 39; optional bool shareOwnPn = 40; @@ -1552,6 +1625,10 @@ message SyncActionValue { optional ChatAssignmentAction chatAssignment = 35; optional ChatAssignmentOpenedStatusAction chatAssignmentOpenedStatus = 36; optional PnForLidChatAction pnForLidChatAction = 37; + optional MarketingMessageAction marketingMessageAction = 38; + optional MarketingMessageBroadcastAction marketingMessageBroadcastAction = 39; + optional ExternalWebBetaAction externalWebBetaAction = 40; + optional PrivacySettingRelayAllCalls privacySettingRelayAllCalls = 41; } message UserStatusMuteAction { @@ -1624,6 +1701,10 @@ message PushNameSetting { optional string name = 1; } +message PrivacySettingRelayAllCalls { + optional bool isEnabled = 1; +} + message PrimaryVersionAction { optional string version = 1; } @@ -1650,6 +1731,23 @@ message MuteAction { optional bool autoMuted = 3; } +message MarketingMessageBroadcastAction { + optional int32 repliedCount = 1; +} + +message MarketingMessageAction { + enum MarketingMessagePrototypeType { + PERSONALIZED = 0; + } + optional string name = 1; + optional string message = 2; + optional MarketingMessagePrototypeType type = 3; + optional int64 createdAt = 4; + optional int64 lastSentAt = 5; + optional bool isDeleted = 6; + optional string mediaId = 7; +} + message MarkChatAsReadAction { optional bool read = 1; optional SyncActionMessageRange messageRange = 2; @@ -1674,6 +1772,10 @@ message KeyExpiration { optional int32 expiredKeyEpoch = 1; } +message ExternalWebBetaAction { + optional bool isOptIn = 1; +} + message DeleteMessageForMeAction { optional bool deleteMedia = 1; optional int64 messageTimestamp = 2; @@ -1885,6 +1987,7 @@ message ClientPayload { ARDEVICE = 30; VRDEVICE = 31; BLUE_WEB = 32; + IPAD = 33; } message AppVersion { optional uint32 primary = 1; @@ -1912,7 +2015,14 @@ message ClientPayload { enum Product { WHATSAPP = 0; MESSENGER = 1; + INTEROP = 2; } + message InteropData { + optional uint64 accountId = 1; + optional uint32 integratorId = 2; + optional bytes token = 3; + } + enum IOSAppExtension { SHARE_EXTENSION = 0; SERVICE_EXTENSION = 1; @@ -1965,6 +2075,7 @@ message ClientPayload { ERROR_RECONNECT = 3; NETWORK_SWITCH = 4; PING_RECONNECT = 5; + UNKNOWN = 6; } optional uint64 username = 1; optional bool passive = 3; @@ -1992,6 +2103,7 @@ message ClientPayload { optional bytes paddingBytes = 34; optional int32 yearClass = 36; optional int32 memClass = 37; + optional InteropData interopData = 38; } message WebNotificationsInfo { @@ -2165,6 +2277,20 @@ message WebMessageInfo { CAG_INVITE_AUTO_ADD = 159; BIZ_CHAT_ASSIGNMENT_UNASSIGN = 160; CAG_INVITE_AUTO_JOINED = 161; + SCHEDULED_CALL_START_MESSAGE = 162; + COMMUNITY_INVITE_RICH = 163; + COMMUNITY_INVITE_AUTO_ADD_RICH = 164; + SUB_GROUP_INVITE_RICH = 165; + SUB_GROUP_PARTICIPANT_ADD_RICH = 166; + COMMUNITY_LINK_PARENT_GROUP_RICH = 167; + COMMUNITY_PARTICIPANT_ADD_RICH = 168; + SILENCED_UNKNOWN_CALLER_AUDIO = 169; + SILENCED_UNKNOWN_CALLER_VIDEO = 170; + GROUP_MEMBER_ADD_MODE = 171; + GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD = 172; + COMMUNITY_CHANGE_DESCRIPTION = 173; + SENDER_INVITE = 174; + RECEIVER_INVITE = 175; } enum Status { ERROR = 0; @@ -2223,6 +2349,7 @@ message WebMessageInfo { optional KeepInChat keepInChat = 50; optional string originalSelfAuthorUserJidString = 51; optional uint64 revokeMessageTimestamp = 52; + optional PinInChat pinInChat = 54; } message WebFeatures { @@ -2313,6 +2440,18 @@ message PollAdditionalMetadata { optional bool pollInvalidated = 1; } +message PinInChat { + enum PinMessageType { + UNKNOWN_PIN_MESSAGE_TYPE = 0; + PIN_FOR_ALL = 1; + UNPIN_FOR_ALL = 2; + } + optional PinMessageType pinMessageType = 1; + optional MessageKey key = 2; + optional int64 senderTimestampMs = 3; + optional int64 serverTimestampMs = 4; +} + message PhotoChange { optional bytes oldPhoto = 1; optional bytes newPhoto = 2; diff --git a/vendor/go.mau.fi/whatsmeow/download.go b/vendor/go.mau.fi/whatsmeow/download.go index e9bedd45..84e78886 100644 --- a/vendor/go.mau.fi/whatsmeow/download.go +++ b/vendor/go.mau.fi/whatsmeow/download.go @@ -268,7 +268,9 @@ func (cli *Client) downloadEncryptedMedia(url string, checksum []byte) (file, ma } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - if resp.StatusCode == http.StatusNotFound { + if resp.StatusCode == http.StatusForbidden { + err = ErrMediaDownloadFailedWith403 + } else if resp.StatusCode == http.StatusNotFound { err = ErrMediaDownloadFailedWith404 } else if resp.StatusCode == http.StatusGone { err = ErrMediaDownloadFailedWith410 diff --git a/vendor/go.mau.fi/whatsmeow/errors.go b/vendor/go.mau.fi/whatsmeow/errors.go index 62227f3b..a5182eef 100644 --- a/vendor/go.mau.fi/whatsmeow/errors.go +++ b/vendor/go.mau.fi/whatsmeow/errors.go @@ -29,6 +29,8 @@ var ( ErrNoPushName = errors.New("can't send presence without PushName set") ErrNoPrivacyToken = errors.New("no privacy token stored") + + ErrAppStateUpdate = errors.New("server returned error updating app state") ) // Errors that happen while confirming device pairing @@ -107,6 +109,7 @@ var ( // Some errors that Client.Download can return var ( + ErrMediaDownloadFailedWith403 = errors.New("download failed with status code 403") ErrMediaDownloadFailedWith404 = errors.New("download failed with status code 404") ErrMediaDownloadFailedWith410 = errors.New("download failed with status code 410") ErrNoURLPresent = errors.New("no url present") diff --git a/vendor/go.mau.fi/whatsmeow/message.go b/vendor/go.mau.fi/whatsmeow/message.go index b3ef53b6..8945ce4c 100644 --- a/vendor/go.mau.fi/whatsmeow/message.go +++ b/vendor/go.mau.fi/whatsmeow/message.go @@ -101,6 +101,7 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er info.Timestamp = ag.UnixTime("t") info.PushName = ag.OptionalString("notify") info.Category = ag.OptionalString("category") + info.Type = ag.OptionalString("type") if !ag.OK() { return nil, ag.Error() } @@ -246,6 +247,9 @@ func isValidPadding(plaintext []byte) bool { } func unpadMessage(plaintext []byte) ([]byte, error) { + if len(plaintext) == 0 { + return nil, fmt.Errorf("plaintext is empty") + } if checkPadding && !isValidPadding(plaintext) { return nil, fmt.Errorf("plaintext doesn't have expected padding") } diff --git a/vendor/go.mau.fi/whatsmeow/retry.go b/vendor/go.mau.fi/whatsmeow/retry.go index 95104c8f..3871abd6 100644 --- a/vendor/go.mau.fi/whatsmeow/retry.go +++ b/vendor/go.mau.fi/whatsmeow/retry.go @@ -169,7 +169,11 @@ func (cli *Client) handleRetryReceipt(receipt *events.Receipt, node *waBinary.No return fmt.Errorf("didn't get prekey bundle for %s (response size: %d)", senderAD, len(keys)) } } - encrypted, includeDeviceIdentity, err := cli.encryptMessageForDevice(plaintext, receipt.Sender, bundle) + encAttrs := waBinary.Attrs{} + if mediaType := getMediaTypeFromMessage(msg); mediaType != "" { + encAttrs["mediatype"] = mediaType + } + encrypted, includeDeviceIdentity, err := cli.encryptMessageForDevice(plaintext, receipt.Sender, bundle, encAttrs) if err != nil { return fmt.Errorf("failed to encrypt message for retry: %w", err) } @@ -193,14 +197,10 @@ func (cli *Client) handleRetryReceipt(receipt *events.Receipt, node *waBinary.No if edit, ok := node.Attrs["edit"]; ok { attrs["edit"] = edit } - content := []waBinary.Node{*encrypted} - if includeDeviceIdentity { - content = append(content, cli.makeDeviceIdentityNode()) - } err = cli.sendNode(waBinary.Node{ Tag: "message", Attrs: attrs, - Content: content, + Content: cli.getMessageContent(*encrypted, msg, attrs, includeDeviceIdentity), }) if err != nil { return fmt.Errorf("failed to send retry message: %w", err) diff --git a/vendor/go.mau.fi/whatsmeow/send.go b/vendor/go.mau.fi/whatsmeow/send.go index 96d888be..d2b379b0 100644 --- a/vendor/go.mau.fi/whatsmeow/send.go +++ b/vendor/go.mau.fi/whatsmeow/send.go @@ -246,6 +246,9 @@ func (cli *Client) BuildRevoke(chat, sender types.JID, id types.MessageID) *waPr } } +// EditWindow specifies how long a message can be edited for after it was sent. +const EditWindow = 20 * time.Minute + // BuildEdit builds a message edit message using the given variables. // The built message can be sent normally using Client.SendMessage. // @@ -399,11 +402,15 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types. phash := participantListHashV2(allDevices) node.Attrs["phash"] = phash - node.Content = append(node.GetChildren(), waBinary.Node{ + skMsg := waBinary.Node{ Tag: "enc", Content: ciphertext, Attrs: waBinary.Attrs{"v": "2", "type": "skmsg"}, - }) + } + if mediaType := getMediaTypeFromMessage(message); mediaType != "" { + skMsg.Attrs["mediatype"] = mediaType + } + node.Content = append(node.GetChildren(), skMsg) start = time.Now() data, err := cli.sendNodeAndGetData(*node) @@ -463,16 +470,109 @@ func getTypeFromMessage(msg *waProto.Message) string { return "reaction" case msg.PollCreationMessage != nil, msg.PollUpdateMessage != nil: return "poll" + case getMediaTypeFromMessage(msg) != "": + return "media" case msg.Conversation != nil, msg.ExtendedTextMessage != nil, msg.ProtocolMessage != nil: return "text" - //TODO this requires setting mediatype in the enc nodes - //case msg.ImageMessage != nil, msg.DocumentMessage != nil, msg.AudioMessage != nil, msg.VideoMessage != nil: - // return "media" default: return "text" } } +func getMediaTypeFromMessage(msg *waProto.Message) string { + switch { + case msg.ViewOnceMessage != nil: + return getMediaTypeFromMessage(msg.ViewOnceMessage.Message) + case msg.ViewOnceMessageV2 != nil: + return getMediaTypeFromMessage(msg.ViewOnceMessageV2.Message) + case msg.EphemeralMessage != nil: + return getMediaTypeFromMessage(msg.EphemeralMessage.Message) + case msg.DocumentWithCaptionMessage != nil: + return getMediaTypeFromMessage(msg.DocumentWithCaptionMessage.Message) + case msg.ExtendedTextMessage != nil && msg.ExtendedTextMessage.Title != nil: + return "url" + case msg.ImageMessage != nil: + return "image" + case msg.StickerMessage != nil: + return "sticker" + case msg.DocumentMessage != nil: + return "document" + case msg.AudioMessage != nil: + if msg.AudioMessage.GetPtt() { + return "ptt" + } else { + return "audio" + } + case msg.VideoMessage != nil: + if msg.VideoMessage.GetGifPlayback() { + return "gif" + } else { + return "video" + } + case msg.ContactMessage != nil: + return "vcard" + case msg.ContactsArrayMessage != nil: + return "contact_array" + case msg.ListMessage != nil: + return "list" + case msg.ListResponseMessage != nil: + return "list_response" + case msg.ButtonsResponseMessage != nil: + return "buttons_response" + case msg.OrderMessage != nil: + return "order" + case msg.ProductMessage != nil: + return "product" + case msg.InteractiveResponseMessage != nil: + return "native_flow_response" + default: + return "" + } +} + +func getButtonTypeFromMessage(msg *waProto.Message) string { + switch { + case msg.ViewOnceMessage != nil: + return getButtonTypeFromMessage(msg.ViewOnceMessage.Message) + case msg.ViewOnceMessageV2 != nil: + return getButtonTypeFromMessage(msg.ViewOnceMessageV2.Message) + case msg.EphemeralMessage != nil: + return getButtonTypeFromMessage(msg.EphemeralMessage.Message) + case msg.ButtonsMessage != nil: + return "buttons" + case msg.ButtonsResponseMessage != nil: + return "buttons_response" + case msg.ListMessage != nil: + return "list" + case msg.ListResponseMessage != nil: + return "list_response" + case msg.InteractiveResponseMessage != nil: + return "interactive_response" + default: + return "" + } +} + +func getButtonAttributes(msg *waProto.Message) waBinary.Attrs { + switch { + case msg.ViewOnceMessage != nil: + return getButtonAttributes(msg.ViewOnceMessage.Message) + case msg.ViewOnceMessageV2 != nil: + return getButtonAttributes(msg.ViewOnceMessageV2.Message) + case msg.EphemeralMessage != nil: + return getButtonAttributes(msg.EphemeralMessage.Message) + case msg.TemplateMessage != nil: + return waBinary.Attrs{} + case msg.ListMessage != nil: + return waBinary.Attrs{ + "v": "2", + "type": strings.ToLower(waProto.ListMessage_ListType_name[int32(msg.ListMessage.GetListType())]), + } + default: + return waBinary.Attrs{} + } +} + const ( EditAttributeEmpty = "" EditAttributeMessageEdit = "1" @@ -484,6 +584,8 @@ const RemoveReactionText = "" func getEditAttribute(msg *waProto.Message) string { switch { + case msg.EditedMessage != nil && msg.EditedMessage.Message != nil: + return getEditAttribute(msg.EditedMessage.Message) case msg.ProtocolMessage != nil && msg.ProtocolMessage.GetKey() != nil: switch msg.ProtocolMessage.GetType() { case waProto.ProtocolMessage_REVOKE: @@ -493,7 +595,7 @@ func getEditAttribute(msg *waProto.Message) string { return EditAttributeAdminRevoke } case waProto.ProtocolMessage_MESSAGE_EDIT: - if msg.EditedMessage != nil { + if msg.ProtocolMessage.EditedMessage != nil { return EditAttributeMessageEdit } } @@ -523,7 +625,7 @@ func (cli *Client) preparePeerMessageNode(to types.JID, id types.MessageID, mess return nil, err } start = time.Now() - encrypted, isPreKey, err := cli.encryptMessageForDevice(plaintext, to, nil) + encrypted, isPreKey, err := cli.encryptMessageForDevice(plaintext, to, nil, nil) timings.PeerEncrypt = time.Since(start) if err != nil { return nil, fmt.Errorf("failed to encrypt peer message for %s: %v", to, err) @@ -539,34 +641,12 @@ func (cli *Client) preparePeerMessageNode(to types.JID, id types.MessageID, mess }, nil } -func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, participants []types.JID, plaintext, dsmPlaintext []byte, timings *MessageDebugTimings) (*waBinary.Node, []types.JID, error) { - start := time.Now() - allDevices, err := cli.GetUserDevicesContext(ctx, participants) - timings.GetDevices = time.Since(start) - if err != nil { - return nil, nil, fmt.Errorf("failed to get device list: %w", err) - } - - attrs := waBinary.Attrs{ - "id": id, - "type": getTypeFromMessage(message), - "to": to, - } - if editAttr := getEditAttribute(message); editAttr != "" { - attrs["edit"] = editAttr - } - - start = time.Now() - participantNodes, includeIdentity := cli.encryptMessageForDevices(ctx, allDevices, ownID, id, plaintext, dsmPlaintext) - timings.PeerEncrypt = time.Since(start) - content := []waBinary.Node{{ - Tag: "participants", - Content: participantNodes, - }} +func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waProto.Message, msgAttrs waBinary.Attrs, includeIdentity bool) []waBinary.Node { + content := []waBinary.Node{baseNode} if includeIdentity { content = append(content, cli.makeDeviceIdentityNode()) } - if attrs["type"] == "poll" { + if msgAttrs["type"] == "poll" { pollType := "creation" if message.PollUpdateMessage != nil { pollType = "vote" @@ -578,10 +658,56 @@ func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, }, }) } + if buttonType := getButtonTypeFromMessage(message); buttonType != "" { + content = append(content, waBinary.Node{ + Tag: "biz", + Content: []waBinary.Node{{ + Tag: buttonType, + Attrs: getButtonAttributes(message), + }}, + }) + } + return content +} + +func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, participants []types.JID, plaintext, dsmPlaintext []byte, timings *MessageDebugTimings) (*waBinary.Node, []types.JID, error) { + start := time.Now() + allDevices, err := cli.GetUserDevicesContext(ctx, participants) + timings.GetDevices = time.Since(start) + if err != nil { + return nil, nil, fmt.Errorf("failed to get device list: %w", err) + } + + msgType := getTypeFromMessage(message) + encAttrs := waBinary.Attrs{} + // Only include encMediaType for 1:1 messages (groups don't have a device-sent message plaintext) + if encMediaType := getMediaTypeFromMessage(message); dsmPlaintext != nil && encMediaType != "" { + encAttrs["mediatype"] = encMediaType + } + attrs := waBinary.Attrs{ + "id": id, + "type": msgType, + "to": to, + } + if editAttr := getEditAttribute(message); editAttr != "" { + attrs["edit"] = editAttr + encAttrs["decrypt-fail"] = "hide" + } + if msgType == "reaction" { + encAttrs["decrypt-fail"] = "hide" + } + + start = time.Now() + participantNodes, includeIdentity := cli.encryptMessageForDevices(ctx, allDevices, ownID, id, plaintext, dsmPlaintext, encAttrs) + timings.PeerEncrypt = time.Since(start) + participantNode := waBinary.Node{ + Tag: "participants", + Content: participantNodes, + } return &waBinary.Node{ Tag: "message", Attrs: attrs, - Content: content, + Content: cli.getMessageContent(participantNode, message, attrs, includeIdentity), }, allDevices, nil } @@ -619,7 +745,7 @@ func (cli *Client) makeDeviceIdentityNode() waBinary.Node { } } -func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []types.JID, ownID types.JID, id string, msgPlaintext, dsmPlaintext []byte) ([]waBinary.Node, bool) { +func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []types.JID, ownID types.JID, id string, msgPlaintext, dsmPlaintext []byte, encAttrs waBinary.Attrs) ([]waBinary.Node, bool) { includeIdentity := false participantNodes := make([]waBinary.Node, 0, len(allDevices)) var retryDevices []types.JID @@ -631,7 +757,7 @@ func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []ty } plaintext = dsmPlaintext } - encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(plaintext, jid, nil) + encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(plaintext, jid, nil, encAttrs) if errors.Is(err, ErrNoSession) { retryDevices = append(retryDevices, jid) continue @@ -659,7 +785,7 @@ func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []ty if jid.User == ownID.User && dsmPlaintext != nil { plaintext = dsmPlaintext } - encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(plaintext, jid, resp.bundle) + encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(plaintext, jid, resp.bundle, encAttrs) if err != nil { cli.Log.Warnf("Failed to encrypt %s for %s (retry): %v", id, jid, err) continue @@ -674,8 +800,8 @@ func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []ty return participantNodes, includeIdentity } -func (cli *Client) encryptMessageForDeviceAndWrap(plaintext []byte, to types.JID, bundle *prekey.Bundle) (*waBinary.Node, bool, error) { - node, includeDeviceIdentity, err := cli.encryptMessageForDevice(plaintext, to, bundle) +func (cli *Client) encryptMessageForDeviceAndWrap(plaintext []byte, to types.JID, bundle *prekey.Bundle, encAttrs waBinary.Attrs) (*waBinary.Node, bool, error) { + node, includeDeviceIdentity, err := cli.encryptMessageForDevice(plaintext, to, bundle, encAttrs) if err != nil { return nil, false, err } @@ -686,7 +812,13 @@ func (cli *Client) encryptMessageForDeviceAndWrap(plaintext []byte, to types.JID }, includeDeviceIdentity, nil } -func (cli *Client) encryptMessageForDevice(plaintext []byte, to types.JID, bundle *prekey.Bundle) (*waBinary.Node, bool, error) { +func copyAttrs(from, to waBinary.Attrs) { + for k, v := range from { + to[k] = v + } +} + +func (cli *Client) encryptMessageForDevice(plaintext []byte, to types.JID, bundle *prekey.Bundle, extraAttrs waBinary.Attrs) (*waBinary.Node, bool, error) { builder := session.NewBuilderFromSignal(cli.Store, to.SignalAddress(), pbSerializer) if bundle != nil { cli.Log.Debugf("Processing prekey bundle for %s", to) @@ -708,17 +840,18 @@ func (cli *Client) encryptMessageForDevice(plaintext []byte, to types.JID, bundl return nil, false, fmt.Errorf("cipher encryption failed: %w", err) } - encType := "msg" - if ciphertext.Type() == protocol.PREKEY_TYPE { - encType = "pkmsg" + encAttrs := waBinary.Attrs{ + "v": "2", + "type": "msg", } + if ciphertext.Type() == protocol.PREKEY_TYPE { + encAttrs["type"] = "pkmsg" + } + copyAttrs(extraAttrs, encAttrs) return &waBinary.Node{ - Tag: "enc", - Attrs: waBinary.Attrs{ - "v": "2", - "type": encType, - }, + Tag: "enc", + Attrs: encAttrs, Content: ciphertext.Serialize(), - }, encType == "pkmsg", nil + }, encAttrs["type"] == "pkmsg", nil } diff --git a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go index 973aff33..639fe2f8 100644 --- a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +++ b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go @@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.ClientPayload_UserAgent_ } // waVersion is the WhatsApp web client version -var waVersion = WAVersionContainer{2, 2308, 7} +var waVersion = WAVersionContainer{2, 2318, 11} // waVersionHash is the md5 hash of a dot-separated waVersion var waVersionHash [16]byte diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go index 7f8c6c8f..8f6eacd4 100644 --- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go @@ -65,7 +65,12 @@ func New(dialect, address string, log waLog.Logger) (*Container, error) { // if err != nil { // panic(err) // } -// container, err := sqlstore.NewWithDB(db, "sqlite3", nil) +// container := sqlstore.NewWithDB(db, "sqlite3", nil) +// +// This method does not call Upgrade automatically like New does, so you must call it yourself: +// +// container := sqlstore.NewWithDB(...) +// err := container.Upgrade() func NewWithDB(db *sql.DB, dialect string, log waLog.Logger) *Container { if log == nil { log = waLog.Noop diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go index f9f5a287..a6acdfc0 100644 --- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go @@ -284,7 +284,8 @@ const ( SET key_data=excluded.key_data, timestamp=excluded.timestamp, fingerprint=excluded.fingerprint WHERE excluded.timestamp > whatsmeow_app_state_sync_keys.timestamp ` - getAppStateSyncKeyQuery = `SELECT key_data, timestamp, fingerprint FROM whatsmeow_app_state_sync_keys WHERE jid=$1 AND key_id=$2` + getAppStateSyncKeyQuery = `SELECT key_data, timestamp, fingerprint FROM whatsmeow_app_state_sync_keys WHERE jid=$1 AND key_id=$2` + getLatestAppStateSyncKeyIDQuery = `SELECT key_id FROM whatsmeow_app_state_sync_keys WHERE jid=$1 ORDER BY timestamp DESC LIMIT 1` ) func (s *SQLStore) PutAppStateSyncKey(id []byte, key store.AppStateSyncKey) error { @@ -301,6 +302,15 @@ func (s *SQLStore) GetAppStateSyncKey(id []byte) (*store.AppStateSyncKey, error) return &key, err } +func (s *SQLStore) GetLatestAppStateSyncKeyID() ([]byte, error) { + var keyID []byte + err := s.db.QueryRow(getLatestAppStateSyncKeyIDQuery, s.JID).Scan(&keyID) + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } + return keyID, err +} + const ( putAppStateVersionQuery = ` INSERT INTO whatsmeow_app_state_version (jid, name, version, hash) VALUES ($1, $2, $3, $4) diff --git a/vendor/go.mau.fi/whatsmeow/store/store.go b/vendor/go.mau.fi/whatsmeow/store/store.go index 36a6dce9..49c2176e 100644 --- a/vendor/go.mau.fi/whatsmeow/store/store.go +++ b/vendor/go.mau.fi/whatsmeow/store/store.go @@ -55,6 +55,7 @@ type AppStateSyncKey struct { type AppStateSyncKeyStore interface { PutAppStateSyncKey(id []byte, key AppStateSyncKey) error GetAppStateSyncKey(id []byte) (*AppStateSyncKey, error) + GetLatestAppStateSyncKeyID() ([]byte, error) } type AppStateMutationMAC struct { diff --git a/vendor/go.mau.fi/whatsmeow/types/events/appstate.go b/vendor/go.mau.fi/whatsmeow/types/events/appstate.go index d462d6f3..285e546b 100644 --- a/vendor/go.mau.fi/whatsmeow/types/events/appstate.go +++ b/vendor/go.mau.fi/whatsmeow/types/events/appstate.go @@ -19,7 +19,8 @@ type Contact struct { JID types.JID // The contact who was modified. Timestamp time.Time // The time when the modification happened.' - Action *waProto.ContactAction // The new contact info. + Action *waProto.ContactAction // The new contact info. + FromFullSync bool // Whether the action is emitted because of a fullSync } // PushName is emitted when a message is received with a different push name than the previous value cached for the same user. @@ -43,7 +44,8 @@ type Pin struct { JID types.JID // The chat which was pinned or unpinned. Timestamp time.Time // The time when the (un)pinning happened. - Action *waProto.PinAction // Whether the chat is now pinned or not. + Action *waProto.PinAction // Whether the chat is now pinned or not. + FromFullSync bool // Whether the action is emitted because of a fullSync } // Star is emitted when a message is starred or unstarred from another device. @@ -54,7 +56,8 @@ type Star struct { MessageID string // The message which was starred or unstarred. Timestamp time.Time // The time when the (un)starring happened. - Action *waProto.StarAction // Whether the message is now starred or not. + Action *waProto.StarAction // Whether the message is now starred or not. + FromFullSync bool // Whether the action is emitted because of a fullSync } // DeleteForMe is emitted when a message is deleted (for the current user only) from another device. @@ -65,7 +68,8 @@ type DeleteForMe struct { MessageID string // The message which was deleted. Timestamp time.Time // The time when the deletion happened. - Action *waProto.DeleteMessageForMeAction // Additional information for the deletion. + Action *waProto.DeleteMessageForMeAction // Additional information for the deletion. + FromFullSync bool // Whether the action is emitted because of a fullSync } // Mute is emitted when a chat is muted or unmuted from another device. @@ -73,7 +77,8 @@ type Mute struct { JID types.JID // The chat which was muted or unmuted. Timestamp time.Time // The time when the (un)muting happened. - Action *waProto.MuteAction // The current mute status of the chat. + Action *waProto.MuteAction // The current mute status of the chat. + FromFullSync bool // Whether the action is emitted because of a fullSync } // Archive is emitted when a chat is archived or unarchived from another device. @@ -81,7 +86,8 @@ type Archive struct { JID types.JID // The chat which was archived or unarchived. Timestamp time.Time // The time when the (un)archiving happened. - Action *waProto.ArchiveChatAction // The current archival status of the chat. + Action *waProto.ArchiveChatAction // The current archival status of the chat. + FromFullSync bool // Whether the action is emitted because of a fullSync } // MarkChatAsRead is emitted when a whole chat is marked as read or unread from another device. @@ -89,7 +95,17 @@ type MarkChatAsRead struct { JID types.JID // The chat which was marked as read or unread. Timestamp time.Time // The time when the marking happened. - Action *waProto.MarkChatAsReadAction // Whether the chat was marked as read or unread, and info about the most recent messages. + Action *waProto.MarkChatAsReadAction // Whether the chat was marked as read or unread, and info about the most recent messages. + FromFullSync bool // Whether the action is emitted because of a fullSync +} + +// ClearChat is emitted when a chat is cleared on another device. This is different from DeleteChat. +type ClearChat struct { + JID types.JID // The chat which was cleared. + Timestamp time.Time // The time when the clear happened. + + Action *waProto.ClearChatAction // Information about the clear. + FromFullSync bool // Whether the action is emitted because of a fullSync } // DeleteChat is emitted when a chat is deleted on another device. @@ -97,21 +113,33 @@ type DeleteChat struct { JID types.JID // The chat which was deleted. Timestamp time.Time // The time when the deletion happened. - Action *waProto.DeleteChatAction // Information about the deletion. + Action *waProto.DeleteChatAction // Information about the deletion. + FromFullSync bool // Whether the action is emitted because of a fullSync } // PushNameSetting is emitted when the user's push name is changed from another device. type PushNameSetting struct { Timestamp time.Time // The time when the push name was changed. - Action *waProto.PushNameSetting // The new push name for the user. + Action *waProto.PushNameSetting // The new push name for the user. + FromFullSync bool // Whether the action is emitted because of a fullSync } // UnarchiveChatsSetting is emitted when the user changes the "Keep chats archived" setting from another device. type UnarchiveChatsSetting struct { Timestamp time.Time // The time when the setting was changed. - Action *waProto.UnarchiveChatsSetting // The new settings. + Action *waProto.UnarchiveChatsSetting // The new settings. + FromFullSync bool // Whether the action is emitted because of a fullSync +} + +// UserStatusMute is emitted when the user mutes or unmutes another user's status updates. +type UserStatusMute struct { + JID types.JID // The user who was muted or unmuted + Timestamp time.Time // The timestamp when the action happened + + Action *waProto.UserStatusMuteAction // The new mute status + FromFullSync bool // Whether the action is emitted because of a fullSync } // AppState is emitted directly for new data received from app state syncing. diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go index bc62161d..00f963ea 100644 --- a/vendor/golang.org/x/crypto/curve25519/curve25519.go +++ b/vendor/golang.org/x/crypto/curve25519/curve25519.go @@ -5,71 +5,18 @@ // Package curve25519 provides an implementation of the X25519 function, which // performs scalar multiplication on the elliptic curve known as Curve25519. // See RFC 7748. +// +// Starting in Go 1.20, this package is a wrapper for the X25519 implementation +// in the crypto/ecdh package. package curve25519 // import "golang.org/x/crypto/curve25519" -import ( - "crypto/subtle" - "errors" - "strconv" - - "golang.org/x/crypto/curve25519/internal/field" -) - // ScalarMult sets dst to the product scalar * point. // // Deprecated: when provided a low-order point, ScalarMult will set dst to all // zeroes, irrespective of the scalar. Instead, use the X25519 function, which // will return an error. func ScalarMult(dst, scalar, point *[32]byte) { - var e [32]byte - - copy(e[:], scalar[:]) - e[0] &= 248 - e[31] &= 127 - e[31] |= 64 - - var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element - x1.SetBytes(point[:]) - x2.One() - x3.Set(&x1) - z3.One() - - swap := 0 - for pos := 254; pos >= 0; pos-- { - b := e[pos/8] >> uint(pos&7) - b &= 1 - swap ^= int(b) - x2.Swap(&x3, swap) - z2.Swap(&z3, swap) - swap = int(b) - - tmp0.Subtract(&x3, &z3) - tmp1.Subtract(&x2, &z2) - x2.Add(&x2, &z2) - z2.Add(&x3, &z3) - z3.Multiply(&tmp0, &x2) - z2.Multiply(&z2, &tmp1) - tmp0.Square(&tmp1) - tmp1.Square(&x2) - x3.Add(&z3, &z2) - z2.Subtract(&z3, &z2) - x2.Multiply(&tmp1, &tmp0) - tmp1.Subtract(&tmp1, &tmp0) - z2.Square(&z2) - - z3.Mult32(&tmp1, 121666) - x3.Square(&x3) - tmp0.Add(&tmp0, &z3) - z3.Multiply(&x1, &z2) - z2.Multiply(&tmp1, &tmp0) - } - - x2.Swap(&x3, swap) - z2.Swap(&z3, swap) - - z2.Invert(&z2) - x2.Multiply(&x2, &z2) - copy(dst[:], x2.Bytes()) + scalarMult(dst, scalar, point) } // ScalarBaseMult sets dst to the product scalar * base where base is the @@ -78,7 +25,7 @@ func ScalarMult(dst, scalar, point *[32]byte) { // It is recommended to use the X25519 function with Basepoint instead, as // copying into fixed size arrays can lead to unexpected bugs. func ScalarBaseMult(dst, scalar *[32]byte) { - ScalarMult(dst, scalar, &basePoint) + scalarBaseMult(dst, scalar) } const ( @@ -91,21 +38,10 @@ const ( // Basepoint is the canonical Curve25519 generator. var Basepoint []byte -var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +var basePoint = [32]byte{9} func init() { Basepoint = basePoint[:] } -func checkBasepoint() { - if subtle.ConstantTimeCompare(Basepoint, []byte{ - 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }) != 1 { - panic("curve25519: global Basepoint value was modified") - } -} - // X25519 returns the result of the scalar multiplication (scalar * point), // according to RFC 7748, Section 5. scalar, point and the return value are // slices of 32 bytes. @@ -121,26 +57,3 @@ func X25519(scalar, point []byte) ([]byte, error) { var dst [32]byte return x25519(&dst, scalar, point) } - -func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { - var in [32]byte - if l := len(scalar); l != 32 { - return nil, errors.New("bad scalar length: " + strconv.Itoa(l) + ", expected 32") - } - if l := len(point); l != 32 { - return nil, errors.New("bad point length: " + strconv.Itoa(l) + ", expected 32") - } - copy(in[:], scalar) - if &point[0] == &Basepoint[0] { - checkBasepoint() - ScalarBaseMult(dst, &in) - } else { - var base, zero [32]byte - copy(base[:], point) - ScalarMult(dst, &in, &base) - if subtle.ConstantTimeCompare(dst[:], zero[:]) == 1 { - return nil, errors.New("bad input point: low order point") - } - } - return dst[:], nil -} diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_compat.go b/vendor/golang.org/x/crypto/curve25519/curve25519_compat.go new file mode 100644 index 00000000..ba647e8d --- /dev/null +++ b/vendor/golang.org/x/crypto/curve25519/curve25519_compat.go @@ -0,0 +1,105 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.20 + +package curve25519 + +import ( + "crypto/subtle" + "errors" + "strconv" + + "golang.org/x/crypto/curve25519/internal/field" +) + +func scalarMult(dst, scalar, point *[32]byte) { + var e [32]byte + + copy(e[:], scalar[:]) + e[0] &= 248 + e[31] &= 127 + e[31] |= 64 + + var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element + x1.SetBytes(point[:]) + x2.One() + x3.Set(&x1) + z3.One() + + swap := 0 + for pos := 254; pos >= 0; pos-- { + b := e[pos/8] >> uint(pos&7) + b &= 1 + swap ^= int(b) + x2.Swap(&x3, swap) + z2.Swap(&z3, swap) + swap = int(b) + + tmp0.Subtract(&x3, &z3) + tmp1.Subtract(&x2, &z2) + x2.Add(&x2, &z2) + z2.Add(&x3, &z3) + z3.Multiply(&tmp0, &x2) + z2.Multiply(&z2, &tmp1) + tmp0.Square(&tmp1) + tmp1.Square(&x2) + x3.Add(&z3, &z2) + z2.Subtract(&z3, &z2) + x2.Multiply(&tmp1, &tmp0) + tmp1.Subtract(&tmp1, &tmp0) + z2.Square(&z2) + + z3.Mult32(&tmp1, 121666) + x3.Square(&x3) + tmp0.Add(&tmp0, &z3) + z3.Multiply(&x1, &z2) + z2.Multiply(&tmp1, &tmp0) + } + + x2.Swap(&x3, swap) + z2.Swap(&z3, swap) + + z2.Invert(&z2) + x2.Multiply(&x2, &z2) + copy(dst[:], x2.Bytes()) +} + +func scalarBaseMult(dst, scalar *[32]byte) { + checkBasepoint() + scalarMult(dst, scalar, &basePoint) +} + +func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { + var in [32]byte + if l := len(scalar); l != 32 { + return nil, errors.New("bad scalar length: " + strconv.Itoa(l) + ", expected 32") + } + if l := len(point); l != 32 { + return nil, errors.New("bad point length: " + strconv.Itoa(l) + ", expected 32") + } + copy(in[:], scalar) + if &point[0] == &Basepoint[0] { + scalarBaseMult(dst, &in) + } else { + var base, zero [32]byte + copy(base[:], point) + scalarMult(dst, &in, &base) + if subtle.ConstantTimeCompare(dst[:], zero[:]) == 1 { + return nil, errors.New("bad input point: low order point") + } + } + return dst[:], nil +} + +func checkBasepoint() { + if subtle.ConstantTimeCompare(Basepoint, []byte{ + 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }) != 1 { + panic("curve25519: global Basepoint value was modified") + } +} diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_go120.go b/vendor/golang.org/x/crypto/curve25519/curve25519_go120.go new file mode 100644 index 00000000..627df497 --- /dev/null +++ b/vendor/golang.org/x/crypto/curve25519/curve25519_go120.go @@ -0,0 +1,46 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.20 + +package curve25519 + +import "crypto/ecdh" + +func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { + curve := ecdh.X25519() + pub, err := curve.NewPublicKey(point) + if err != nil { + return nil, err + } + priv, err := curve.NewPrivateKey(scalar) + if err != nil { + return nil, err + } + out, err := priv.ECDH(pub) + if err != nil { + return nil, err + } + copy(dst[:], out) + return dst[:], nil +} + +func scalarMult(dst, scalar, point *[32]byte) { + if _, err := x25519(dst, scalar[:], point[:]); err != nil { + // The only error condition for x25519 when the inputs are 32 bytes long + // is if the output would have been the all-zero value. + for i := range dst { + dst[i] = 0 + } + } +} + +func scalarBaseMult(dst, scalar *[32]byte) { + curve := ecdh.X25519() + priv, err := curve.NewPrivateKey(scalar[:]) + if err != nil { + panic("curve25519: internal error: scalarBaseMult was not 32 bytes") + } + copy(dst[:], priv.PublicKey().Bytes()) +} diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go index 184ac45f..c1f6b90d 100644 --- a/vendor/golang.org/x/net/http2/frame.go +++ b/vendor/golang.org/x/net/http2/frame.go @@ -662,6 +662,15 @@ func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error { // It is the caller's responsibility not to violate the maximum frame size // and to not call other Write methods concurrently. func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error { + if err := f.startWriteDataPadded(streamID, endStream, data, pad); err != nil { + return err + } + return f.endWrite() +} + +// startWriteDataPadded is WriteDataPadded, but only writes the frame to the Framer's internal buffer. +// The caller should call endWrite to flush the frame to the underlying writer. +func (f *Framer) startWriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error { if !validStreamID(streamID) && !f.AllowIllegalWrites { return errStreamID } @@ -691,7 +700,7 @@ func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []by } f.wbuf = append(f.wbuf, data...) f.wbuf = append(f.wbuf, pad...) - return f.endWrite() + return nil } // A SettingsFrame conveys configuration parameters that affect how diff --git a/vendor/golang.org/x/net/http2/hpack/hpack.go b/vendor/golang.org/x/net/http2/hpack/hpack.go index b184a277..7a1d9766 100644 --- a/vendor/golang.org/x/net/http2/hpack/hpack.go +++ b/vendor/golang.org/x/net/http2/hpack/hpack.go @@ -359,6 +359,7 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { var hf HeaderField wantStr := d.emitEnabled || it.indexed() + var undecodedName undecodedString if nameIdx > 0 { ihf, ok := d.at(nameIdx) if !ok { @@ -366,15 +367,27 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { } hf.Name = ihf.Name } else { - hf.Name, buf, err = d.readString(buf, wantStr) + undecodedName, buf, err = d.readString(buf) if err != nil { return err } } - hf.Value, buf, err = d.readString(buf, wantStr) + undecodedValue, buf, err := d.readString(buf) if err != nil { return err } + if wantStr { + if nameIdx <= 0 { + hf.Name, err = d.decodeString(undecodedName) + if err != nil { + return err + } + } + hf.Value, err = d.decodeString(undecodedValue) + if err != nil { + return err + } + } d.buf = buf if it.indexed() { d.dynTab.add(hf) @@ -459,46 +472,52 @@ func readVarInt(n byte, p []byte) (i uint64, remain []byte, err error) { return 0, origP, errNeedMore } -// readString decodes an hpack string from p. +// readString reads an hpack string from p. // -// wantStr is whether s will be used. If false, decompression and -// []byte->string garbage are skipped if s will be ignored -// anyway. This does mean that huffman decoding errors for non-indexed -// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server -// is returning an error anyway, and because they're not indexed, the error -// won't affect the decoding state. -func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain []byte, err error) { +// It returns a reference to the encoded string data to permit deferring decode costs +// until after the caller verifies all data is present. +func (d *Decoder) readString(p []byte) (u undecodedString, remain []byte, err error) { if len(p) == 0 { - return "", p, errNeedMore + return u, p, errNeedMore } isHuff := p[0]&128 != 0 strLen, p, err := readVarInt(7, p) if err != nil { - return "", p, err + return u, p, err } if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) { - return "", nil, ErrStringLength + // Returning an error here means Huffman decoding errors + // for non-indexed strings past the maximum string length + // are ignored, but the server is returning an error anyway + // and because the string is not indexed the error will not + // affect the decoding state. + return u, nil, ErrStringLength } if uint64(len(p)) < strLen { - return "", p, errNeedMore + return u, p, errNeedMore } - if !isHuff { - if wantStr { - s = string(p[:strLen]) - } - return s, p[strLen:], nil - } - - if wantStr { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() // don't trust others - defer bufPool.Put(buf) - if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err != nil { - buf.Reset() - return "", nil, err - } - s = buf.String() - buf.Reset() // be nice to GC - } - return s, p[strLen:], nil + u.isHuff = isHuff + u.b = p[:strLen] + return u, p[strLen:], nil +} + +type undecodedString struct { + isHuff bool + b []byte +} + +func (d *Decoder) decodeString(u undecodedString) (string, error) { + if !u.isHuff { + return string(u.b), nil + } + buf := bufPool.Get().(*bytes.Buffer) + buf.Reset() // don't trust others + var s string + err := huffmanDecode(buf, d.maxStrLen, u.b) + if err == nil { + s = buf.String() + } + buf.Reset() // be nice to GC + bufPool.Put(buf) + return s, err } diff --git a/vendor/golang.org/x/net/http2/pipe.go b/vendor/golang.org/x/net/http2/pipe.go index c15b8a77..684d984f 100644 --- a/vendor/golang.org/x/net/http2/pipe.go +++ b/vendor/golang.org/x/net/http2/pipe.go @@ -88,13 +88,9 @@ func (p *pipe) Write(d []byte) (n int, err error) { p.c.L = &p.mu } defer p.c.Signal() - if p.err != nil { + if p.err != nil || p.breakErr != nil { return 0, errClosedPipeWrite } - if p.breakErr != nil { - p.unread += len(d) - return len(d), nil // discard when there is no reader - } return p.b.Write(d) } diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 9bd7035b..cd057f39 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -843,8 +843,13 @@ type frameWriteResult struct { // and then reports when it's done. // At most one goroutine can be running writeFrameAsync at a time per // serverConn. -func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest) { - err := wr.write.writeFrame(sc) +func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest, wd *writeData) { + var err error + if wd == nil { + err = wr.write.writeFrame(sc) + } else { + err = sc.framer.endWrite() + } sc.wroteFrameCh <- frameWriteResult{wr: wr, err: err} } @@ -1251,9 +1256,16 @@ func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) { sc.writingFrameAsync = false err := wr.write.writeFrame(sc) sc.wroteFrame(frameWriteResult{wr: wr, err: err}) + } else if wd, ok := wr.write.(*writeData); ok { + // Encode the frame in the serve goroutine, to ensure we don't have + // any lingering asynchronous references to data passed to Write. + // See https://go.dev/issue/58446. + sc.framer.startWriteDataPadded(wd.streamID, wd.endStream, wd.p, nil) + sc.writingFrameAsync = true + go sc.writeFrameAsync(wr, wd) } else { sc.writingFrameAsync = true - go sc.writeFrameAsync(wr) + go sc.writeFrameAsync(wr, nil) } } @@ -1810,15 +1822,18 @@ func (sc *serverConn) processData(f *DataFrame) error { } if len(data) > 0 { + st.bodyBytes += int64(len(data)) wrote, err := st.body.Write(data) if err != nil { + // The handler has closed the request body. + // Return the connection-level flow control for the discarded data, + // but not the stream-level flow control. sc.sendWindowUpdate(nil, int(f.Length)-wrote) - return sc.countError("body_write_err", streamError(id, ErrCodeStreamClosed)) + return nil } if wrote != len(data) { panic("internal error: bad Writer") } - st.bodyBytes += int64(len(data)) } // Return any padded flow control now, since we won't diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 05ba23d3..f965579f 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -560,10 +560,11 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res traceGotConn(req, cc, reused) res, err := cc.RoundTrip(req) if err != nil && retry <= 6 { + roundTripErr := err if req, err = shouldRetryRequest(req, err); err == nil { // After the first retry, do exponential backoff with 10% jitter. if retry == 0 { - t.vlogf("RoundTrip retrying after failure: %v", err) + t.vlogf("RoundTrip retrying after failure: %v", roundTripErr) continue } backoff := float64(uint(1) << (uint(retry) - 1)) @@ -572,7 +573,7 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res timer := backoffNewTimer(d) select { case <-timer.C: - t.vlogf("RoundTrip retrying after failure: %v", err) + t.vlogf("RoundTrip retrying after failure: %v", roundTripErr) continue case <-req.Context().Done(): timer.Stop() @@ -2555,6 +2556,9 @@ func (b transportResponseBody) Close() error { cs := b.cs cc := cs.cc + cs.bufPipe.BreakWithError(errClosedResponseBody) + cs.abortStream(errClosedResponseBody) + unread := cs.bufPipe.Len() if unread > 0 { cc.mu.Lock() @@ -2573,9 +2577,6 @@ func (b transportResponseBody) Close() error { cc.wmu.Unlock() } - cs.bufPipe.BreakWithError(errClosedResponseBody) - cs.abortStream(errClosedResponseBody) - select { case <-cs.donec: case <-cs.ctx.Done(): diff --git a/vendor/golang.org/x/sys/unix/ioctl_signed.go b/vendor/golang.org/x/sys/unix/ioctl_signed.go new file mode 100644 index 00000000..7def9580 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ioctl_signed.go @@ -0,0 +1,70 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build aix || solaris +// +build aix solaris + +package unix + +import ( + "unsafe" +) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req int, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +// IoctlSetPointerInt performs an ioctl operation which sets an +// integer value on fd, using the specified request number. The ioctl +// argument is called with a pointer to the integer value, rather than +// passing the integer value directly. +func IoctlSetPointerInt(fd int, req int, value int) error { + v := int32(value) + return ioctlPtr(fd, req, unsafe.Pointer(&v)) +} + +// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. +// +// To change fd's window size, the req argument should be TIOCSWINSZ. +func IoctlSetWinsize(fd int, req int, value *Winsize) error { + // TODO: if we get the chance, remove the req parameter and + // hardcode TIOCSWINSZ. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} + +// IoctlSetTermios performs an ioctl on fd with a *Termios. +// +// The req value will usually be TCSETA or TIOCSETA. +func IoctlSetTermios(fd int, req int, value *Termios) error { + // TODO: if we get the chance, remove the req parameter. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +// +// A few ioctl requests use the return value as an output parameter; +// for those, IoctlRetInt should be used instead of this function. +func IoctlGetInt(fd int, req int) (int, error) { + var value int + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return value, err +} + +func IoctlGetWinsize(fd int, req int) (*Winsize, error) { + var value Winsize + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlGetTermios(fd int, req int) (*Termios, error) { + var value Termios + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return &value, err +} diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go similarity index 76% rename from vendor/golang.org/x/sys/unix/ioctl.go rename to vendor/golang.org/x/sys/unix/ioctl_unsigned.go index 1c51b0ec..649913d1 100644 --- a/vendor/golang.org/x/sys/unix/ioctl.go +++ b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris +//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd +// +build darwin dragonfly freebsd hurd linux netbsd openbsd package unix import ( - "runtime" "unsafe" ) @@ -27,7 +26,7 @@ func IoctlSetInt(fd int, req uint, value int) error { // passing the integer value directly. func IoctlSetPointerInt(fd int, req uint, value int) error { v := int32(value) - return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) + return ioctlPtr(fd, req, unsafe.Pointer(&v)) } // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. @@ -36,9 +35,7 @@ func IoctlSetPointerInt(fd int, req uint, value int) error { func IoctlSetWinsize(fd int, req uint, value *Winsize) error { // TODO: if we get the chance, remove the req parameter and // hardcode TIOCSWINSZ. - err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err + return ioctlPtr(fd, req, unsafe.Pointer(value)) } // IoctlSetTermios performs an ioctl on fd with a *Termios. @@ -46,9 +43,7 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error { // The req value will usually be TCSETA or TIOCSETA. func IoctlSetTermios(fd int, req uint, value *Termios) error { // TODO: if we get the chance, remove the req parameter. - err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err + return ioctlPtr(fd, req, unsafe.Pointer(value)) } // IoctlGetInt performs an ioctl operation which gets an integer value @@ -58,18 +53,18 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error { // for those, IoctlRetInt should be used instead of this function. func IoctlGetInt(fd int, req uint) (int, error) { var value int - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return value, err } func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { var value Winsize - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return &value, err } func IoctlGetTermios(fd int, req uint) (*Termios, error) { var value Termios - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return &value, err } diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go index 5384e7d9..cdc21bf7 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_zos.go +++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -17,25 +17,23 @@ import ( // IoctlSetInt performs an ioctl operation which sets an integer value // on fd, using the specified request number. -func IoctlSetInt(fd int, req uint, value int) error { +func IoctlSetInt(fd int, req int, value int) error { return ioctl(fd, req, uintptr(value)) } // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // // To change fd's window size, the req argument should be TIOCSWINSZ. -func IoctlSetWinsize(fd int, req uint, value *Winsize) error { +func IoctlSetWinsize(fd int, req int, value *Winsize) error { // TODO: if we get the chance, remove the req parameter and // hardcode TIOCSWINSZ. - err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err + return ioctlPtr(fd, req, unsafe.Pointer(value)) } // IoctlSetTermios performs an ioctl on fd with a *Termios. // // The req value is expected to be TCSETS, TCSETSW, or TCSETSF -func IoctlSetTermios(fd int, req uint, value *Termios) error { +func IoctlSetTermios(fd int, req int, value *Termios) error { if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) { return ENOSYS } @@ -49,22 +47,22 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error { // // A few ioctl requests use the return value as an output parameter; // for those, IoctlRetInt should be used instead of this function. -func IoctlGetInt(fd int, req uint) (int, error) { +func IoctlGetInt(fd int, req int) (int, error) { var value int - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return value, err } -func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { +func IoctlGetWinsize(fd int, req int) (*Winsize, error) { var value Winsize - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return &value, err } // IoctlGetTermios performs an ioctl on fd with a *Termios. // // The req value is expected to be TCGETS -func IoctlGetTermios(fd int, req uint) (*Termios, error) { +func IoctlGetTermios(fd int, req int) (*Termios, error) { var value Termios if req != TCGETS { return &value, ENOSYS diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 7456d9dd..2045d3da 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -66,6 +66,7 @@ includes_Darwin=' #include #include #include +#include #include #include #include @@ -521,6 +522,7 @@ ccflags="$@" $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ || $2 ~ /^RAW_PAYLOAD_/ || + $2 ~ /^[US]F_/ || $2 ~ /^TP_STATUS_/ || $2 ~ /^FALLOC_/ || $2 ~ /^ICMPV?6?_(FILTER|SEC)/ || diff --git a/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/vendor/golang.org/x/sys/unix/ptrace_darwin.go index 463c3eff..39dba6ca 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_darwin.go +++ b/vendor/golang.org/x/sys/unix/ptrace_darwin.go @@ -7,6 +7,12 @@ package unix +import "unsafe" + func ptrace(request int, pid int, addr uintptr, data uintptr) error { return ptrace1(request, pid, addr, data) } + +func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) error { + return ptrace1Ptr(request, pid, addr, data) +} diff --git a/vendor/golang.org/x/sys/unix/ptrace_ios.go b/vendor/golang.org/x/sys/unix/ptrace_ios.go index ed0509a0..9ea66330 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_ios.go +++ b/vendor/golang.org/x/sys/unix/ptrace_ios.go @@ -7,6 +7,12 @@ package unix +import "unsafe" + func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { return ENOTSUP } + +func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { + return ENOTSUP +} diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index 2db1b51e..c406ae00 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -292,9 +292,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { break } } - - bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] - sa.Name = string(bytes) + sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n)) return sa, nil case AF_INET: @@ -410,7 +408,8 @@ func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 } func (w WaitStatus) TrapCause() int { return -1 } -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctl(fd int, req int, arg uintptr) (err error) +//sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = ioctl // fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX // There is no way to create a custom fcntl and to keep //sys fcntl easily, diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index e92a0be1..f2871fa9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -8,7 +8,6 @@ package unix //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 16eed170..75718ec0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -8,7 +8,6 @@ package unix //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index eda42671..7705c327 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -245,8 +245,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { break } } - bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] - sa.Name = string(bytes) + sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n)) return sa, nil case AF_INET: diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 192b071b..20692150 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -14,7 +14,6 @@ package unix import ( "fmt" - "runtime" "syscall" "unsafe" ) @@ -376,11 +375,10 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) { func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) } //sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error { - err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo))) - runtime.KeepAlive(ctlInfo) - return err + return ioctlPtr(fd, CTLIOCGINFO, unsafe.Pointer(ctlInfo)) } // IfreqMTU is struct ifreq used to get or set a network device's MTU. @@ -394,16 +392,14 @@ type IfreqMTU struct { func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) { var ifreq IfreqMTU copy(ifreq.Name[:], ifname) - err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq))) + err := ioctlPtr(fd, SIOCGIFMTU, unsafe.Pointer(&ifreq)) return &ifreq, err } // IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU // of the network device specified by ifreq.Name. func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { - err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq))) - runtime.KeepAlive(ifreq) - return err + return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq)) } //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL @@ -617,6 +613,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { //sys Rmdir(path string) (err error) //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) +//sys Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) //sys Setegid(egid int) (err error) //sysnb Seteuid(euid int) (err error) //sysnb Setgid(gid int) (err error) @@ -626,7 +623,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { //sys Setprivexec(flag int) (err error) //sysnb Setregid(rgid int, egid int) (err error) //sysnb Setreuid(ruid int, euid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) @@ -680,7 +676,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { // Kqueue_from_portset_np // Kqueue_portset // Getattrlist -// Setattrlist // Getdirentriesattr // Searchfs // Delete diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index b37310ce..9fa87980 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -47,5 +47,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace +//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index d51ec996..f17b8c52 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -47,5 +47,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT //sys Lstat(path string, stat *Stat_t) (err error) //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace +//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, stat *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index a41111a7..d4ce988e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -172,6 +172,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { } //sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL @@ -325,7 +326,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sysnb Setreuid(ruid int, euid int) (err error) //sysnb Setresgid(rgid int, egid int, sgid int) (err error) //sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index d50b9dc2..afb10106 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -161,7 +161,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL +//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL @@ -253,6 +254,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } //sys ptrace(request int, pid int, addr uintptr, data int) (err error) +//sys ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) = SYS_PTRACE func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) @@ -267,19 +269,36 @@ func PtraceDetach(pid int) (err error) { } func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) { - return ptrace(PT_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0) + return ptracePtr(PT_GETFPREGS, pid, unsafe.Pointer(fpregsout), 0) } func PtraceGetRegs(pid int, regsout *Reg) (err error) { - return ptrace(PT_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0) + return ptracePtr(PT_GETREGS, pid, unsafe.Pointer(regsout), 0) +} + +func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { + ioDesc := PtraceIoDesc{ + Op: int32(req), + Offs: offs, + } + if countin > 0 { + _ = out[:countin] // check bounds + ioDesc.Addr = &out[0] + } else if out != nil { + ioDesc.Addr = (*byte)(unsafe.Pointer(&_zero)) + } + ioDesc.SetLen(countin) + + err = ptracePtr(PT_IO, pid, unsafe.Pointer(&ioDesc), 0) + return int(ioDesc.Len), err } func PtraceLwpEvents(pid int, enable int) (err error) { return ptrace(PT_LWP_EVENTS, pid, 0, enable) } -func PtraceLwpInfo(pid int, info uintptr) (err error) { - return ptrace(PT_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{}))) +func PtraceLwpInfo(pid int, info *PtraceLwpInfoStruct) (err error) { + return ptracePtr(PT_LWPINFO, pid, unsafe.Pointer(info), int(unsafe.Sizeof(*info))) } func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) { @@ -299,13 +318,25 @@ func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) { } func PtraceSetRegs(pid int, regs *Reg) (err error) { - return ptrace(PT_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0) + return ptracePtr(PT_SETREGS, pid, unsafe.Pointer(regs), 0) } func PtraceSingleStep(pid int) (err error) { return ptrace(PT_STEP, pid, 1, 0) } +func Dup3(oldfd, newfd, flags int) error { + if oldfd == newfd || flags&^O_CLOEXEC != 0 { + return EINVAL + } + how := F_DUP2FD + if flags&O_CLOEXEC != 0 { + how = F_DUP2FD_CLOEXEC + } + _, err := fcntl(oldfd, how, newfd) + return err +} + /* * Exposed directly */ @@ -402,7 +433,6 @@ func PtraceSingleStep(pid int) (err error) { //sysnb Setreuid(ruid int, euid int) (err error) //sysnb Setresgid(rgid int, egid int, sgid int) (err error) //sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index 6a91d471..b8da5100 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func (d *PtraceIoDesc) SetLen(length int) { + d.Len = uint32(length) +} + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { var writtenOut uint64 = 0 _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) @@ -57,16 +61,5 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func PtraceGetFsBase(pid int, fsbase *int64) (err error) { - return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) -} - -func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{ - Op: int32(req), - Offs: offs, - Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe. - Len: uint32(countin), - } - err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) - return int(ioDesc.Len), err + return ptracePtr(PT_GETFSBASE, pid, unsafe.Pointer(fsbase), 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index 48110a0a..47155c48 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func (d *PtraceIoDesc) SetLen(length int) { + d.Len = uint64(length) +} + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { var writtenOut uint64 = 0 _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) @@ -57,16 +61,5 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func PtraceGetFsBase(pid int, fsbase *int64) (err error) { - return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) -} - -func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{ - Op: int32(req), - Offs: offs, - Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe. - Len: uint64(countin), - } - err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) - return int(ioDesc.Len), err + return ptracePtr(PT_GETFSBASE, pid, unsafe.Pointer(fsbase), 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 52f1d4b7..08932093 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func (d *PtraceIoDesc) SetLen(length int) { + d.Len = uint32(length) +} + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { var writtenOut uint64 = 0 _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) @@ -55,14 +59,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{ - Op: int32(req), - Offs: offs, - Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe. - Len: uint32(countin), - } - err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) - return int(ioDesc.Len), err -} diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index 5537ee4f..d151a0d0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func (d *PtraceIoDesc) SetLen(length int) { + d.Len = uint64(length) +} + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { var writtenOut uint64 = 0 _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) @@ -55,14 +59,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{ - Op: int32(req), - Offs: offs, - Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe. - Len: uint64(countin), - } - err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) - return int(ioDesc.Len), err -} diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go index 164abd5d..d5cd64b3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go @@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func (d *PtraceIoDesc) SetLen(length int) { + d.Len = uint64(length) +} + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { var writtenOut uint64 = 0 _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) @@ -55,14 +59,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{ - Op: int32(req), - Offs: offs, - Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe. - Len: uint64(countin), - } - err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) - return int(ioDesc.Len), err -} diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go index 4ffb6480..381fd467 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -20,3 +20,11 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { } return } + +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(uintptr(arg))) + if r0 == -1 && er != nil { + err = er + } + return +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 5443dddd..fbaeb5ff 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1015,8 +1015,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { for n < len(pp.Path) && pp.Path[n] != 0 { n++ } - bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] - sa.Name = string(bytes) + sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n)) return sa, nil case AF_INET: @@ -1365,6 +1364,10 @@ func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o))) } +func SetsockoptTCPMD5Sig(fd, level, opt int, s *TCPMD5Sig) error { + return setsockopt(fd, level, opt, unsafe.Pointer(s), unsafe.Sizeof(*s)) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1579,6 +1582,7 @@ func BindToDevice(fd int, device string) (err error) { } //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) +//sys ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) = SYS_PTRACE func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) { // The peek requests are machine-size oriented, so we wrap it @@ -1596,7 +1600,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro // boundary. n := 0 if addr%SizeofPtr != 0 { - err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) + err = ptracePtr(req, pid, addr-addr%SizeofPtr, unsafe.Pointer(&buf[0])) if err != nil { return 0, err } @@ -1608,7 +1612,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro for len(out) > 0 { // We use an internal buffer to guarantee alignment. // It's not documented if this is necessary, but we're paranoid. - err = ptrace(req, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0]))) + err = ptracePtr(req, pid, addr+uintptr(n), unsafe.Pointer(&buf[0])) if err != nil { return n, err } @@ -1640,7 +1644,7 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c n := 0 if addr%SizeofPtr != 0 { var buf [SizeofPtr]byte - err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) + err = ptracePtr(peekReq, pid, addr-addr%SizeofPtr, unsafe.Pointer(&buf[0])) if err != nil { return 0, err } @@ -1667,7 +1671,7 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c // Trailing edge. if len(data) > 0 { var buf [SizeofPtr]byte - err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0]))) + err = ptracePtr(peekReq, pid, addr+uintptr(n), unsafe.Pointer(&buf[0])) if err != nil { return n, err } @@ -1696,11 +1700,11 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) { } func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) { - return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) + return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout)) } func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) { - return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) + return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs)) } func PtraceSetOptions(pid int, options int) (err error) { @@ -1709,7 +1713,7 @@ func PtraceSetOptions(pid int, options int) (err error) { func PtraceGetEventMsg(pid int) (msg uint, err error) { var data _C_long - err = ptrace(PTRACE_GETEVENTMSG, pid, 0, uintptr(unsafe.Pointer(&data))) + err = ptracePtr(PTRACE_GETEVENTMSG, pid, 0, unsafe.Pointer(&data)) msg = uint(data) return } @@ -1869,7 +1873,6 @@ func Getpgrp() (pid int) { //sys OpenTree(dfd int, fileName string, flags uint) (r int, err error) //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT -//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 //sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) @@ -1883,6 +1886,15 @@ func Getpgrp() (pid int) { //sysnb Settimeofday(tv *Timeval) (err error) //sys Setns(fd int, nstype int) (err error) +//go:linkname syscall_prlimit syscall.prlimit +func syscall_prlimit(pid, resource int, newlimit, old *syscall.Rlimit) error + +func Prlimit(pid, resource int, newlimit, old *Rlimit) error { + // Just call the syscall version, because as of Go 1.21 + // it will affect starting a new process. + return syscall_prlimit(pid, resource, (*syscall.Rlimit)(newlimit), (*syscall.Rlimit)(old)) +} + // PrctlRetInt performs a prctl operation specified by option and further // optional arguments arg2 through arg5 depending on option. It returns a // non-negative integer that is returned by the prctl syscall. @@ -2154,6 +2166,14 @@ func isGroupMember(gid int) bool { return false } +func isCapDacOverrideSet() bool { + hdr := CapUserHeader{Version: LINUX_CAPABILITY_VERSION_3} + data := [2]CapUserData{} + err := Capget(&hdr, &data[0]) + + return err == nil && data[0].Effective&(1< 0 { + _p1 = unsafe.Pointer(&attrBuf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(attrlist)), uintptr(_p1), uintptr(len(attrBuf)), uintptr(options), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setattrlist_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setegid(egid int) (err error) { _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { @@ -2115,20 +2148,6 @@ var libc_setreuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) @@ -2502,6 +2521,14 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { return } +func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ptrace_trampoline_addr uintptr //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 95fe4c0e..4baaed0b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -705,6 +705,11 @@ TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setattrlist(SB) +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) @@ -759,12 +764,6 @@ TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) - -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 26a0fdc5..51d6f3fb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -725,6 +725,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" @@ -1984,6 +1992,31 @@ var libc_select_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(attrBuf) > 0 { + _p1 = unsafe.Pointer(&attrBuf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(attrlist)), uintptr(_p1), uintptr(len(attrBuf)), uintptr(options), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setattrlist_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setegid(egid int) (err error) { _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { @@ -2115,20 +2148,6 @@ var libc_setreuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) @@ -2502,6 +2521,14 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { return } +func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ptrace_trampoline_addr uintptr //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index efa5b4c9..c3b82c03 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -705,6 +705,11 @@ TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setattrlist(SB) +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) @@ -759,12 +764,6 @@ TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) - -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 54749f9c..0eabac7a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -436,6 +436,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -1400,16 +1410,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 77479d45..ee313eb0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 2e966d4d..4c986e44 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index d65a7c0f..55521694 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index 6f0b97c6..67a226fb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go index e1c23b52..f0b9ddaa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 36ea3a55..da63d9d7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -379,6 +379,16 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(arg) @@ -1336,16 +1346,6 @@ func PivotRoot(newroot string, putold string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { - _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index c81b0ad4..07b549cc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -411,16 +411,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 2206bce7..5f481bf8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -334,16 +334,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index edf6b39f..824cd52c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -578,16 +578,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 190609f2..e77aecfe 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -289,16 +289,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 5f984cbb..961a3afb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -644,16 +644,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Alarm(seconds uint) (remaining uint, err error) { r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0) remaining = uint(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 46fc380a..ed05005e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -278,16 +278,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index cbd0d4da..d365b718 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -278,16 +278,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 0c13d15f..c3f1b8bb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -644,16 +644,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Alarm(seconds uint) (remaining uint, err error) { r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0) remaining = uint(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index e01432ae..a6574cf9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -624,16 +624,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off>>32), uintptr(off), uintptr(n>>32), uintptr(n)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 13c7ee7b..f4099026 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -349,16 +349,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 02d0c0fd..9dfcc299 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -349,16 +349,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 9fee3b1d..0b292395 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -269,16 +269,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 647bbfec..6cde3223 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -319,16 +319,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int64(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index ada057f8..5253d65b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -329,16 +329,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 79f73899..cdb2af5a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -405,6 +405,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -1597,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index fb161f3a..9d25f76b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -405,6 +405,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -1597,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 4c8ac993..d3f80351 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -405,6 +405,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -1597,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 76dd8ec4..887188a5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -405,6 +405,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { @@ -1597,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index caeb807b..6699a783 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 08744425..04f0de34 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $4 DATA ·libc_setresuid_trampoline_addr(SB)/4, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $4 -DATA ·libc_setrlimit_trampoline_addr(SB)/4, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index a05e5f4f..1e775fe0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 5782cd10..27b6f4df 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index b2da8e50..7f642789 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index cf310420..b797045f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $4 DATA ·libc_setresuid_trampoline_addr(SB)/4, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $4 -DATA ·libc_setrlimit_trampoline_addr(SB)/4, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 048b2655..756ef7b1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index 484bb42e..a8712662 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index 6f33e37e..7bc2e24e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index 55af2726..05d4bffd 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 330cf7f7..739be621 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 4028255b..74a25f8d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -687,12 +687,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - CALL libc_setrlimit(SB) - RET -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_setrtable(SB) RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 5f24de0d..7d95a197 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -527,6 +527,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" @@ -1886,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index e1fbd4df..990be245 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 78d4a424..609d1c59 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -110,7 +110,6 @@ import ( //go:cgo_import_dynamic libc_setpriority setpriority "libc.so" //go:cgo_import_dynamic libc_setregid setregid "libc.so" //go:cgo_import_dynamic libc_setreuid setreuid "libc.so" -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" //go:cgo_import_dynamic libc_setsid setsid "libc.so" //go:cgo_import_dynamic libc_setuid setuid "libc.so" //go:cgo_import_dynamic libc_shutdown shutdown "libsocket.so" @@ -250,7 +249,6 @@ import ( //go:linkname procSetpriority libc_setpriority //go:linkname procSetregid libc_setregid //go:linkname procSetreuid libc_setreuid -//go:linkname procSetrlimit libc_setrlimit //go:linkname procSetsid libc_setsid //go:linkname procSetuid libc_setuid //go:linkname procshutdown libc_shutdown @@ -391,7 +389,6 @@ var ( procSetpriority, procSetregid, procSetreuid, - procSetrlimit, procSetsid, procSetuid, procshutdown, @@ -646,7 +643,18 @@ func __minor(version int, dev uint64) (val uint) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) { +func ioctlRet(fd int, req int, arg uintptr) (ret int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) + ret = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctlPtrRet(fd int, req int, arg unsafe.Pointer) (ret int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) ret = int(r0) if e1 != 0 { @@ -1639,16 +1647,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go index f2079457..c3168174 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -257,7 +257,17 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { +func ioctl(fd int, req int, arg uintptr) (err error) { + _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index e2a64f09..690cefc3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -151,6 +151,16 @@ type Dirent struct { _ [3]byte } +type Attrlist struct { + Bitmapcount uint16 + Reserved uint16 + Commonattr uint32 + Volattr uint32 + Dirattr uint32 + Fileattr uint32 + Forkattr uint32 +} + const ( PathMax = 0x400 ) @@ -610,6 +620,7 @@ const ( AT_REMOVEDIR = 0x80 AT_SYMLINK_FOLLOW = 0x40 AT_SYMLINK_NOFOLLOW = 0x20 + AT_EACCESS = 0x10 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 34aa7752..5bffc10e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -151,6 +151,16 @@ type Dirent struct { _ [3]byte } +type Attrlist struct { + Bitmapcount uint16 + Reserved uint16 + Commonattr uint32 + Volattr uint32 + Dirattr uint32 + Fileattr uint32 + Forkattr uint32 +} + const ( PathMax = 0x400 ) @@ -610,6 +620,7 @@ const ( AT_REMOVEDIR = 0x80 AT_SYMLINK_FOLLOW = 0x40 AT_SYMLINK_NOFOLLOW = 0x20 + AT_EACCESS = 0x10 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index d9c78cdc..29dc4833 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -362,7 +362,7 @@ type FpExtendedPrecision struct{} type PtraceIoDesc struct { Op int32 Offs uintptr - Addr uintptr + Addr *byte Len uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 26991b16..0a89b289 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -367,7 +367,7 @@ type FpExtendedPrecision struct{} type PtraceIoDesc struct { Op int32 Offs uintptr - Addr uintptr + Addr *byte Len uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index f8324e7e..c8666bb1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -350,7 +350,7 @@ type FpExtendedPrecision struct { type PtraceIoDesc struct { Op int32 Offs uintptr - Addr uintptr + Addr *byte Len uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 4220411f..88fb48a8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -347,7 +347,7 @@ type FpExtendedPrecision struct{} type PtraceIoDesc struct { Op int32 Offs uintptr - Addr uintptr + Addr *byte Len uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go index 0660fd45..698dc975 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -348,7 +348,7 @@ type FpExtendedPrecision struct{} type PtraceIoDesc struct { Op int32 Offs uintptr - Addr uintptr + Addr *byte Len uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 7d9fc8f1..ca84727c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -456,36 +456,60 @@ type Ucred struct { } type TCPInfo struct { - State uint8 - Ca_state uint8 - Retransmits uint8 - Probes uint8 - Backoff uint8 - Options uint8 - Rto uint32 - Ato uint32 - Snd_mss uint32 - Rcv_mss uint32 - Unacked uint32 - Sacked uint32 - Lost uint32 - Retrans uint32 - Fackets uint32 - Last_data_sent uint32 - Last_ack_sent uint32 - Last_data_recv uint32 - Last_ack_recv uint32 - Pmtu uint32 - Rcv_ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Snd_ssthresh uint32 - Snd_cwnd uint32 - Advmss uint32 - Reordering uint32 - Rcv_rtt uint32 - Rcv_space uint32 - Total_retrans uint32 + State uint8 + Ca_state uint8 + Retransmits uint8 + Probes uint8 + Backoff uint8 + Options uint8 + Rto uint32 + Ato uint32 + Snd_mss uint32 + Rcv_mss uint32 + Unacked uint32 + Sacked uint32 + Lost uint32 + Retrans uint32 + Fackets uint32 + Last_data_sent uint32 + Last_ack_sent uint32 + Last_data_recv uint32 + Last_ack_recv uint32 + Pmtu uint32 + Rcv_ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Advmss uint32 + Reordering uint32 + Rcv_rtt uint32 + Rcv_space uint32 + Total_retrans uint32 + Pacing_rate uint64 + Max_pacing_rate uint64 + Bytes_acked uint64 + Bytes_received uint64 + Segs_out uint32 + Segs_in uint32 + Notsent_bytes uint32 + Min_rtt uint32 + Data_segs_in uint32 + Data_segs_out uint32 + Delivery_rate uint64 + Busy_time uint64 + Rwnd_limited uint64 + Sndbuf_limited uint64 + Delivered uint32 + Delivered_ce uint32 + Bytes_sent uint64 + Bytes_retrans uint64 + Dsack_dups uint32 + Reord_seen uint32 + Rcv_ooopack uint32 + Snd_wnd uint32 + Rcv_wnd uint32 + Rehash uint32 } type CanFilter struct { @@ -528,7 +552,7 @@ const ( SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc - SizeofTCPInfo = 0x68 + SizeofTCPInfo = 0xf0 SizeofCanFilter = 0x8 SizeofTCPRepairOpt = 0x8 ) @@ -1043,6 +1067,7 @@ const ( PerfBitCommExec = CBitFieldMaskBit24 PerfBitUseClockID = CBitFieldMaskBit25 PerfBitContextSwitch = CBitFieldMaskBit26 + PerfBitWriteBackward = CBitFieldMaskBit27 ) const ( @@ -1239,7 +1264,7 @@ type TCPMD5Sig struct { Flags uint8 Prefixlen uint8 Keylen uint16 - _ uint32 + Ifindex int32 Key [80]uint8 } @@ -1939,7 +1964,11 @@ const ( NFT_MSG_GETOBJ = 0x13 NFT_MSG_DELOBJ = 0x14 NFT_MSG_GETOBJ_RESET = 0x15 - NFT_MSG_MAX = 0x19 + NFT_MSG_NEWFLOWTABLE = 0x16 + NFT_MSG_GETFLOWTABLE = 0x17 + NFT_MSG_DELFLOWTABLE = 0x18 + NFT_MSG_GETRULE_RESET = 0x19 + NFT_MSG_MAX = 0x1a NFTA_LIST_UNSPEC = 0x0 NFTA_LIST_ELEM = 0x1 NFTA_HOOK_UNSPEC = 0x0 @@ -2443,9 +2472,11 @@ const ( SOF_TIMESTAMPING_OPT_STATS = 0x1000 SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 + SOF_TIMESTAMPING_BIND_PHC = 0x8000 + SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000 - SOF_TIMESTAMPING_LAST = 0x8000 - SOF_TIMESTAMPING_MASK = 0xffff + SOF_TIMESTAMPING_LAST = 0x10000 + SOF_TIMESTAMPING_MASK = 0x1ffff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 @@ -3265,7 +3296,7 @@ const ( DEVLINK_ATTR_LINECARD_SUPPORTED_TYPES = 0xae DEVLINK_ATTR_NESTED_DEVLINK = 0xaf DEVLINK_ATTR_SELFTESTS = 0xb0 - DEVLINK_ATTR_MAX = 0xb0 + DEVLINK_ATTR_MAX = 0xb3 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 @@ -3281,7 +3312,8 @@ const ( DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR = 0x1 DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x3 + DEVLINK_PORT_FN_ATTR_CAPS = 0x4 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x4 ) type FsverityDigest struct { @@ -3572,7 +3604,8 @@ const ( ETHTOOL_MSG_MODULE_SET = 0x23 ETHTOOL_MSG_PSE_GET = 0x24 ETHTOOL_MSG_PSE_SET = 0x25 - ETHTOOL_MSG_USER_MAX = 0x25 + ETHTOOL_MSG_RSS_GET = 0x26 + ETHTOOL_MSG_USER_MAX = 0x26 ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3611,7 +3644,8 @@ const ( ETHTOOL_MSG_MODULE_GET_REPLY = 0x23 ETHTOOL_MSG_MODULE_NTF = 0x24 ETHTOOL_MSG_PSE_GET_REPLY = 0x25 - ETHTOOL_MSG_KERNEL_MAX = 0x25 + ETHTOOL_MSG_RSS_GET_REPLY = 0x26 + ETHTOOL_MSG_KERNEL_MAX = 0x26 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3679,7 +3713,8 @@ const ( ETHTOOL_A_LINKSTATE_SQI_MAX = 0x4 ETHTOOL_A_LINKSTATE_EXT_STATE = 0x5 ETHTOOL_A_LINKSTATE_EXT_SUBSTATE = 0x6 - ETHTOOL_A_LINKSTATE_MAX = 0x6 + ETHTOOL_A_LINKSTATE_EXT_DOWN_CNT = 0x7 + ETHTOOL_A_LINKSTATE_MAX = 0x7 ETHTOOL_A_DEBUG_UNSPEC = 0x0 ETHTOOL_A_DEBUG_HEADER = 0x1 ETHTOOL_A_DEBUG_MSGMASK = 0x2 @@ -4409,7 +4444,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x140 + NL80211_ATTR_MAX = 0x141 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_MATCH_SETS = 0x85 @@ -4552,6 +4587,7 @@ const ( NL80211_ATTR_SUPPORT_MESH_AUTH = 0x73 NL80211_ATTR_SURVEY_INFO = 0x54 NL80211_ATTR_SURVEY_RADIO_STATS = 0xda + NL80211_ATTR_TD_BITMAP = 0x141 NL80211_ATTR_TDLS_ACTION = 0x88 NL80211_ATTR_TDLS_DIALOG_TOKEN = 0x89 NL80211_ATTR_TDLS_EXTERNAL_SETUP = 0x8c @@ -5752,3 +5788,25 @@ const ( AUDIT_NLGRP_NONE = 0x0 AUDIT_NLGRP_READLOG = 0x1 ) + +const ( + TUN_F_CSUM = 0x1 + TUN_F_TSO4 = 0x2 + TUN_F_TSO6 = 0x4 + TUN_F_TSO_ECN = 0x8 + TUN_F_UFO = 0x10 +) + +const ( + VIRTIO_NET_HDR_F_NEEDS_CSUM = 0x1 + VIRTIO_NET_HDR_F_DATA_VALID = 0x2 + VIRTIO_NET_HDR_F_RSC_INFO = 0x4 +) + +const ( + VIRTIO_NET_HDR_GSO_NONE = 0x0 + VIRTIO_NET_HDR_GSO_TCPV4 = 0x1 + VIRTIO_NET_HDR_GSO_UDP = 0x3 + VIRTIO_NET_HDR_GSO_TCPV6 = 0x4 + VIRTIO_NET_HDR_GSO_ECN = 0x80 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 89c516a2..4ecc1495 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -414,7 +414,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]int8 + Data [122]byte _ uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 62b4fb26..34fddff9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -427,7 +427,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index e86b3589..3b14a603 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -405,7 +405,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]uint8 + Data [122]byte _ uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 6c6be4c9..0517651a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -406,7 +406,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index 4982ea35..3b0c5181 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -407,7 +407,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 173141a6..fccdf4dd 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -410,7 +410,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]int8 + Data [122]byte _ uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 93ae4c51..500de8fc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -409,7 +409,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 4e4e510c..d0434cd2 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -409,7 +409,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 3f5ba013..84206ba5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -410,7 +410,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]int8 + Data [122]byte _ uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 71dfe7cd..ab078cf1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -417,7 +417,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]uint8 + Data [122]byte _ uint32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 3a2b7f0a..42eb2c4c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -416,7 +416,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]uint8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index a52d6275..31304a4e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -416,7 +416,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]uint8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index dfc007d8..c311f961 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -434,7 +434,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]uint8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index b53cb910..bba3cefa 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -429,7 +429,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index fe0aa354..ad8a0138 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -411,7 +411,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 41cb3c01..3723b2c2 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -824,6 +824,9 @@ const socket_error = uintptr(^uint32(0)) //sys WSAStartup(verreq uint32, data *WSAData) (sockerr error) = ws2_32.WSAStartup //sys WSACleanup() (err error) [failretval==socket_error] = ws2_32.WSACleanup //sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) [failretval==socket_error] = ws2_32.WSAIoctl +//sys WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) [failretval==socket_error] = ws2_32.WSALookupServiceBeginW +//sys WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) [failretval==socket_error] = ws2_32.WSALookupServiceNextW +//sys WSALookupServiceEnd(handle Handle) (err error) [failretval==socket_error] = ws2_32.WSALookupServiceEnd //sys socket(af int32, typ int32, protocol int32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.socket //sys sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) [failretval==socket_error] = ws2_32.sendto //sys recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) [failretval==-1] = ws2_32.recvfrom @@ -1019,8 +1022,7 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { for n < len(pp.Path) && pp.Path[n] != 0 { n++ } - bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] - sa.Name = string(bytes) + sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n)) return sa, nil case AF_INET: diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 0c4add97..0dbb2084 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -1243,6 +1243,51 @@ const ( DnsSectionAdditional = 0x0003 ) +const ( + // flags of WSALookupService + LUP_DEEP = 0x0001 + LUP_CONTAINERS = 0x0002 + LUP_NOCONTAINERS = 0x0004 + LUP_NEAREST = 0x0008 + LUP_RETURN_NAME = 0x0010 + LUP_RETURN_TYPE = 0x0020 + LUP_RETURN_VERSION = 0x0040 + LUP_RETURN_COMMENT = 0x0080 + LUP_RETURN_ADDR = 0x0100 + LUP_RETURN_BLOB = 0x0200 + LUP_RETURN_ALIASES = 0x0400 + LUP_RETURN_QUERY_STRING = 0x0800 + LUP_RETURN_ALL = 0x0FF0 + LUP_RES_SERVICE = 0x8000 + + LUP_FLUSHCACHE = 0x1000 + LUP_FLUSHPREVIOUS = 0x2000 + + LUP_NON_AUTHORITATIVE = 0x4000 + LUP_SECURE = 0x8000 + LUP_RETURN_PREFERRED_NAMES = 0x10000 + LUP_DNS_ONLY = 0x20000 + + LUP_ADDRCONFIG = 0x100000 + LUP_DUAL_ADDR = 0x200000 + LUP_FILESERVER = 0x400000 + LUP_DISABLE_IDN_ENCODING = 0x00800000 + LUP_API_ANSI = 0x01000000 + + LUP_RESOLUTION_HANDLE = 0x80000000 +) + +const ( + // values of WSAQUERYSET's namespace + NS_ALL = 0 + NS_DNS = 12 + NS_NLA = 15 + NS_BTH = 16 + NS_EMAIL = 37 + NS_PNRPNAME = 38 + NS_PNRPCLOUD = 39 +) + type DNSSRVData struct { Target *uint16 Priority uint16 @@ -2184,10 +2229,10 @@ const ( JobObjectExtendedLimitInformation = 9 JobObjectGroupInformation = 11 JobObjectGroupInformationEx = 14 - JobObjectLimitViolationInformation2 = 35 + JobObjectLimitViolationInformation2 = 34 JobObjectNetRateControlInformation = 32 JobObjectNotificationLimitInformation = 12 - JobObjectNotificationLimitInformation2 = 34 + JobObjectNotificationLimitInformation2 = 33 JobObjectSecurityLimitInformation = 5 ) @@ -3258,3 +3303,43 @@ const ( DWMWA_TEXT_COLOR = 36 DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37 ) + +type WSAQUERYSET struct { + Size uint32 + ServiceInstanceName *uint16 + ServiceClassId *GUID + Version *WSAVersion + Comment *uint16 + NameSpace uint32 + NSProviderId *GUID + Context *uint16 + NumberOfProtocols uint32 + AfpProtocols *AFProtocols + QueryString *uint16 + NumberOfCsAddrs uint32 + SaBuffer *CSAddrInfo + OutputFlags uint32 + Blob *BLOB +} + +type WSAVersion struct { + Version uint32 + EnumerationOfComparison int32 +} + +type AFProtocols struct { + AddressFamily int32 + Protocol int32 +} + +type CSAddrInfo struct { + LocalAddr SocketAddress + RemoteAddr SocketAddress + SocketType int32 + Protocol int32 +} + +type BLOB struct { + Size uint32 + BlobData *byte +} diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index ac60052e..6d2a2685 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -474,6 +474,9 @@ var ( procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW") procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult") procWSAIoctl = modws2_32.NewProc("WSAIoctl") + procWSALookupServiceBeginW = modws2_32.NewProc("WSALookupServiceBeginW") + procWSALookupServiceEnd = modws2_32.NewProc("WSALookupServiceEnd") + procWSALookupServiceNextW = modws2_32.NewProc("WSALookupServiceNextW") procWSARecv = modws2_32.NewProc("WSARecv") procWSARecvFrom = modws2_32.NewProc("WSARecvFrom") procWSASend = modws2_32.NewProc("WSASend") @@ -4067,6 +4070,30 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo return } +func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) { + r1, _, e1 := syscall.Syscall(procWSALookupServiceBeginW.Addr(), 3, uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSALookupServiceEnd(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procWSALookupServiceEnd.Addr(), 1, uintptr(handle), 0, 0) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + +func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) { + r1, _, e1 := syscall.Syscall6(procWSALookupServiceNextW.Addr(), 4, uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet)), 0, 0) + if r1 == socket_error { + err = errnoErr(e1) + } + return +} + func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if r1 == socket_error { diff --git a/vendor/golang.org/x/text/encoding/encoding.go b/vendor/golang.org/x/text/encoding/encoding.go new file mode 100644 index 00000000..a0bd7cd4 --- /dev/null +++ b/vendor/golang.org/x/text/encoding/encoding.go @@ -0,0 +1,335 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package encoding defines an interface for character encodings, such as Shift +// JIS and Windows 1252, that can convert to and from UTF-8. +// +// Encoding implementations are provided in other packages, such as +// golang.org/x/text/encoding/charmap and +// golang.org/x/text/encoding/japanese. +package encoding // import "golang.org/x/text/encoding" + +import ( + "errors" + "io" + "strconv" + "unicode/utf8" + + "golang.org/x/text/encoding/internal/identifier" + "golang.org/x/text/transform" +) + +// TODO: +// - There seems to be some inconsistency in when decoders return errors +// and when not. Also documentation seems to suggest they shouldn't return +// errors at all (except for UTF-16). +// - Encoders seem to rely on or at least benefit from the input being in NFC +// normal form. Perhaps add an example how users could prepare their output. + +// Encoding is a character set encoding that can be transformed to and from +// UTF-8. +type Encoding interface { + // NewDecoder returns a Decoder. + NewDecoder() *Decoder + + // NewEncoder returns an Encoder. + NewEncoder() *Encoder +} + +// A Decoder converts bytes to UTF-8. It implements transform.Transformer. +// +// Transforming source bytes that are not of that encoding will not result in an +// error per se. Each byte that cannot be transcoded will be represented in the +// output by the UTF-8 encoding of '\uFFFD', the replacement rune. +type Decoder struct { + transform.Transformer + + // This forces external creators of Decoders to use names in struct + // initializers, allowing for future extendibility without having to break + // code. + _ struct{} +} + +// Bytes converts the given encoded bytes to UTF-8. It returns the converted +// bytes or nil, err if any error occurred. +func (d *Decoder) Bytes(b []byte) ([]byte, error) { + b, _, err := transform.Bytes(d, b) + if err != nil { + return nil, err + } + return b, nil +} + +// String converts the given encoded string to UTF-8. It returns the converted +// string or "", err if any error occurred. +func (d *Decoder) String(s string) (string, error) { + s, _, err := transform.String(d, s) + if err != nil { + return "", err + } + return s, nil +} + +// Reader wraps another Reader to decode its bytes. +// +// The Decoder may not be used for any other operation as long as the returned +// Reader is in use. +func (d *Decoder) Reader(r io.Reader) io.Reader { + return transform.NewReader(r, d) +} + +// An Encoder converts bytes from UTF-8. It implements transform.Transformer. +// +// Each rune that cannot be transcoded will result in an error. In this case, +// the transform will consume all source byte up to, not including the offending +// rune. Transforming source bytes that are not valid UTF-8 will be replaced by +// `\uFFFD`. To return early with an error instead, use transform.Chain to +// preprocess the data with a UTF8Validator. +type Encoder struct { + transform.Transformer + + // This forces external creators of Encoders to use names in struct + // initializers, allowing for future extendibility without having to break + // code. + _ struct{} +} + +// Bytes converts bytes from UTF-8. It returns the converted bytes or nil, err if +// any error occurred. +func (e *Encoder) Bytes(b []byte) ([]byte, error) { + b, _, err := transform.Bytes(e, b) + if err != nil { + return nil, err + } + return b, nil +} + +// String converts a string from UTF-8. It returns the converted string or +// "", err if any error occurred. +func (e *Encoder) String(s string) (string, error) { + s, _, err := transform.String(e, s) + if err != nil { + return "", err + } + return s, nil +} + +// Writer wraps another Writer to encode its UTF-8 output. +// +// The Encoder may not be used for any other operation as long as the returned +// Writer is in use. +func (e *Encoder) Writer(w io.Writer) io.Writer { + return transform.NewWriter(w, e) +} + +// ASCIISub is the ASCII substitute character, as recommended by +// https://unicode.org/reports/tr36/#Text_Comparison +const ASCIISub = '\x1a' + +// Nop is the nop encoding. Its transformed bytes are the same as the source +// bytes; it does not replace invalid UTF-8 sequences. +var Nop Encoding = nop{} + +type nop struct{} + +func (nop) NewDecoder() *Decoder { + return &Decoder{Transformer: transform.Nop} +} +func (nop) NewEncoder() *Encoder { + return &Encoder{Transformer: transform.Nop} +} + +// Replacement is the replacement encoding. Decoding from the replacement +// encoding yields a single '\uFFFD' replacement rune. Encoding from UTF-8 to +// the replacement encoding yields the same as the source bytes except that +// invalid UTF-8 is converted to '\uFFFD'. +// +// It is defined at http://encoding.spec.whatwg.org/#replacement +var Replacement Encoding = replacement{} + +type replacement struct{} + +func (replacement) NewDecoder() *Decoder { + return &Decoder{Transformer: replacementDecoder{}} +} + +func (replacement) NewEncoder() *Encoder { + return &Encoder{Transformer: replacementEncoder{}} +} + +func (replacement) ID() (mib identifier.MIB, other string) { + return identifier.Replacement, "" +} + +type replacementDecoder struct{ transform.NopResetter } + +func (replacementDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + if len(dst) < 3 { + return 0, 0, transform.ErrShortDst + } + if atEOF { + const fffd = "\ufffd" + dst[0] = fffd[0] + dst[1] = fffd[1] + dst[2] = fffd[2] + nDst = 3 + } + return nDst, len(src), nil +} + +type replacementEncoder struct{ transform.NopResetter } + +func (replacementEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + r, size := rune(0), 0 + + for ; nSrc < len(src); nSrc += size { + r = rune(src[nSrc]) + + // Decode a 1-byte rune. + if r < utf8.RuneSelf { + size = 1 + + } else { + // Decode a multi-byte rune. + r, size = utf8.DecodeRune(src[nSrc:]) + if size == 1 { + // All valid runes of size 1 (those below utf8.RuneSelf) were + // handled above. We have invalid UTF-8 or we haven't seen the + // full character yet. + if !atEOF && !utf8.FullRune(src[nSrc:]) { + err = transform.ErrShortSrc + break + } + r = '\ufffd' + } + } + + if nDst+utf8.RuneLen(r) > len(dst) { + err = transform.ErrShortDst + break + } + nDst += utf8.EncodeRune(dst[nDst:], r) + } + return nDst, nSrc, err +} + +// HTMLEscapeUnsupported wraps encoders to replace source runes outside the +// repertoire of the destination encoding with HTML escape sequences. +// +// This wrapper exists to comply to URL and HTML forms requiring a +// non-terminating legacy encoder. The produced sequences may lead to data +// loss as they are indistinguishable from legitimate input. To avoid this +// issue, use UTF-8 encodings whenever possible. +func HTMLEscapeUnsupported(e *Encoder) *Encoder { + return &Encoder{Transformer: &errorHandler{e, errorToHTML}} +} + +// ReplaceUnsupported wraps encoders to replace source runes outside the +// repertoire of the destination encoding with an encoding-specific +// replacement. +// +// This wrapper is only provided for backwards compatibility and legacy +// handling. Its use is strongly discouraged. Use UTF-8 whenever possible. +func ReplaceUnsupported(e *Encoder) *Encoder { + return &Encoder{Transformer: &errorHandler{e, errorToReplacement}} +} + +type errorHandler struct { + *Encoder + handler func(dst []byte, r rune, err repertoireError) (n int, ok bool) +} + +// TODO: consider making this error public in some form. +type repertoireError interface { + Replacement() byte +} + +func (h errorHandler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + nDst, nSrc, err = h.Transformer.Transform(dst, src, atEOF) + for err != nil { + rerr, ok := err.(repertoireError) + if !ok { + return nDst, nSrc, err + } + r, sz := utf8.DecodeRune(src[nSrc:]) + n, ok := h.handler(dst[nDst:], r, rerr) + if !ok { + return nDst, nSrc, transform.ErrShortDst + } + err = nil + nDst += n + if nSrc += sz; nSrc < len(src) { + var dn, sn int + dn, sn, err = h.Transformer.Transform(dst[nDst:], src[nSrc:], atEOF) + nDst += dn + nSrc += sn + } + } + return nDst, nSrc, err +} + +func errorToHTML(dst []byte, r rune, err repertoireError) (n int, ok bool) { + buf := [8]byte{} + b := strconv.AppendUint(buf[:0], uint64(r), 10) + if n = len(b) + len("&#;"); n >= len(dst) { + return 0, false + } + dst[0] = '&' + dst[1] = '#' + dst[copy(dst[2:], b)+2] = ';' + return n, true +} + +func errorToReplacement(dst []byte, r rune, err repertoireError) (n int, ok bool) { + if len(dst) == 0 { + return 0, false + } + dst[0] = err.Replacement() + return 1, true +} + +// ErrInvalidUTF8 means that a transformer encountered invalid UTF-8. +var ErrInvalidUTF8 = errors.New("encoding: invalid UTF-8") + +// UTF8Validator is a transformer that returns ErrInvalidUTF8 on the first +// input byte that is not valid UTF-8. +var UTF8Validator transform.Transformer = utf8Validator{} + +type utf8Validator struct{ transform.NopResetter } + +func (utf8Validator) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + n := len(src) + if n > len(dst) { + n = len(dst) + } + for i := 0; i < n; { + if c := src[i]; c < utf8.RuneSelf { + dst[i] = c + i++ + continue + } + _, size := utf8.DecodeRune(src[i:]) + if size == 1 { + // All valid runes of size 1 (those below utf8.RuneSelf) were + // handled above. We have invalid UTF-8 or we haven't seen the + // full character yet. + err = ErrInvalidUTF8 + if !atEOF && !utf8.FullRune(src[i:]) { + err = transform.ErrShortSrc + } + return i, i, err + } + if i+size > len(dst) { + return i, i, transform.ErrShortDst + } + for ; size > 0; size-- { + dst[i] = src[i] + i++ + } + } + if len(src) > len(dst) { + err = transform.ErrShortDst + } + return n, n, err +} diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go new file mode 100644 index 00000000..5c9b85c2 --- /dev/null +++ b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go @@ -0,0 +1,81 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:generate go run gen.go + +// Package identifier defines the contract between implementations of Encoding +// and Index by defining identifiers that uniquely identify standardized coded +// character sets (CCS) and character encoding schemes (CES), which we will +// together refer to as encodings, for which Encoding implementations provide +// converters to and from UTF-8. This package is typically only of concern to +// implementers of Indexes and Encodings. +// +// One part of the identifier is the MIB code, which is defined by IANA and +// uniquely identifies a CCS or CES. Each code is associated with data that +// references authorities, official documentation as well as aliases and MIME +// names. +// +// Not all CESs are covered by the IANA registry. The "other" string that is +// returned by ID can be used to identify other character sets or versions of +// existing ones. +// +// It is recommended that each package that provides a set of Encodings provide +// the All and Common variables to reference all supported encodings and +// commonly used subset. This allows Index implementations to include all +// available encodings without explicitly referencing or knowing about them. +package identifier + +// Note: this package is internal, but could be made public if there is a need +// for writing third-party Indexes and Encodings. + +// References: +// - http://source.icu-project.org/repos/icu/icu/trunk/source/data/mappings/convrtrs.txt +// - http://www.iana.org/assignments/character-sets/character-sets.xhtml +// - http://www.iana.org/assignments/ianacharset-mib/ianacharset-mib +// - http://www.ietf.org/rfc/rfc2978.txt +// - https://www.unicode.org/reports/tr22/ +// - http://www.w3.org/TR/encoding/ +// - https://encoding.spec.whatwg.org/ +// - https://encoding.spec.whatwg.org/encodings.json +// - https://tools.ietf.org/html/rfc6657#section-5 + +// Interface can be implemented by Encodings to define the CCS or CES for which +// it implements conversions. +type Interface interface { + // ID returns an encoding identifier. Exactly one of the mib and other + // values should be non-zero. + // + // In the usual case it is only necessary to indicate the MIB code. The + // other string can be used to specify encodings for which there is no MIB, + // such as "x-mac-dingbat". + // + // The other string may only contain the characters a-z, A-Z, 0-9, - and _. + ID() (mib MIB, other string) + + // NOTE: the restrictions on the encoding are to allow extending the syntax + // with additional information such as versions, vendors and other variants. +} + +// A MIB identifies an encoding. It is derived from the IANA MIB codes and adds +// some identifiers for some encodings that are not covered by the IANA +// standard. +// +// See http://www.iana.org/assignments/ianacharset-mib. +type MIB uint16 + +// These additional MIB types are not defined in IANA. They are added because +// they are common and defined within the text repo. +const ( + // Unofficial marks the start of encodings not registered by IANA. + Unofficial MIB = 10000 + iota + + // Replacement is the WhatWG replacement encoding. + Replacement + + // XUserDefined is the code for x-user-defined. + XUserDefined + + // MacintoshCyrillic is the code for x-mac-cyrillic. + MacintoshCyrillic +) diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go new file mode 100644 index 00000000..351fb86e --- /dev/null +++ b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go @@ -0,0 +1,1627 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package identifier + +const ( + // ASCII is the MIB identifier with IANA name US-ASCII (MIME: US-ASCII). + // + // ANSI X3.4-1986 + // Reference: RFC2046 + ASCII MIB = 3 + + // ISOLatin1 is the MIB identifier with IANA name ISO_8859-1:1987 (MIME: ISO-8859-1). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatin1 MIB = 4 + + // ISOLatin2 is the MIB identifier with IANA name ISO_8859-2:1987 (MIME: ISO-8859-2). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatin2 MIB = 5 + + // ISOLatin3 is the MIB identifier with IANA name ISO_8859-3:1988 (MIME: ISO-8859-3). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatin3 MIB = 6 + + // ISOLatin4 is the MIB identifier with IANA name ISO_8859-4:1988 (MIME: ISO-8859-4). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatin4 MIB = 7 + + // ISOLatinCyrillic is the MIB identifier with IANA name ISO_8859-5:1988 (MIME: ISO-8859-5). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatinCyrillic MIB = 8 + + // ISOLatinArabic is the MIB identifier with IANA name ISO_8859-6:1987 (MIME: ISO-8859-6). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatinArabic MIB = 9 + + // ISOLatinGreek is the MIB identifier with IANA name ISO_8859-7:1987 (MIME: ISO-8859-7). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1947 + // Reference: RFC1345 + ISOLatinGreek MIB = 10 + + // ISOLatinHebrew is the MIB identifier with IANA name ISO_8859-8:1988 (MIME: ISO-8859-8). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatinHebrew MIB = 11 + + // ISOLatin5 is the MIB identifier with IANA name ISO_8859-9:1989 (MIME: ISO-8859-9). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatin5 MIB = 12 + + // ISOLatin6 is the MIB identifier with IANA name ISO-8859-10 (MIME: ISO-8859-10). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOLatin6 MIB = 13 + + // ISOTextComm is the MIB identifier with IANA name ISO_6937-2-add. + // + // ISO-IR: International Register of Escape Sequences and ISO 6937-2:1983 + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISOTextComm MIB = 14 + + // HalfWidthKatakana is the MIB identifier with IANA name JIS_X0201. + // + // JIS X 0201-1976. One byte only, this is equivalent to + // JIS/Roman (similar to ASCII) plus eight-bit half-width + // Katakana + // Reference: RFC1345 + HalfWidthKatakana MIB = 15 + + // JISEncoding is the MIB identifier with IANA name JIS_Encoding. + // + // JIS X 0202-1991. Uses ISO 2022 escape sequences to + // shift code sets as documented in JIS X 0202-1991. + JISEncoding MIB = 16 + + // ShiftJIS is the MIB identifier with IANA name Shift_JIS (MIME: Shift_JIS). + // + // This charset is an extension of csHalfWidthKatakana by + // adding graphic characters in JIS X 0208. The CCS's are + // JIS X0201:1997 and JIS X0208:1997. The + // complete definition is shown in Appendix 1 of JIS + // X0208:1997. + // This charset can be used for the top-level media type "text". + ShiftJIS MIB = 17 + + // EUCPkdFmtJapanese is the MIB identifier with IANA name Extended_UNIX_Code_Packed_Format_for_Japanese (MIME: EUC-JP). + // + // Standardized by OSF, UNIX International, and UNIX Systems + // Laboratories Pacific. Uses ISO 2022 rules to select + // code set 0: US-ASCII (a single 7-bit byte set) + // code set 1: JIS X0208-1990 (a double 8-bit byte set) + // restricted to A0-FF in both bytes + // code set 2: Half Width Katakana (a single 7-bit byte set) + // requiring SS2 as the character prefix + // code set 3: JIS X0212-1990 (a double 7-bit byte set) + // restricted to A0-FF in both bytes + // requiring SS3 as the character prefix + EUCPkdFmtJapanese MIB = 18 + + // EUCFixWidJapanese is the MIB identifier with IANA name Extended_UNIX_Code_Fixed_Width_for_Japanese. + // + // Used in Japan. Each character is 2 octets. + // code set 0: US-ASCII (a single 7-bit byte set) + // 1st byte = 00 + // 2nd byte = 20-7E + // code set 1: JIS X0208-1990 (a double 7-bit byte set) + // restricted to A0-FF in both bytes + // code set 2: Half Width Katakana (a single 7-bit byte set) + // 1st byte = 00 + // 2nd byte = A0-FF + // code set 3: JIS X0212-1990 (a double 7-bit byte set) + // restricted to A0-FF in + // the first byte + // and 21-7E in the second byte + EUCFixWidJapanese MIB = 19 + + // ISO4UnitedKingdom is the MIB identifier with IANA name BS_4730. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO4UnitedKingdom MIB = 20 + + // ISO11SwedishForNames is the MIB identifier with IANA name SEN_850200_C. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO11SwedishForNames MIB = 21 + + // ISO15Italian is the MIB identifier with IANA name IT. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO15Italian MIB = 22 + + // ISO17Spanish is the MIB identifier with IANA name ES. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO17Spanish MIB = 23 + + // ISO21German is the MIB identifier with IANA name DIN_66003. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO21German MIB = 24 + + // ISO60Norwegian1 is the MIB identifier with IANA name NS_4551-1. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO60Norwegian1 MIB = 25 + + // ISO69French is the MIB identifier with IANA name NF_Z_62-010. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO69French MIB = 26 + + // ISO10646UTF1 is the MIB identifier with IANA name ISO-10646-UTF-1. + // + // Universal Transfer Format (1), this is the multibyte + // encoding, that subsets ASCII-7. It does not have byte + // ordering issues. + ISO10646UTF1 MIB = 27 + + // ISO646basic1983 is the MIB identifier with IANA name ISO_646.basic:1983. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO646basic1983 MIB = 28 + + // INVARIANT is the MIB identifier with IANA name INVARIANT. + // + // Reference: RFC1345 + INVARIANT MIB = 29 + + // ISO2IntlRefVersion is the MIB identifier with IANA name ISO_646.irv:1983. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO2IntlRefVersion MIB = 30 + + // NATSSEFI is the MIB identifier with IANA name NATS-SEFI. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + NATSSEFI MIB = 31 + + // NATSSEFIADD is the MIB identifier with IANA name NATS-SEFI-ADD. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + NATSSEFIADD MIB = 32 + + // NATSDANO is the MIB identifier with IANA name NATS-DANO. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + NATSDANO MIB = 33 + + // NATSDANOADD is the MIB identifier with IANA name NATS-DANO-ADD. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + NATSDANOADD MIB = 34 + + // ISO10Swedish is the MIB identifier with IANA name SEN_850200_B. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO10Swedish MIB = 35 + + // KSC56011987 is the MIB identifier with IANA name KS_C_5601-1987. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + KSC56011987 MIB = 36 + + // ISO2022KR is the MIB identifier with IANA name ISO-2022-KR (MIME: ISO-2022-KR). + // + // rfc1557 (see also KS_C_5601-1987) + // Reference: RFC1557 + ISO2022KR MIB = 37 + + // EUCKR is the MIB identifier with IANA name EUC-KR (MIME: EUC-KR). + // + // rfc1557 (see also KS_C_5861-1992) + // Reference: RFC1557 + EUCKR MIB = 38 + + // ISO2022JP is the MIB identifier with IANA name ISO-2022-JP (MIME: ISO-2022-JP). + // + // rfc1468 (see also rfc2237 ) + // Reference: RFC1468 + ISO2022JP MIB = 39 + + // ISO2022JP2 is the MIB identifier with IANA name ISO-2022-JP-2 (MIME: ISO-2022-JP-2). + // + // rfc1554 + // Reference: RFC1554 + ISO2022JP2 MIB = 40 + + // ISO13JISC6220jp is the MIB identifier with IANA name JIS_C6220-1969-jp. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO13JISC6220jp MIB = 41 + + // ISO14JISC6220ro is the MIB identifier with IANA name JIS_C6220-1969-ro. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO14JISC6220ro MIB = 42 + + // ISO16Portuguese is the MIB identifier with IANA name PT. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO16Portuguese MIB = 43 + + // ISO18Greek7Old is the MIB identifier with IANA name greek7-old. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO18Greek7Old MIB = 44 + + // ISO19LatinGreek is the MIB identifier with IANA name latin-greek. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO19LatinGreek MIB = 45 + + // ISO25French is the MIB identifier with IANA name NF_Z_62-010_(1973). + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO25French MIB = 46 + + // ISO27LatinGreek1 is the MIB identifier with IANA name Latin-greek-1. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO27LatinGreek1 MIB = 47 + + // ISO5427Cyrillic is the MIB identifier with IANA name ISO_5427. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO5427Cyrillic MIB = 48 + + // ISO42JISC62261978 is the MIB identifier with IANA name JIS_C6226-1978. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO42JISC62261978 MIB = 49 + + // ISO47BSViewdata is the MIB identifier with IANA name BS_viewdata. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO47BSViewdata MIB = 50 + + // ISO49INIS is the MIB identifier with IANA name INIS. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO49INIS MIB = 51 + + // ISO50INIS8 is the MIB identifier with IANA name INIS-8. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO50INIS8 MIB = 52 + + // ISO51INISCyrillic is the MIB identifier with IANA name INIS-cyrillic. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO51INISCyrillic MIB = 53 + + // ISO54271981 is the MIB identifier with IANA name ISO_5427:1981. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO54271981 MIB = 54 + + // ISO5428Greek is the MIB identifier with IANA name ISO_5428:1980. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO5428Greek MIB = 55 + + // ISO57GB1988 is the MIB identifier with IANA name GB_1988-80. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO57GB1988 MIB = 56 + + // ISO58GB231280 is the MIB identifier with IANA name GB_2312-80. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO58GB231280 MIB = 57 + + // ISO61Norwegian2 is the MIB identifier with IANA name NS_4551-2. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO61Norwegian2 MIB = 58 + + // ISO70VideotexSupp1 is the MIB identifier with IANA name videotex-suppl. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO70VideotexSupp1 MIB = 59 + + // ISO84Portuguese2 is the MIB identifier with IANA name PT2. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO84Portuguese2 MIB = 60 + + // ISO85Spanish2 is the MIB identifier with IANA name ES2. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO85Spanish2 MIB = 61 + + // ISO86Hungarian is the MIB identifier with IANA name MSZ_7795.3. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO86Hungarian MIB = 62 + + // ISO87JISX0208 is the MIB identifier with IANA name JIS_C6226-1983. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO87JISX0208 MIB = 63 + + // ISO88Greek7 is the MIB identifier with IANA name greek7. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO88Greek7 MIB = 64 + + // ISO89ASMO449 is the MIB identifier with IANA name ASMO_449. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO89ASMO449 MIB = 65 + + // ISO90 is the MIB identifier with IANA name iso-ir-90. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO90 MIB = 66 + + // ISO91JISC62291984a is the MIB identifier with IANA name JIS_C6229-1984-a. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO91JISC62291984a MIB = 67 + + // ISO92JISC62991984b is the MIB identifier with IANA name JIS_C6229-1984-b. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO92JISC62991984b MIB = 68 + + // ISO93JIS62291984badd is the MIB identifier with IANA name JIS_C6229-1984-b-add. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO93JIS62291984badd MIB = 69 + + // ISO94JIS62291984hand is the MIB identifier with IANA name JIS_C6229-1984-hand. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO94JIS62291984hand MIB = 70 + + // ISO95JIS62291984handadd is the MIB identifier with IANA name JIS_C6229-1984-hand-add. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO95JIS62291984handadd MIB = 71 + + // ISO96JISC62291984kana is the MIB identifier with IANA name JIS_C6229-1984-kana. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO96JISC62291984kana MIB = 72 + + // ISO2033 is the MIB identifier with IANA name ISO_2033-1983. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO2033 MIB = 73 + + // ISO99NAPLPS is the MIB identifier with IANA name ANSI_X3.110-1983. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO99NAPLPS MIB = 74 + + // ISO102T617bit is the MIB identifier with IANA name T.61-7bit. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO102T617bit MIB = 75 + + // ISO103T618bit is the MIB identifier with IANA name T.61-8bit. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO103T618bit MIB = 76 + + // ISO111ECMACyrillic is the MIB identifier with IANA name ECMA-cyrillic. + // + // ISO registry + ISO111ECMACyrillic MIB = 77 + + // ISO121Canadian1 is the MIB identifier with IANA name CSA_Z243.4-1985-1. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO121Canadian1 MIB = 78 + + // ISO122Canadian2 is the MIB identifier with IANA name CSA_Z243.4-1985-2. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO122Canadian2 MIB = 79 + + // ISO123CSAZ24341985gr is the MIB identifier with IANA name CSA_Z243.4-1985-gr. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO123CSAZ24341985gr MIB = 80 + + // ISO88596E is the MIB identifier with IANA name ISO_8859-6-E (MIME: ISO-8859-6-E). + // + // rfc1556 + // Reference: RFC1556 + ISO88596E MIB = 81 + + // ISO88596I is the MIB identifier with IANA name ISO_8859-6-I (MIME: ISO-8859-6-I). + // + // rfc1556 + // Reference: RFC1556 + ISO88596I MIB = 82 + + // ISO128T101G2 is the MIB identifier with IANA name T.101-G2. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO128T101G2 MIB = 83 + + // ISO88598E is the MIB identifier with IANA name ISO_8859-8-E (MIME: ISO-8859-8-E). + // + // rfc1556 + // Reference: RFC1556 + ISO88598E MIB = 84 + + // ISO88598I is the MIB identifier with IANA name ISO_8859-8-I (MIME: ISO-8859-8-I). + // + // rfc1556 + // Reference: RFC1556 + ISO88598I MIB = 85 + + // ISO139CSN369103 is the MIB identifier with IANA name CSN_369103. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO139CSN369103 MIB = 86 + + // ISO141JUSIB1002 is the MIB identifier with IANA name JUS_I.B1.002. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO141JUSIB1002 MIB = 87 + + // ISO143IECP271 is the MIB identifier with IANA name IEC_P27-1. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO143IECP271 MIB = 88 + + // ISO146Serbian is the MIB identifier with IANA name JUS_I.B1.003-serb. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO146Serbian MIB = 89 + + // ISO147Macedonian is the MIB identifier with IANA name JUS_I.B1.003-mac. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO147Macedonian MIB = 90 + + // ISO150GreekCCITT is the MIB identifier with IANA name greek-ccitt. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO150GreekCCITT MIB = 91 + + // ISO151Cuba is the MIB identifier with IANA name NC_NC00-10:81. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO151Cuba MIB = 92 + + // ISO6937Add is the MIB identifier with IANA name ISO_6937-2-25. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO6937Add MIB = 93 + + // ISO153GOST1976874 is the MIB identifier with IANA name GOST_19768-74. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO153GOST1976874 MIB = 94 + + // ISO8859Supp is the MIB identifier with IANA name ISO_8859-supp. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO8859Supp MIB = 95 + + // ISO10367Box is the MIB identifier with IANA name ISO_10367-box. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO10367Box MIB = 96 + + // ISO158Lap is the MIB identifier with IANA name latin-lap. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO158Lap MIB = 97 + + // ISO159JISX02121990 is the MIB identifier with IANA name JIS_X0212-1990. + // + // ISO-IR: International Register of Escape Sequences + // Note: The current registration authority is IPSJ/ITSCJ, Japan. + // Reference: RFC1345 + ISO159JISX02121990 MIB = 98 + + // ISO646Danish is the MIB identifier with IANA name DS_2089. + // + // Danish Standard, DS 2089, February 1974 + // Reference: RFC1345 + ISO646Danish MIB = 99 + + // USDK is the MIB identifier with IANA name us-dk. + // + // Reference: RFC1345 + USDK MIB = 100 + + // DKUS is the MIB identifier with IANA name dk-us. + // + // Reference: RFC1345 + DKUS MIB = 101 + + // KSC5636 is the MIB identifier with IANA name KSC5636. + // + // Reference: RFC1345 + KSC5636 MIB = 102 + + // Unicode11UTF7 is the MIB identifier with IANA name UNICODE-1-1-UTF-7. + // + // rfc1642 + // Reference: RFC1642 + Unicode11UTF7 MIB = 103 + + // ISO2022CN is the MIB identifier with IANA name ISO-2022-CN. + // + // rfc1922 + // Reference: RFC1922 + ISO2022CN MIB = 104 + + // ISO2022CNEXT is the MIB identifier with IANA name ISO-2022-CN-EXT. + // + // rfc1922 + // Reference: RFC1922 + ISO2022CNEXT MIB = 105 + + // UTF8 is the MIB identifier with IANA name UTF-8. + // + // rfc3629 + // Reference: RFC3629 + UTF8 MIB = 106 + + // ISO885913 is the MIB identifier with IANA name ISO-8859-13. + // + // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-13 https://www.iana.org/assignments/charset-reg/ISO-8859-13 + ISO885913 MIB = 109 + + // ISO885914 is the MIB identifier with IANA name ISO-8859-14. + // + // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-14 + ISO885914 MIB = 110 + + // ISO885915 is the MIB identifier with IANA name ISO-8859-15. + // + // ISO + // Please see: https://www.iana.org/assignments/charset-reg/ISO-8859-15 + ISO885915 MIB = 111 + + // ISO885916 is the MIB identifier with IANA name ISO-8859-16. + // + // ISO + ISO885916 MIB = 112 + + // GBK is the MIB identifier with IANA name GBK. + // + // Chinese IT Standardization Technical Committee + // Please see: https://www.iana.org/assignments/charset-reg/GBK + GBK MIB = 113 + + // GB18030 is the MIB identifier with IANA name GB18030. + // + // Chinese IT Standardization Technical Committee + // Please see: https://www.iana.org/assignments/charset-reg/GB18030 + GB18030 MIB = 114 + + // OSDEBCDICDF0415 is the MIB identifier with IANA name OSD_EBCDIC_DF04_15. + // + // Fujitsu-Siemens standard mainframe EBCDIC encoding + // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15 + OSDEBCDICDF0415 MIB = 115 + + // OSDEBCDICDF03IRV is the MIB identifier with IANA name OSD_EBCDIC_DF03_IRV. + // + // Fujitsu-Siemens standard mainframe EBCDIC encoding + // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV + OSDEBCDICDF03IRV MIB = 116 + + // OSDEBCDICDF041 is the MIB identifier with IANA name OSD_EBCDIC_DF04_1. + // + // Fujitsu-Siemens standard mainframe EBCDIC encoding + // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1 + OSDEBCDICDF041 MIB = 117 + + // ISO115481 is the MIB identifier with IANA name ISO-11548-1. + // + // See https://www.iana.org/assignments/charset-reg/ISO-11548-1 + ISO115481 MIB = 118 + + // KZ1048 is the MIB identifier with IANA name KZ-1048. + // + // See https://www.iana.org/assignments/charset-reg/KZ-1048 + KZ1048 MIB = 119 + + // Unicode is the MIB identifier with IANA name ISO-10646-UCS-2. + // + // the 2-octet Basic Multilingual Plane, aka Unicode + // this needs to specify network byte order: the standard + // does not specify (it is a 16-bit integer space) + Unicode MIB = 1000 + + // UCS4 is the MIB identifier with IANA name ISO-10646-UCS-4. + // + // the full code space. (same comment about byte order, + // these are 31-bit numbers. + UCS4 MIB = 1001 + + // UnicodeASCII is the MIB identifier with IANA name ISO-10646-UCS-Basic. + // + // ASCII subset of Unicode. Basic Latin = collection 1 + // See ISO 10646, Appendix A + UnicodeASCII MIB = 1002 + + // UnicodeLatin1 is the MIB identifier with IANA name ISO-10646-Unicode-Latin1. + // + // ISO Latin-1 subset of Unicode. Basic Latin and Latin-1 + // Supplement = collections 1 and 2. See ISO 10646, + // Appendix A. See rfc1815 . + UnicodeLatin1 MIB = 1003 + + // UnicodeJapanese is the MIB identifier with IANA name ISO-10646-J-1. + // + // ISO 10646 Japanese, see rfc1815 . + UnicodeJapanese MIB = 1004 + + // UnicodeIBM1261 is the MIB identifier with IANA name ISO-Unicode-IBM-1261. + // + // IBM Latin-2, -3, -5, Extended Presentation Set, GCSGID: 1261 + UnicodeIBM1261 MIB = 1005 + + // UnicodeIBM1268 is the MIB identifier with IANA name ISO-Unicode-IBM-1268. + // + // IBM Latin-4 Extended Presentation Set, GCSGID: 1268 + UnicodeIBM1268 MIB = 1006 + + // UnicodeIBM1276 is the MIB identifier with IANA name ISO-Unicode-IBM-1276. + // + // IBM Cyrillic Greek Extended Presentation Set, GCSGID: 1276 + UnicodeIBM1276 MIB = 1007 + + // UnicodeIBM1264 is the MIB identifier with IANA name ISO-Unicode-IBM-1264. + // + // IBM Arabic Presentation Set, GCSGID: 1264 + UnicodeIBM1264 MIB = 1008 + + // UnicodeIBM1265 is the MIB identifier with IANA name ISO-Unicode-IBM-1265. + // + // IBM Hebrew Presentation Set, GCSGID: 1265 + UnicodeIBM1265 MIB = 1009 + + // Unicode11 is the MIB identifier with IANA name UNICODE-1-1. + // + // rfc1641 + // Reference: RFC1641 + Unicode11 MIB = 1010 + + // SCSU is the MIB identifier with IANA name SCSU. + // + // SCSU See https://www.iana.org/assignments/charset-reg/SCSU + SCSU MIB = 1011 + + // UTF7 is the MIB identifier with IANA name UTF-7. + // + // rfc2152 + // Reference: RFC2152 + UTF7 MIB = 1012 + + // UTF16BE is the MIB identifier with IANA name UTF-16BE. + // + // rfc2781 + // Reference: RFC2781 + UTF16BE MIB = 1013 + + // UTF16LE is the MIB identifier with IANA name UTF-16LE. + // + // rfc2781 + // Reference: RFC2781 + UTF16LE MIB = 1014 + + // UTF16 is the MIB identifier with IANA name UTF-16. + // + // rfc2781 + // Reference: RFC2781 + UTF16 MIB = 1015 + + // CESU8 is the MIB identifier with IANA name CESU-8. + // + // https://www.unicode.org/reports/tr26 + CESU8 MIB = 1016 + + // UTF32 is the MIB identifier with IANA name UTF-32. + // + // https://www.unicode.org/reports/tr19/ + UTF32 MIB = 1017 + + // UTF32BE is the MIB identifier with IANA name UTF-32BE. + // + // https://www.unicode.org/reports/tr19/ + UTF32BE MIB = 1018 + + // UTF32LE is the MIB identifier with IANA name UTF-32LE. + // + // https://www.unicode.org/reports/tr19/ + UTF32LE MIB = 1019 + + // BOCU1 is the MIB identifier with IANA name BOCU-1. + // + // https://www.unicode.org/notes/tn6/ + BOCU1 MIB = 1020 + + // UTF7IMAP is the MIB identifier with IANA name UTF-7-IMAP. + // + // Note: This charset is used to encode Unicode in IMAP mailbox names; + // see section 5.1.3 of rfc3501 . It should never be used + // outside this context. A name has been assigned so that charset processing + // implementations can refer to it in a consistent way. + UTF7IMAP MIB = 1021 + + // Windows30Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.0-Latin-1. + // + // Extended ISO 8859-1 Latin-1 for Windows 3.0. + // PCL Symbol Set id: 9U + Windows30Latin1 MIB = 2000 + + // Windows31Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.1-Latin-1. + // + // Extended ISO 8859-1 Latin-1 for Windows 3.1. + // PCL Symbol Set id: 19U + Windows31Latin1 MIB = 2001 + + // Windows31Latin2 is the MIB identifier with IANA name ISO-8859-2-Windows-Latin-2. + // + // Extended ISO 8859-2. Latin-2 for Windows 3.1. + // PCL Symbol Set id: 9E + Windows31Latin2 MIB = 2002 + + // Windows31Latin5 is the MIB identifier with IANA name ISO-8859-9-Windows-Latin-5. + // + // Extended ISO 8859-9. Latin-5 for Windows 3.1 + // PCL Symbol Set id: 5T + Windows31Latin5 MIB = 2003 + + // HPRoman8 is the MIB identifier with IANA name hp-roman8. + // + // LaserJet IIP Printer User's Manual, + // HP part no 33471-90901, Hewlet-Packard, June 1989. + // Reference: RFC1345 + HPRoman8 MIB = 2004 + + // AdobeStandardEncoding is the MIB identifier with IANA name Adobe-Standard-Encoding. + // + // PostScript Language Reference Manual + // PCL Symbol Set id: 10J + AdobeStandardEncoding MIB = 2005 + + // VenturaUS is the MIB identifier with IANA name Ventura-US. + // + // Ventura US. ASCII plus characters typically used in + // publishing, like pilcrow, copyright, registered, trade mark, + // section, dagger, and double dagger in the range A0 (hex) + // to FF (hex). + // PCL Symbol Set id: 14J + VenturaUS MIB = 2006 + + // VenturaInternational is the MIB identifier with IANA name Ventura-International. + // + // Ventura International. ASCII plus coded characters similar + // to Roman8. + // PCL Symbol Set id: 13J + VenturaInternational MIB = 2007 + + // DECMCS is the MIB identifier with IANA name DEC-MCS. + // + // VAX/VMS User's Manual, + // Order Number: AI-Y517A-TE, April 1986. + // Reference: RFC1345 + DECMCS MIB = 2008 + + // PC850Multilingual is the MIB identifier with IANA name IBM850. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + PC850Multilingual MIB = 2009 + + // PC8DanishNorwegian is the MIB identifier with IANA name PC8-Danish-Norwegian. + // + // PC Danish Norwegian + // 8-bit PC set for Danish Norwegian + // PCL Symbol Set id: 11U + PC8DanishNorwegian MIB = 2012 + + // PC862LatinHebrew is the MIB identifier with IANA name IBM862. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + PC862LatinHebrew MIB = 2013 + + // PC8Turkish is the MIB identifier with IANA name PC8-Turkish. + // + // PC Latin Turkish. PCL Symbol Set id: 9T + PC8Turkish MIB = 2014 + + // IBMSymbols is the MIB identifier with IANA name IBM-Symbols. + // + // Presentation Set, CPGID: 259 + IBMSymbols MIB = 2015 + + // IBMThai is the MIB identifier with IANA name IBM-Thai. + // + // Presentation Set, CPGID: 838 + IBMThai MIB = 2016 + + // HPLegal is the MIB identifier with IANA name HP-Legal. + // + // PCL 5 Comparison Guide, Hewlett-Packard, + // HP part number 5961-0510, October 1992 + // PCL Symbol Set id: 1U + HPLegal MIB = 2017 + + // HPPiFont is the MIB identifier with IANA name HP-Pi-font. + // + // PCL 5 Comparison Guide, Hewlett-Packard, + // HP part number 5961-0510, October 1992 + // PCL Symbol Set id: 15U + HPPiFont MIB = 2018 + + // HPMath8 is the MIB identifier with IANA name HP-Math8. + // + // PCL 5 Comparison Guide, Hewlett-Packard, + // HP part number 5961-0510, October 1992 + // PCL Symbol Set id: 8M + HPMath8 MIB = 2019 + + // HPPSMath is the MIB identifier with IANA name Adobe-Symbol-Encoding. + // + // PostScript Language Reference Manual + // PCL Symbol Set id: 5M + HPPSMath MIB = 2020 + + // HPDesktop is the MIB identifier with IANA name HP-DeskTop. + // + // PCL 5 Comparison Guide, Hewlett-Packard, + // HP part number 5961-0510, October 1992 + // PCL Symbol Set id: 7J + HPDesktop MIB = 2021 + + // VenturaMath is the MIB identifier with IANA name Ventura-Math. + // + // PCL 5 Comparison Guide, Hewlett-Packard, + // HP part number 5961-0510, October 1992 + // PCL Symbol Set id: 6M + VenturaMath MIB = 2022 + + // MicrosoftPublishing is the MIB identifier with IANA name Microsoft-Publishing. + // + // PCL 5 Comparison Guide, Hewlett-Packard, + // HP part number 5961-0510, October 1992 + // PCL Symbol Set id: 6J + MicrosoftPublishing MIB = 2023 + + // Windows31J is the MIB identifier with IANA name Windows-31J. + // + // Windows Japanese. A further extension of Shift_JIS + // to include NEC special characters (Row 13), NEC + // selection of IBM extensions (Rows 89 to 92), and IBM + // extensions (Rows 115 to 119). The CCS's are + // JIS X0201:1997, JIS X0208:1997, and these extensions. + // This charset can be used for the top-level media type "text", + // but it is of limited or specialized use (see rfc2278 ). + // PCL Symbol Set id: 19K + Windows31J MIB = 2024 + + // GB2312 is the MIB identifier with IANA name GB2312 (MIME: GB2312). + // + // Chinese for People's Republic of China (PRC) mixed one byte, + // two byte set: + // 20-7E = one byte ASCII + // A1-FE = two byte PRC Kanji + // See GB 2312-80 + // PCL Symbol Set Id: 18C + GB2312 MIB = 2025 + + // Big5 is the MIB identifier with IANA name Big5 (MIME: Big5). + // + // Chinese for Taiwan Multi-byte set. + // PCL Symbol Set Id: 18T + Big5 MIB = 2026 + + // Macintosh is the MIB identifier with IANA name macintosh. + // + // The Unicode Standard ver1.0, ISBN 0-201-56788-1, Oct 1991 + // Reference: RFC1345 + Macintosh MIB = 2027 + + // IBM037 is the MIB identifier with IANA name IBM037. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM037 MIB = 2028 + + // IBM038 is the MIB identifier with IANA name IBM038. + // + // IBM 3174 Character Set Ref, GA27-3831-02, March 1990 + // Reference: RFC1345 + IBM038 MIB = 2029 + + // IBM273 is the MIB identifier with IANA name IBM273. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM273 MIB = 2030 + + // IBM274 is the MIB identifier with IANA name IBM274. + // + // IBM 3174 Character Set Ref, GA27-3831-02, March 1990 + // Reference: RFC1345 + IBM274 MIB = 2031 + + // IBM275 is the MIB identifier with IANA name IBM275. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM275 MIB = 2032 + + // IBM277 is the MIB identifier with IANA name IBM277. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM277 MIB = 2033 + + // IBM278 is the MIB identifier with IANA name IBM278. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM278 MIB = 2034 + + // IBM280 is the MIB identifier with IANA name IBM280. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM280 MIB = 2035 + + // IBM281 is the MIB identifier with IANA name IBM281. + // + // IBM 3174 Character Set Ref, GA27-3831-02, March 1990 + // Reference: RFC1345 + IBM281 MIB = 2036 + + // IBM284 is the MIB identifier with IANA name IBM284. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM284 MIB = 2037 + + // IBM285 is the MIB identifier with IANA name IBM285. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM285 MIB = 2038 + + // IBM290 is the MIB identifier with IANA name IBM290. + // + // IBM 3174 Character Set Ref, GA27-3831-02, March 1990 + // Reference: RFC1345 + IBM290 MIB = 2039 + + // IBM297 is the MIB identifier with IANA name IBM297. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM297 MIB = 2040 + + // IBM420 is the MIB identifier with IANA name IBM420. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990, + // IBM NLS RM p 11-11 + // Reference: RFC1345 + IBM420 MIB = 2041 + + // IBM423 is the MIB identifier with IANA name IBM423. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM423 MIB = 2042 + + // IBM424 is the MIB identifier with IANA name IBM424. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM424 MIB = 2043 + + // PC8CodePage437 is the MIB identifier with IANA name IBM437. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + PC8CodePage437 MIB = 2011 + + // IBM500 is the MIB identifier with IANA name IBM500. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM500 MIB = 2044 + + // IBM851 is the MIB identifier with IANA name IBM851. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM851 MIB = 2045 + + // PCp852 is the MIB identifier with IANA name IBM852. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + PCp852 MIB = 2010 + + // IBM855 is the MIB identifier with IANA name IBM855. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM855 MIB = 2046 + + // IBM857 is the MIB identifier with IANA name IBM857. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM857 MIB = 2047 + + // IBM860 is the MIB identifier with IANA name IBM860. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM860 MIB = 2048 + + // IBM861 is the MIB identifier with IANA name IBM861. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM861 MIB = 2049 + + // IBM863 is the MIB identifier with IANA name IBM863. + // + // IBM Keyboard layouts and code pages, PN 07G4586 June 1991 + // Reference: RFC1345 + IBM863 MIB = 2050 + + // IBM864 is the MIB identifier with IANA name IBM864. + // + // IBM Keyboard layouts and code pages, PN 07G4586 June 1991 + // Reference: RFC1345 + IBM864 MIB = 2051 + + // IBM865 is the MIB identifier with IANA name IBM865. + // + // IBM DOS 3.3 Ref (Abridged), 94X9575 (Feb 1987) + // Reference: RFC1345 + IBM865 MIB = 2052 + + // IBM868 is the MIB identifier with IANA name IBM868. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM868 MIB = 2053 + + // IBM869 is the MIB identifier with IANA name IBM869. + // + // IBM Keyboard layouts and code pages, PN 07G4586 June 1991 + // Reference: RFC1345 + IBM869 MIB = 2054 + + // IBM870 is the MIB identifier with IANA name IBM870. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM870 MIB = 2055 + + // IBM871 is the MIB identifier with IANA name IBM871. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM871 MIB = 2056 + + // IBM880 is the MIB identifier with IANA name IBM880. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM880 MIB = 2057 + + // IBM891 is the MIB identifier with IANA name IBM891. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM891 MIB = 2058 + + // IBM903 is the MIB identifier with IANA name IBM903. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM903 MIB = 2059 + + // IBBM904 is the MIB identifier with IANA name IBM904. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBBM904 MIB = 2060 + + // IBM905 is the MIB identifier with IANA name IBM905. + // + // IBM 3174 Character Set Ref, GA27-3831-02, March 1990 + // Reference: RFC1345 + IBM905 MIB = 2061 + + // IBM918 is the MIB identifier with IANA name IBM918. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM918 MIB = 2062 + + // IBM1026 is the MIB identifier with IANA name IBM1026. + // + // IBM NLS RM Vol2 SE09-8002-01, March 1990 + // Reference: RFC1345 + IBM1026 MIB = 2063 + + // IBMEBCDICATDE is the MIB identifier with IANA name EBCDIC-AT-DE. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + IBMEBCDICATDE MIB = 2064 + + // EBCDICATDEA is the MIB identifier with IANA name EBCDIC-AT-DE-A. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICATDEA MIB = 2065 + + // EBCDICCAFR is the MIB identifier with IANA name EBCDIC-CA-FR. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICCAFR MIB = 2066 + + // EBCDICDKNO is the MIB identifier with IANA name EBCDIC-DK-NO. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICDKNO MIB = 2067 + + // EBCDICDKNOA is the MIB identifier with IANA name EBCDIC-DK-NO-A. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICDKNOA MIB = 2068 + + // EBCDICFISE is the MIB identifier with IANA name EBCDIC-FI-SE. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICFISE MIB = 2069 + + // EBCDICFISEA is the MIB identifier with IANA name EBCDIC-FI-SE-A. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICFISEA MIB = 2070 + + // EBCDICFR is the MIB identifier with IANA name EBCDIC-FR. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICFR MIB = 2071 + + // EBCDICIT is the MIB identifier with IANA name EBCDIC-IT. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICIT MIB = 2072 + + // EBCDICPT is the MIB identifier with IANA name EBCDIC-PT. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICPT MIB = 2073 + + // EBCDICES is the MIB identifier with IANA name EBCDIC-ES. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICES MIB = 2074 + + // EBCDICESA is the MIB identifier with IANA name EBCDIC-ES-A. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICESA MIB = 2075 + + // EBCDICESS is the MIB identifier with IANA name EBCDIC-ES-S. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICESS MIB = 2076 + + // EBCDICUK is the MIB identifier with IANA name EBCDIC-UK. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICUK MIB = 2077 + + // EBCDICUS is the MIB identifier with IANA name EBCDIC-US. + // + // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987 + // Reference: RFC1345 + EBCDICUS MIB = 2078 + + // Unknown8BiT is the MIB identifier with IANA name UNKNOWN-8BIT. + // + // Reference: RFC1428 + Unknown8BiT MIB = 2079 + + // Mnemonic is the MIB identifier with IANA name MNEMONIC. + // + // rfc1345 , also known as "mnemonic+ascii+38" + // Reference: RFC1345 + Mnemonic MIB = 2080 + + // Mnem is the MIB identifier with IANA name MNEM. + // + // rfc1345 , also known as "mnemonic+ascii+8200" + // Reference: RFC1345 + Mnem MIB = 2081 + + // VISCII is the MIB identifier with IANA name VISCII. + // + // rfc1456 + // Reference: RFC1456 + VISCII MIB = 2082 + + // VIQR is the MIB identifier with IANA name VIQR. + // + // rfc1456 + // Reference: RFC1456 + VIQR MIB = 2083 + + // KOI8R is the MIB identifier with IANA name KOI8-R (MIME: KOI8-R). + // + // rfc1489 , based on GOST-19768-74, ISO-6937/8, + // INIS-Cyrillic, ISO-5427. + // Reference: RFC1489 + KOI8R MIB = 2084 + + // HZGB2312 is the MIB identifier with IANA name HZ-GB-2312. + // + // rfc1842 , rfc1843 rfc1843 rfc1842 + HZGB2312 MIB = 2085 + + // IBM866 is the MIB identifier with IANA name IBM866. + // + // IBM NLDG Volume 2 (SE09-8002-03) August 1994 + IBM866 MIB = 2086 + + // PC775Baltic is the MIB identifier with IANA name IBM775. + // + // HP PCL 5 Comparison Guide (P/N 5021-0329) pp B-13, 1996 + PC775Baltic MIB = 2087 + + // KOI8U is the MIB identifier with IANA name KOI8-U. + // + // rfc2319 + // Reference: RFC2319 + KOI8U MIB = 2088 + + // IBM00858 is the MIB identifier with IANA name IBM00858. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM00858 + IBM00858 MIB = 2089 + + // IBM00924 is the MIB identifier with IANA name IBM00924. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM00924 + IBM00924 MIB = 2090 + + // IBM01140 is the MIB identifier with IANA name IBM01140. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01140 + IBM01140 MIB = 2091 + + // IBM01141 is the MIB identifier with IANA name IBM01141. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01141 + IBM01141 MIB = 2092 + + // IBM01142 is the MIB identifier with IANA name IBM01142. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01142 + IBM01142 MIB = 2093 + + // IBM01143 is the MIB identifier with IANA name IBM01143. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01143 + IBM01143 MIB = 2094 + + // IBM01144 is the MIB identifier with IANA name IBM01144. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01144 + IBM01144 MIB = 2095 + + // IBM01145 is the MIB identifier with IANA name IBM01145. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01145 + IBM01145 MIB = 2096 + + // IBM01146 is the MIB identifier with IANA name IBM01146. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01146 + IBM01146 MIB = 2097 + + // IBM01147 is the MIB identifier with IANA name IBM01147. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01147 + IBM01147 MIB = 2098 + + // IBM01148 is the MIB identifier with IANA name IBM01148. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01148 + IBM01148 MIB = 2099 + + // IBM01149 is the MIB identifier with IANA name IBM01149. + // + // IBM See https://www.iana.org/assignments/charset-reg/IBM01149 + IBM01149 MIB = 2100 + + // Big5HKSCS is the MIB identifier with IANA name Big5-HKSCS. + // + // See https://www.iana.org/assignments/charset-reg/Big5-HKSCS + Big5HKSCS MIB = 2101 + + // IBM1047 is the MIB identifier with IANA name IBM1047. + // + // IBM1047 (EBCDIC Latin 1/Open Systems) https://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf + IBM1047 MIB = 2102 + + // PTCP154 is the MIB identifier with IANA name PTCP154. + // + // See https://www.iana.org/assignments/charset-reg/PTCP154 + PTCP154 MIB = 2103 + + // Amiga1251 is the MIB identifier with IANA name Amiga-1251. + // + // See https://www.amiga.ultranet.ru/Amiga-1251.html + Amiga1251 MIB = 2104 + + // KOI7switched is the MIB identifier with IANA name KOI7-switched. + // + // See https://www.iana.org/assignments/charset-reg/KOI7-switched + KOI7switched MIB = 2105 + + // BRF is the MIB identifier with IANA name BRF. + // + // See https://www.iana.org/assignments/charset-reg/BRF + BRF MIB = 2106 + + // TSCII is the MIB identifier with IANA name TSCII. + // + // See https://www.iana.org/assignments/charset-reg/TSCII + TSCII MIB = 2107 + + // CP51932 is the MIB identifier with IANA name CP51932. + // + // See https://www.iana.org/assignments/charset-reg/CP51932 + CP51932 MIB = 2108 + + // Windows874 is the MIB identifier with IANA name windows-874. + // + // See https://www.iana.org/assignments/charset-reg/windows-874 + Windows874 MIB = 2109 + + // Windows1250 is the MIB identifier with IANA name windows-1250. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1250 + Windows1250 MIB = 2250 + + // Windows1251 is the MIB identifier with IANA name windows-1251. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1251 + Windows1251 MIB = 2251 + + // Windows1252 is the MIB identifier with IANA name windows-1252. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1252 + Windows1252 MIB = 2252 + + // Windows1253 is the MIB identifier with IANA name windows-1253. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1253 + Windows1253 MIB = 2253 + + // Windows1254 is the MIB identifier with IANA name windows-1254. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1254 + Windows1254 MIB = 2254 + + // Windows1255 is the MIB identifier with IANA name windows-1255. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1255 + Windows1255 MIB = 2255 + + // Windows1256 is the MIB identifier with IANA name windows-1256. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1256 + Windows1256 MIB = 2256 + + // Windows1257 is the MIB identifier with IANA name windows-1257. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1257 + Windows1257 MIB = 2257 + + // Windows1258 is the MIB identifier with IANA name windows-1258. + // + // Microsoft https://www.iana.org/assignments/charset-reg/windows-1258 + Windows1258 MIB = 2258 + + // TIS620 is the MIB identifier with IANA name TIS-620. + // + // Thai Industrial Standards Institute (TISI) + TIS620 MIB = 2259 + + // CP50220 is the MIB identifier with IANA name CP50220. + // + // See https://www.iana.org/assignments/charset-reg/CP50220 + CP50220 MIB = 2260 +) diff --git a/vendor/golang.org/x/text/unicode/norm/forminfo.go b/vendor/golang.org/x/text/unicode/norm/forminfo.go index d69ccb4f..487335d1 100644 --- a/vendor/golang.org/x/text/unicode/norm/forminfo.go +++ b/vendor/golang.org/x/text/unicode/norm/forminfo.go @@ -13,7 +13,7 @@ import "encoding/binary" // a rune to a uint16. The values take two forms. For v >= 0x8000: // bits // 15: 1 (inverse of NFD_QC bit of qcInfo) -// 13..7: qcInfo (see below). isYesD is always true (no decompostion). +// 13..7: qcInfo (see below). isYesD is always true (no decomposition). // 6..0: ccc (compressed CCC value). // For v < 0x8000, the respective rune has a decomposition and v is an index // into a byte array of UTF-8 decomposition sequences and additional info and diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/doc.go b/vendor/google.golang.org/protobuf/encoding/protojson/doc.go index 00ea2fec..21d5d2cb 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/doc.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/doc.go @@ -4,7 +4,7 @@ // Package protojson marshals and unmarshals protocol buffer messages as JSON // format. It follows the guide at -// https://developers.google.com/protocol-buffers/docs/proto3#json. +// https://protobuf.dev/programming-guides/proto3#json. // // This package produces a different output than the standard "encoding/json" // package, which does not operate correctly on protocol buffer messages. diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go index c85f8469..6c37d417 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go @@ -814,16 +814,22 @@ func (d decoder) unmarshalTimestamp(m protoreflect.Message) error { return d.unexpectedTokenError(tok) } - t, err := time.Parse(time.RFC3339Nano, tok.ParsedString()) + s := tok.ParsedString() + t, err := time.Parse(time.RFC3339Nano, s) if err != nil { return d.newError(tok.Pos(), "invalid %v value %v", genid.Timestamp_message_fullname, tok.RawString()) } - // Validate seconds. No need to validate nanos because time.Parse would have - // covered that already. + // Validate seconds. secs := t.Unix() if secs < minTimestampSeconds || secs > maxTimestampSeconds { return d.newError(tok.Pos(), "%v value out of range: %v", genid.Timestamp_message_fullname, tok.RawString()) } + // Validate subseconds. + i := strings.LastIndexByte(s, '.') // start of subsecond field + j := strings.LastIndexAny(s, "Z-+") // start of timezone field + if i >= 0 && j >= i && j-i > len(".999999999") { + return d.newError(tok.Pos(), "invalid %v value %v", genid.Timestamp_message_fullname, tok.RawString()) + } fds := m.Descriptor().Fields() fdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number) diff --git a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go index ce57f57e..f4b4686c 100644 --- a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +++ b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package protowire parses and formats the raw wire encoding. -// See https://developers.google.com/protocol-buffers/docs/encoding. +// See https://protobuf.dev/programming-guides/encoding. // // For marshaling and unmarshaling entire protobuf messages, // use the "google.golang.org/protobuf/proto" package instead. @@ -29,12 +29,8 @@ const ( ) // IsValid reports whether the field number is semantically valid. -// -// Note that while numbers within the reserved range are semantically invalid, -// they are syntactically valid in the wire format. -// Implementations may treat records with reserved field numbers as unknown. func (n Number) IsValid() bool { - return MinValidNumber <= n && n < FirstReservedNumber || LastReservedNumber < n && n <= MaxValidNumber + return MinValidNumber <= n && n <= MaxValidNumber } // Type represents the wire type. diff --git a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go index b13fd29e..d043a6eb 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go @@ -294,7 +294,7 @@ func (d *Decoder) isValueNext() bool { } // consumeToken constructs a Token for given Kind with raw value derived from -// current d.in and given size, and consumes the given size-lenght of it. +// current d.in and given size, and consumes the given size-length of it. func (d *Decoder) consumeToken(kind Kind, size int) Token { tok := Token{ kind: kind, diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go index 427c62d0..87853e78 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go @@ -412,12 +412,13 @@ func (d *Decoder) parseFieldName() (tok Token, err error) { // Field number. Identify if input is a valid number that is not negative // and is decimal integer within 32-bit range. if num := parseNumber(d.in); num.size > 0 { + str := num.string(d.in) if !num.neg && num.kind == numDec { - if _, err := strconv.ParseInt(string(d.in[:num.size]), 10, 32); err == nil { + if _, err := strconv.ParseInt(str, 10, 32); err == nil { return d.consumeToken(Name, num.size, uint8(FieldNumber)), nil } } - return Token{}, d.newSyntaxError("invalid field number: %s", d.in[:num.size]) + return Token{}, d.newSyntaxError("invalid field number: %s", str) } return Token{}, d.newSyntaxError("invalid field name: %s", errId(d.in)) diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go index 81a5d8c8..45c81f02 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go @@ -15,17 +15,12 @@ func (d *Decoder) parseNumberValue() (Token, bool) { if num.neg { numAttrs |= isNegative } - strSize := num.size - last := num.size - 1 - if num.kind == numFloat && (d.in[last] == 'f' || d.in[last] == 'F') { - strSize = last - } tok := Token{ kind: Scalar, attrs: numberValue, pos: len(d.orig) - len(d.in), raw: d.in[:num.size], - str: string(d.in[:strSize]), + str: num.string(d.in), numAttrs: numAttrs, } d.consume(num.size) @@ -46,6 +41,27 @@ type number struct { kind uint8 neg bool size int + // if neg, this is the length of whitespace and comments between + // the minus sign and the rest fo the number literal + sep int +} + +func (num number) string(data []byte) string { + strSize := num.size + last := num.size - 1 + if num.kind == numFloat && (data[last] == 'f' || data[last] == 'F') { + strSize = last + } + if num.neg && num.sep > 0 { + // strip whitespace/comments between negative sign and the rest + strLen := strSize - num.sep + str := make([]byte, strLen) + str[0] = data[0] + copy(str[1:], data[num.sep+1:strSize]) + return string(str) + } + return string(data[:strSize]) + } // parseNumber constructs a number object from given input. It allows for the @@ -67,19 +83,22 @@ func parseNumber(input []byte) number { } // Optional - + var sep int if s[0] == '-' { neg = true s = s[1:] size++ + // Consume any whitespace or comments between the + // negative sign and the rest of the number + lenBefore := len(s) + s = consume(s, 0) + sep = lenBefore - len(s) + size += sep if len(s) == 0 { return number{} } } - // C++ allows for whitespace and comments in between the negative sign and - // the rest of the number. This logic currently does not but is consistent - // with v1. - switch { case s[0] == '0': if len(s) > 1 { @@ -116,7 +135,7 @@ func parseNumber(input []byte) number { if len(s) > 0 && !isDelim(s[0]) { return number{} } - return number{kind: kind, neg: neg, size: size} + return number{kind: kind, neg: neg, size: size, sep: sep} } } s = s[1:] @@ -188,5 +207,5 @@ func parseNumber(input []byte) number { return number{} } - return number{kind: kind, neg: neg, size: size} + return number{kind: kind, neg: neg, size: size, sep: sep} } diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go index e3cdf1c2..5c0e8f73 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go @@ -50,6 +50,7 @@ const ( FileDescriptorProto_Options_field_name protoreflect.Name = "options" FileDescriptorProto_SourceCodeInfo_field_name protoreflect.Name = "source_code_info" FileDescriptorProto_Syntax_field_name protoreflect.Name = "syntax" + FileDescriptorProto_Edition_field_name protoreflect.Name = "edition" FileDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.name" FileDescriptorProto_Package_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.package" @@ -63,6 +64,7 @@ const ( FileDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.options" FileDescriptorProto_SourceCodeInfo_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.source_code_info" FileDescriptorProto_Syntax_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.syntax" + FileDescriptorProto_Edition_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.edition" ) // Field numbers for google.protobuf.FileDescriptorProto. @@ -79,6 +81,7 @@ const ( FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8 FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9 FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12 + FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 13 ) // Names for google.protobuf.DescriptorProto. @@ -494,26 +497,29 @@ const ( // Field names for google.protobuf.MessageOptions. const ( - MessageOptions_MessageSetWireFormat_field_name protoreflect.Name = "message_set_wire_format" - MessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = "no_standard_descriptor_accessor" - MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated" - MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry" - MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" + MessageOptions_MessageSetWireFormat_field_name protoreflect.Name = "message_set_wire_format" + MessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = "no_standard_descriptor_accessor" + MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated" + MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry" + MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts" + MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format" - MessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.no_standard_descriptor_accessor" - MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated" - MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry" - MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option" + MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format" + MessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.no_standard_descriptor_accessor" + MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated" + MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry" + MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts" + MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option" ) // Field numbers for google.protobuf.MessageOptions. const ( - MessageOptions_MessageSetWireFormat_field_number protoreflect.FieldNumber = 1 - MessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2 - MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3 - MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7 - MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 + MessageOptions_MessageSetWireFormat_field_number protoreflect.FieldNumber = 1 + MessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2 + MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3 + MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7 + MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 11 + MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) // Names for google.protobuf.FieldOptions. @@ -528,16 +534,24 @@ const ( FieldOptions_Packed_field_name protoreflect.Name = "packed" FieldOptions_Jstype_field_name protoreflect.Name = "jstype" FieldOptions_Lazy_field_name protoreflect.Name = "lazy" + FieldOptions_UnverifiedLazy_field_name protoreflect.Name = "unverified_lazy" FieldOptions_Deprecated_field_name protoreflect.Name = "deprecated" FieldOptions_Weak_field_name protoreflect.Name = "weak" + FieldOptions_DebugRedact_field_name protoreflect.Name = "debug_redact" + FieldOptions_Retention_field_name protoreflect.Name = "retention" + FieldOptions_Target_field_name protoreflect.Name = "target" FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype" FieldOptions_Packed_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.packed" FieldOptions_Jstype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.jstype" FieldOptions_Lazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.lazy" + FieldOptions_UnverifiedLazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.unverified_lazy" FieldOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.deprecated" FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak" + FieldOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.debug_redact" + FieldOptions_Retention_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.retention" + FieldOptions_Target_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.target" FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option" ) @@ -547,8 +561,12 @@ const ( FieldOptions_Packed_field_number protoreflect.FieldNumber = 2 FieldOptions_Jstype_field_number protoreflect.FieldNumber = 6 FieldOptions_Lazy_field_number protoreflect.FieldNumber = 5 + FieldOptions_UnverifiedLazy_field_number protoreflect.FieldNumber = 15 FieldOptions_Deprecated_field_number protoreflect.FieldNumber = 3 FieldOptions_Weak_field_number protoreflect.FieldNumber = 10 + FieldOptions_DebugRedact_field_number protoreflect.FieldNumber = 16 + FieldOptions_Retention_field_number protoreflect.FieldNumber = 17 + FieldOptions_Target_field_number protoreflect.FieldNumber = 18 FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -564,6 +582,18 @@ const ( FieldOptions_JSType_enum_name = "JSType" ) +// Full and short names for google.protobuf.FieldOptions.OptionRetention. +const ( + FieldOptions_OptionRetention_enum_fullname = "google.protobuf.FieldOptions.OptionRetention" + FieldOptions_OptionRetention_enum_name = "OptionRetention" +) + +// Full and short names for google.protobuf.FieldOptions.OptionTargetType. +const ( + FieldOptions_OptionTargetType_enum_fullname = "google.protobuf.FieldOptions.OptionTargetType" + FieldOptions_OptionTargetType_enum_name = "OptionTargetType" +) + // Names for google.protobuf.OneofOptions. const ( OneofOptions_message_name protoreflect.Name = "OneofOptions" @@ -590,20 +620,23 @@ const ( // Field names for google.protobuf.EnumOptions. const ( - EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias" - EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated" - EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" + EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias" + EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated" + EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts" + EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias" - EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated" - EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option" + EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias" + EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated" + EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts" + EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option" ) // Field numbers for google.protobuf.EnumOptions. const ( - EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2 - EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3 - EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 + EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2 + EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3 + EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 6 + EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) // Names for google.protobuf.EnumValueOptions. @@ -813,11 +846,13 @@ const ( GeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = "source_file" GeneratedCodeInfo_Annotation_Begin_field_name protoreflect.Name = "begin" GeneratedCodeInfo_Annotation_End_field_name protoreflect.Name = "end" + GeneratedCodeInfo_Annotation_Semantic_field_name protoreflect.Name = "semantic" GeneratedCodeInfo_Annotation_Path_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.path" GeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.source_file" GeneratedCodeInfo_Annotation_Begin_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.begin" GeneratedCodeInfo_Annotation_End_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.end" + GeneratedCodeInfo_Annotation_Semantic_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.semantic" ) // Field numbers for google.protobuf.GeneratedCodeInfo.Annotation. @@ -826,4 +861,11 @@ const ( GeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2 GeneratedCodeInfo_Annotation_Begin_field_number protoreflect.FieldNumber = 3 GeneratedCodeInfo_Annotation_End_field_number protoreflect.FieldNumber = 4 + GeneratedCodeInfo_Annotation_Semantic_field_number protoreflect.FieldNumber = 5 +) + +// Full and short names for google.protobuf.GeneratedCodeInfo.Annotation.Semantic. +const ( + GeneratedCodeInfo_Annotation_Semantic_enum_fullname = "google.protobuf.GeneratedCodeInfo.Annotation.Semantic" + GeneratedCodeInfo_Annotation_Semantic_enum_name = "Semantic" ) diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go index 11a6128b..185ef2ef 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert.go @@ -59,7 +59,6 @@ func NewConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter { default: return newSingularConverter(t, fd) } - panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName())) } var ( diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go index fea589c4..61a84d34 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go @@ -87,7 +87,7 @@ func (sb *Builder) grow(n int) { // Unlike strings.Builder, we do not need to copy over the contents // of the old buffer since our builder provides no API for // retrieving previously created strings. - sb.buf = make([]byte, 2*(cap(sb.buf)+n)) + sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n)) } func (sb *Builder) last(n int) string { diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index b480c501..f7014cd5 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -51,8 +51,8 @@ import ( // 10. Send out the CL for review and submit it. const ( Major = 1 - Minor = 28 - Patch = 1 + Minor = 30 + Patch = 0 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/proto/doc.go b/vendor/google.golang.org/protobuf/proto/doc.go index 08d2a46f..ec71e717 100644 --- a/vendor/google.golang.org/protobuf/proto/doc.go +++ b/vendor/google.golang.org/protobuf/proto/doc.go @@ -5,16 +5,13 @@ // Package proto provides functions operating on protocol buffer messages. // // For documentation on protocol buffers in general, see: -// -// https://developers.google.com/protocol-buffers +// https://protobuf.dev. // // For a tutorial on using protocol buffers with Go, see: -// -// https://developers.google.com/protocol-buffers/docs/gotutorial +// https://protobuf.dev/getting-started/gotutorial. // // For a guide to generated Go protocol buffer code, see: -// -// https://developers.google.com/protocol-buffers/docs/reference/go-generated +// https://protobuf.dev/reference/go/go-generated. // // # Binary serialization // diff --git a/vendor/google.golang.org/protobuf/proto/equal.go b/vendor/google.golang.org/protobuf/proto/equal.go index 67948dd1..1a0be1b0 100644 --- a/vendor/google.golang.org/protobuf/proto/equal.go +++ b/vendor/google.golang.org/protobuf/proto/equal.go @@ -5,30 +5,39 @@ package proto import ( - "bytes" - "math" "reflect" - "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/reflect/protoreflect" ) -// Equal reports whether two messages are equal. -// If two messages marshal to the same bytes under deterministic serialization, -// then Equal is guaranteed to report true. +// Equal reports whether two messages are equal, +// by recursively comparing the fields of the message. // -// Two messages are equal if they belong to the same message descriptor, -// have the same set of populated known and extension field values, -// and the same set of unknown fields values. If either of the top-level -// messages are invalid, then Equal reports true only if both are invalid. +// - Bytes fields are equal if they contain identical bytes. +// Empty bytes (regardless of nil-ness) are considered equal. // -// Scalar values are compared with the equivalent of the == operator in Go, -// except bytes values which are compared using bytes.Equal and -// floating point values which specially treat NaNs as equal. -// Message values are compared by recursively calling Equal. -// Lists are equal if each element value is also equal. -// Maps are equal if they have the same set of keys, where the pair of values -// for each key is also equal. +// - Floating-point fields are equal if they contain the same value. +// Unlike the == operator, a NaN is equal to another NaN. +// +// - Other scalar fields are equal if they contain the same value. +// +// - Message fields are equal if they have +// the same set of populated known and extension field values, and +// the same set of unknown fields values. +// +// - Lists are equal if they are the same length and +// each corresponding element is equal. +// +// - Maps are equal if they have the same set of keys and +// the corresponding value for each key is equal. +// +// An invalid message is not equal to a valid message. +// An invalid message is only equal to another invalid message of the +// same type. An invalid message often corresponds to a nil pointer +// of the concrete message type. For example, (*pb.M)(nil) is not equal +// to &pb.M{}. +// If two valid messages marshal to the same bytes under deterministic +// serialization, then Equal is guaranteed to report true. func Equal(x, y Message) bool { if x == nil || y == nil { return x == nil && y == nil @@ -42,130 +51,7 @@ func Equal(x, y Message) bool { if mx.IsValid() != my.IsValid() { return false } - return equalMessage(mx, my) -} - -// equalMessage compares two messages. -func equalMessage(mx, my protoreflect.Message) bool { - if mx.Descriptor() != my.Descriptor() { - return false - } - - nx := 0 - equal := true - mx.Range(func(fd protoreflect.FieldDescriptor, vx protoreflect.Value) bool { - nx++ - vy := my.Get(fd) - equal = my.Has(fd) && equalField(fd, vx, vy) - return equal - }) - if !equal { - return false - } - ny := 0 - my.Range(func(fd protoreflect.FieldDescriptor, vx protoreflect.Value) bool { - ny++ - return true - }) - if nx != ny { - return false - } - - return equalUnknown(mx.GetUnknown(), my.GetUnknown()) -} - -// equalField compares two fields. -func equalField(fd protoreflect.FieldDescriptor, x, y protoreflect.Value) bool { - switch { - case fd.IsList(): - return equalList(fd, x.List(), y.List()) - case fd.IsMap(): - return equalMap(fd, x.Map(), y.Map()) - default: - return equalValue(fd, x, y) - } -} - -// equalMap compares two maps. -func equalMap(fd protoreflect.FieldDescriptor, x, y protoreflect.Map) bool { - if x.Len() != y.Len() { - return false - } - equal := true - x.Range(func(k protoreflect.MapKey, vx protoreflect.Value) bool { - vy := y.Get(k) - equal = y.Has(k) && equalValue(fd.MapValue(), vx, vy) - return equal - }) - return equal -} - -// equalList compares two lists. -func equalList(fd protoreflect.FieldDescriptor, x, y protoreflect.List) bool { - if x.Len() != y.Len() { - return false - } - for i := x.Len() - 1; i >= 0; i-- { - if !equalValue(fd, x.Get(i), y.Get(i)) { - return false - } - } - return true -} - -// equalValue compares two singular values. -func equalValue(fd protoreflect.FieldDescriptor, x, y protoreflect.Value) bool { - switch fd.Kind() { - case protoreflect.BoolKind: - return x.Bool() == y.Bool() - case protoreflect.EnumKind: - return x.Enum() == y.Enum() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, - protoreflect.Int64Kind, protoreflect.Sint64Kind, - protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind: - return x.Int() == y.Int() - case protoreflect.Uint32Kind, protoreflect.Uint64Kind, - protoreflect.Fixed32Kind, protoreflect.Fixed64Kind: - return x.Uint() == y.Uint() - case protoreflect.FloatKind, protoreflect.DoubleKind: - fx := x.Float() - fy := y.Float() - if math.IsNaN(fx) || math.IsNaN(fy) { - return math.IsNaN(fx) && math.IsNaN(fy) - } - return fx == fy - case protoreflect.StringKind: - return x.String() == y.String() - case protoreflect.BytesKind: - return bytes.Equal(x.Bytes(), y.Bytes()) - case protoreflect.MessageKind, protoreflect.GroupKind: - return equalMessage(x.Message(), y.Message()) - default: - return x.Interface() == y.Interface() - } -} - -// equalUnknown compares unknown fields by direct comparison on the raw bytes -// of each individual field number. -func equalUnknown(x, y protoreflect.RawFields) bool { - if len(x) != len(y) { - return false - } - if bytes.Equal([]byte(x), []byte(y)) { - return true - } - - mx := make(map[protoreflect.FieldNumber]protoreflect.RawFields) - my := make(map[protoreflect.FieldNumber]protoreflect.RawFields) - for len(x) > 0 { - fnum, _, n := protowire.ConsumeField(x) - mx[fnum] = append(mx[fnum], x[:n]...) - x = x[n:] - } - for len(y) > 0 { - fnum, _, n := protowire.ConsumeField(y) - my[fnum] = append(my[fnum], y[:n]...) - y = y[n:] - } - return reflect.DeepEqual(mx, my) + vx := protoreflect.ValueOfMessage(mx) + vy := protoreflect.ValueOfMessage(my) + return vx.Equal(vy) } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go index b03c1223..54ce326d 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go @@ -35,6 +35,8 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte { b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo) case 12: b = p.appendSingularField(b, "syntax", nil) + case 13: + b = p.appendSingularField(b, "edition", nil) } return b } @@ -236,6 +238,8 @@ func (p *SourcePath) appendMessageOptions(b []byte) []byte { b = p.appendSingularField(b, "deprecated", nil) case 7: b = p.appendSingularField(b, "map_entry", nil) + case 11: + b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -279,6 +283,8 @@ func (p *SourcePath) appendEnumOptions(b []byte) []byte { b = p.appendSingularField(b, "allow_alias", nil) case 3: b = p.appendSingularField(b, "deprecated", nil) + case 6: + b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -345,10 +351,18 @@ func (p *SourcePath) appendFieldOptions(b []byte) []byte { b = p.appendSingularField(b, "jstype", nil) case 5: b = p.appendSingularField(b, "lazy", nil) + case 15: + b = p.appendSingularField(b, "unverified_lazy", nil) case 3: b = p.appendSingularField(b, "deprecated", nil) case 10: b = p.appendSingularField(b, "weak", nil) + case 16: + b = p.appendSingularField(b, "debug_redact", nil) + case 17: + b = p.appendSingularField(b, "retention", nil) + case 18: + b = p.appendSingularField(b, "target", nil) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go index f3198107..37601b78 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go @@ -148,7 +148,7 @@ type Message interface { // be preserved in marshaling or other operations. IsValid() bool - // ProtoMethods returns optional fast-path implementions of various operations. + // ProtoMethods returns optional fast-path implementations of various operations. // This method may return nil. // // The returned methods type is identical to diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go new file mode 100644 index 00000000..59165254 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go @@ -0,0 +1,168 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protoreflect + +import ( + "bytes" + "fmt" + "math" + "reflect" + + "google.golang.org/protobuf/encoding/protowire" +) + +// Equal reports whether v1 and v2 are recursively equal. +// +// - Values of different types are always unequal. +// +// - Bytes values are equal if they contain identical bytes. +// Empty bytes (regardless of nil-ness) are considered equal. +// +// - Floating point values are equal if they contain the same value. +// Unlike the == operator, a NaN is equal to another NaN. +// +// - Enums are equal if they contain the same number. +// Since Value does not contain an enum descriptor, +// enum values do not consider the type of the enum. +// +// - Other scalar values are equal if they contain the same value. +// +// - Message values are equal if they belong to the same message descriptor, +// have the same set of populated known and extension field values, +// and the same set of unknown fields values. +// +// - Lists are equal if they are the same length and +// each corresponding element is equal. +// +// - Maps are equal if they have the same set of keys and +// the corresponding value for each key is equal. +func (v1 Value) Equal(v2 Value) bool { + return equalValue(v1, v2) +} + +func equalValue(x, y Value) bool { + eqType := x.typ == y.typ + switch x.typ { + case nilType: + return eqType + case boolType: + return eqType && x.Bool() == y.Bool() + case int32Type, int64Type: + return eqType && x.Int() == y.Int() + case uint32Type, uint64Type: + return eqType && x.Uint() == y.Uint() + case float32Type, float64Type: + return eqType && equalFloat(x.Float(), y.Float()) + case stringType: + return eqType && x.String() == y.String() + case bytesType: + return eqType && bytes.Equal(x.Bytes(), y.Bytes()) + case enumType: + return eqType && x.Enum() == y.Enum() + default: + switch x := x.Interface().(type) { + case Message: + y, ok := y.Interface().(Message) + return ok && equalMessage(x, y) + case List: + y, ok := y.Interface().(List) + return ok && equalList(x, y) + case Map: + y, ok := y.Interface().(Map) + return ok && equalMap(x, y) + default: + panic(fmt.Sprintf("unknown type: %T", x)) + } + } +} + +// equalFloat compares two floats, where NaNs are treated as equal. +func equalFloat(x, y float64) bool { + if math.IsNaN(x) || math.IsNaN(y) { + return math.IsNaN(x) && math.IsNaN(y) + } + return x == y +} + +// equalMessage compares two messages. +func equalMessage(mx, my Message) bool { + if mx.Descriptor() != my.Descriptor() { + return false + } + + nx := 0 + equal := true + mx.Range(func(fd FieldDescriptor, vx Value) bool { + nx++ + vy := my.Get(fd) + equal = my.Has(fd) && equalValue(vx, vy) + return equal + }) + if !equal { + return false + } + ny := 0 + my.Range(func(fd FieldDescriptor, vx Value) bool { + ny++ + return true + }) + if nx != ny { + return false + } + + return equalUnknown(mx.GetUnknown(), my.GetUnknown()) +} + +// equalList compares two lists. +func equalList(x, y List) bool { + if x.Len() != y.Len() { + return false + } + for i := x.Len() - 1; i >= 0; i-- { + if !equalValue(x.Get(i), y.Get(i)) { + return false + } + } + return true +} + +// equalMap compares two maps. +func equalMap(x, y Map) bool { + if x.Len() != y.Len() { + return false + } + equal := true + x.Range(func(k MapKey, vx Value) bool { + vy := y.Get(k) + equal = y.Has(k) && equalValue(vx, vy) + return equal + }) + return equal +} + +// equalUnknown compares unknown fields by direct comparison on the raw bytes +// of each individual field number. +func equalUnknown(x, y RawFields) bool { + if len(x) != len(y) { + return false + } + if bytes.Equal([]byte(x), []byte(y)) { + return true + } + + mx := make(map[FieldNumber]RawFields) + my := make(map[FieldNumber]RawFields) + for len(x) > 0 { + fnum, _, n := protowire.ConsumeField(x) + mx[fnum] = append(mx[fnum], x[:n]...) + x = x[n:] + } + for len(y) > 0 { + fnum, _, n := protowire.ConsumeField(y) + my[fnum] = append(my[fnum], y[:n]...) + y = y[n:] + } + return reflect.DeepEqual(mx, my) +} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go index ca8e28c5..08e5ef73 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go @@ -54,11 +54,11 @@ import ( // // Append a 0 to a "repeated int32" field. // // Since the Value returned by Mutable is guaranteed to alias // // the source message, modifying the Value modifies the message. -// message.Mutable(fieldDesc).(List).Append(protoreflect.ValueOfInt32(0)) +// message.Mutable(fieldDesc).List().Append(protoreflect.ValueOfInt32(0)) // // // Assign [0] to a "repeated int32" field by creating a new Value, // // modifying it, and assigning it. -// list := message.NewField(fieldDesc).(List) +// list := message.NewField(fieldDesc).List() // list.Append(protoreflect.ValueOfInt32(0)) // message.Set(fieldDesc, list) // // ERROR: Since it is not defined whether Set aliases the source, diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go index 58352a69..aeb55977 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +++ b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go @@ -46,7 +46,7 @@ var conflictPolicy = "panic" // "panic" | "warn" | "ignore" // It is a variable so that the behavior is easily overridden in another file. var ignoreConflict = func(d protoreflect.Descriptor, err error) bool { const env = "GOLANG_PROTOBUF_REGISTRATION_CONFLICT" - const faq = "https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict" + const faq = "https://protobuf.dev/reference/go/faq#namespace-conflict" policy := conflictPolicy if v := os.Getenv(env); v != "" { policy = v diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go index abe4ab51..dac5671d 100644 --- a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -406,6 +406,152 @@ func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 1} } +// If set to RETENTION_SOURCE, the option will be omitted from the binary. +// Note: as of January 2023, support for this is in progress and does not yet +// have an effect (b/264593489). +type FieldOptions_OptionRetention int32 + +const ( + FieldOptions_RETENTION_UNKNOWN FieldOptions_OptionRetention = 0 + FieldOptions_RETENTION_RUNTIME FieldOptions_OptionRetention = 1 + FieldOptions_RETENTION_SOURCE FieldOptions_OptionRetention = 2 +) + +// Enum value maps for FieldOptions_OptionRetention. +var ( + FieldOptions_OptionRetention_name = map[int32]string{ + 0: "RETENTION_UNKNOWN", + 1: "RETENTION_RUNTIME", + 2: "RETENTION_SOURCE", + } + FieldOptions_OptionRetention_value = map[string]int32{ + "RETENTION_UNKNOWN": 0, + "RETENTION_RUNTIME": 1, + "RETENTION_SOURCE": 2, + } +) + +func (x FieldOptions_OptionRetention) Enum() *FieldOptions_OptionRetention { + p := new(FieldOptions_OptionRetention) + *p = x + return p +} + +func (x FieldOptions_OptionRetention) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldOptions_OptionRetention) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() +} + +func (FieldOptions_OptionRetention) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[5] +} + +func (x FieldOptions_OptionRetention) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FieldOptions_OptionRetention) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FieldOptions_OptionRetention(num) + return nil +} + +// Deprecated: Use FieldOptions_OptionRetention.Descriptor instead. +func (FieldOptions_OptionRetention) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 2} +} + +// This indicates the types of entities that the field may apply to when used +// as an option. If it is unset, then the field may be freely used as an +// option on any kind of entity. Note: as of January 2023, support for this is +// in progress and does not yet have an effect (b/264593489). +type FieldOptions_OptionTargetType int32 + +const ( + FieldOptions_TARGET_TYPE_UNKNOWN FieldOptions_OptionTargetType = 0 + FieldOptions_TARGET_TYPE_FILE FieldOptions_OptionTargetType = 1 + FieldOptions_TARGET_TYPE_EXTENSION_RANGE FieldOptions_OptionTargetType = 2 + FieldOptions_TARGET_TYPE_MESSAGE FieldOptions_OptionTargetType = 3 + FieldOptions_TARGET_TYPE_FIELD FieldOptions_OptionTargetType = 4 + FieldOptions_TARGET_TYPE_ONEOF FieldOptions_OptionTargetType = 5 + FieldOptions_TARGET_TYPE_ENUM FieldOptions_OptionTargetType = 6 + FieldOptions_TARGET_TYPE_ENUM_ENTRY FieldOptions_OptionTargetType = 7 + FieldOptions_TARGET_TYPE_SERVICE FieldOptions_OptionTargetType = 8 + FieldOptions_TARGET_TYPE_METHOD FieldOptions_OptionTargetType = 9 +) + +// Enum value maps for FieldOptions_OptionTargetType. +var ( + FieldOptions_OptionTargetType_name = map[int32]string{ + 0: "TARGET_TYPE_UNKNOWN", + 1: "TARGET_TYPE_FILE", + 2: "TARGET_TYPE_EXTENSION_RANGE", + 3: "TARGET_TYPE_MESSAGE", + 4: "TARGET_TYPE_FIELD", + 5: "TARGET_TYPE_ONEOF", + 6: "TARGET_TYPE_ENUM", + 7: "TARGET_TYPE_ENUM_ENTRY", + 8: "TARGET_TYPE_SERVICE", + 9: "TARGET_TYPE_METHOD", + } + FieldOptions_OptionTargetType_value = map[string]int32{ + "TARGET_TYPE_UNKNOWN": 0, + "TARGET_TYPE_FILE": 1, + "TARGET_TYPE_EXTENSION_RANGE": 2, + "TARGET_TYPE_MESSAGE": 3, + "TARGET_TYPE_FIELD": 4, + "TARGET_TYPE_ONEOF": 5, + "TARGET_TYPE_ENUM": 6, + "TARGET_TYPE_ENUM_ENTRY": 7, + "TARGET_TYPE_SERVICE": 8, + "TARGET_TYPE_METHOD": 9, + } +) + +func (x FieldOptions_OptionTargetType) Enum() *FieldOptions_OptionTargetType { + p := new(FieldOptions_OptionTargetType) + *p = x + return p +} + +func (x FieldOptions_OptionTargetType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldOptions_OptionTargetType) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[6].Descriptor() +} + +func (FieldOptions_OptionTargetType) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[6] +} + +func (x FieldOptions_OptionTargetType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FieldOptions_OptionTargetType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FieldOptions_OptionTargetType(num) + return nil +} + +// Deprecated: Use FieldOptions_OptionTargetType.Descriptor instead. +func (FieldOptions_OptionTargetType) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 3} +} + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, // or neither? HTTP based RPC implementation may choose GET verb for safe // methods, and PUT verb for idempotent methods instead of the default POST. @@ -442,11 +588,11 @@ func (x MethodOptions_IdempotencyLevel) String() string { } func (MethodOptions_IdempotencyLevel) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[7].Descriptor() } func (MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[5] + return &file_google_protobuf_descriptor_proto_enumTypes[7] } func (x MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber { @@ -468,6 +614,70 @@ func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17, 0} } +// Represents the identified object's effect on the element in the original +// .proto file. +type GeneratedCodeInfo_Annotation_Semantic int32 + +const ( + // There is no effect or the effect is indescribable. + GeneratedCodeInfo_Annotation_NONE GeneratedCodeInfo_Annotation_Semantic = 0 + // The element is set or otherwise mutated. + GeneratedCodeInfo_Annotation_SET GeneratedCodeInfo_Annotation_Semantic = 1 + // An alias to the element is returned. + GeneratedCodeInfo_Annotation_ALIAS GeneratedCodeInfo_Annotation_Semantic = 2 +) + +// Enum value maps for GeneratedCodeInfo_Annotation_Semantic. +var ( + GeneratedCodeInfo_Annotation_Semantic_name = map[int32]string{ + 0: "NONE", + 1: "SET", + 2: "ALIAS", + } + GeneratedCodeInfo_Annotation_Semantic_value = map[string]int32{ + "NONE": 0, + "SET": 1, + "ALIAS": 2, + } +) + +func (x GeneratedCodeInfo_Annotation_Semantic) Enum() *GeneratedCodeInfo_Annotation_Semantic { + p := new(GeneratedCodeInfo_Annotation_Semantic) + *p = x + return p +} + +func (x GeneratedCodeInfo_Annotation_Semantic) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GeneratedCodeInfo_Annotation_Semantic) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[8].Descriptor() +} + +func (GeneratedCodeInfo_Annotation_Semantic) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[8] +} + +func (x GeneratedCodeInfo_Annotation_Semantic) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *GeneratedCodeInfo_Annotation_Semantic) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = GeneratedCodeInfo_Annotation_Semantic(num) + return nil +} + +// Deprecated: Use GeneratedCodeInfo_Annotation_Semantic.Descriptor instead. +func (GeneratedCodeInfo_Annotation_Semantic) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0, 0} +} + // The protocol compiler can output a FileDescriptorSet containing the .proto // files it parses. type FileDescriptorSet struct { @@ -544,8 +754,12 @@ type FileDescriptorProto struct { // development tools. SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` // The syntax of the proto file. - // The supported values are "proto2" and "proto3". + // The supported values are "proto2", "proto3", and "editions". + // + // If `edition` is present, this value must be "editions". Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + // The edition of the proto file, which is an opaque string. + Edition *string `protobuf:"bytes,13,opt,name=edition" json:"edition,omitempty"` } func (x *FileDescriptorProto) Reset() { @@ -664,6 +878,13 @@ func (x *FileDescriptorProto) GetSyntax() string { return "" } +func (x *FileDescriptorProto) GetEdition() string { + if x != nil && x.Edition != nil { + return *x.Edition + } + return "" +} + // Describes a message type. type DescriptorProto struct { state protoimpl.MessageState @@ -860,7 +1081,6 @@ type FieldDescriptorProto struct { // For booleans, "true" or "false". // For strings, contains the default text contents (not escaped in any way). // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` // If set, gives the index of a oneof in the containing type's oneof_decl // list. This field is a member of that oneof. @@ -1382,22 +1602,22 @@ type FileOptions struct { // inappropriate because proto packages do not normally start with backwards // domain names. JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). + // Controls the name of the wrapper Java class generated for the .proto file. + // That class will always contain the .proto file's getDescriptor() method as + // well as any top-level extensions defined in the .proto file. + // If java_multiple_files is disabled, then all the other classes from the + // .proto file will be nested inside the single wrapper outer class. JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` - // If set true, then the Java code generator will generate a separate .java + // If enabled, then the Java code generator will generate a separate .java // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be + // file. Thus, these types will *not* be nested inside the wrapper class + // named by java_outer_classname. However, the wrapper class will still be // generated to contain the file's getDescriptor() method as well as any // top-level extensions defined in the file. JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` // This option does nothing. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // If set true, then the Java2 code generator will generate code that // throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -1531,7 +1751,7 @@ func (x *FileOptions) GetJavaMultipleFiles() bool { return Default_FileOptions_JavaMultipleFiles } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. func (x *FileOptions) GetJavaGenerateEqualsAndHash() bool { if x != nil && x.JavaGenerateEqualsAndHash != nil { return *x.JavaGenerateEqualsAndHash @@ -1670,10 +1890,12 @@ type MessageOptions struct { // efficient, has fewer features, and is more complicated. // // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } + // + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // // Note that the message cannot have any defined fields; MessageSets only // have extensions. // @@ -1692,28 +1914,44 @@ type MessageOptions struct { // for the message, or it will be completely ignored; in the very least, // this is a formalization for deprecating messages. Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + // // Whether the message is an automatically generated map entry type for the // maps field. // // For maps fields: - // map map_field = 1; + // + // map map_field = 1; + // // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; + // + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; // // Implementations may choose not to generate the map_entry=true message, but // use a native map in the target language to hold the keys and values. // The reflection APIs in such implementations still need to work as // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // + // This should only be used as a temporary measure against broken builds due + // to the change in behavior for JSON field name conflicts. + // + // TODO(b/261750190) This is legacy behavior we plan to remove once downstream + // teams have had time to migrate. + // + // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. + DeprecatedLegacyJsonFieldConflicts *bool `protobuf:"varint,11,opt,name=deprecated_legacy_json_field_conflicts,json=deprecatedLegacyJsonFieldConflicts" json:"deprecated_legacy_json_field_conflicts,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -1785,6 +2023,14 @@ func (x *MessageOptions) GetMapEntry() bool { return false } +// Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. +func (x *MessageOptions) GetDeprecatedLegacyJsonFieldConflicts() bool { + if x != nil && x.DeprecatedLegacyJsonFieldConflicts != nil { + return *x.DeprecatedLegacyJsonFieldConflicts + } + return false +} + func (x *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -1838,7 +2084,6 @@ type FieldOptions struct { // call from multiple threads concurrently, while non-const methods continue // to require exclusive access. // - // // Note that implementations may choose not to check required fields within // a lazy sub-message. That is, calling IsInitialized() on the outer message // may return true even if the inner message has missing required fields. @@ -1849,7 +2094,14 @@ type FieldOptions struct { // implementation must either *always* check its required fields, or *never* // check its required fields, regardless of whether or not the message has // been parsed. + // + // As of May 2022, lazy verifies the contents of the byte stream during + // parsing. An invalid byte stream will cause the overall parsing to fail. Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // unverified_lazy does no correctness checks on the byte stream. This should + // only be used where lazy with verification is prohibitive for performance + // reasons. + UnverifiedLazy *bool `protobuf:"varint,15,opt,name=unverified_lazy,json=unverifiedLazy,def=0" json:"unverified_lazy,omitempty"` // Is this field deprecated? // Depending on the target platform, this can emit Deprecated annotations // for accessors, or it will be completely ignored; in the very least, this @@ -1857,17 +2109,24 @@ type FieldOptions struct { Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // For Google-internal migration only. Do not use. Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // Indicate that the field value should not be printed out when using debug + // formats, e.g. when the field contains sensitive credentials. + DebugRedact *bool `protobuf:"varint,16,opt,name=debug_redact,json=debugRedact,def=0" json:"debug_redact,omitempty"` + Retention *FieldOptions_OptionRetention `protobuf:"varint,17,opt,name=retention,enum=google.protobuf.FieldOptions_OptionRetention" json:"retention,omitempty"` + Target *FieldOptions_OptionTargetType `protobuf:"varint,18,opt,name=target,enum=google.protobuf.FieldOptions_OptionTargetType" json:"target,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } // Default values for FieldOptions fields. const ( - Default_FieldOptions_Ctype = FieldOptions_STRING - Default_FieldOptions_Jstype = FieldOptions_JS_NORMAL - Default_FieldOptions_Lazy = bool(false) - Default_FieldOptions_Deprecated = bool(false) - Default_FieldOptions_Weak = bool(false) + Default_FieldOptions_Ctype = FieldOptions_STRING + Default_FieldOptions_Jstype = FieldOptions_JS_NORMAL + Default_FieldOptions_Lazy = bool(false) + Default_FieldOptions_UnverifiedLazy = bool(false) + Default_FieldOptions_Deprecated = bool(false) + Default_FieldOptions_Weak = bool(false) + Default_FieldOptions_DebugRedact = bool(false) ) func (x *FieldOptions) Reset() { @@ -1930,6 +2189,13 @@ func (x *FieldOptions) GetLazy() bool { return Default_FieldOptions_Lazy } +func (x *FieldOptions) GetUnverifiedLazy() bool { + if x != nil && x.UnverifiedLazy != nil { + return *x.UnverifiedLazy + } + return Default_FieldOptions_UnverifiedLazy +} + func (x *FieldOptions) GetDeprecated() bool { if x != nil && x.Deprecated != nil { return *x.Deprecated @@ -1944,6 +2210,27 @@ func (x *FieldOptions) GetWeak() bool { return Default_FieldOptions_Weak } +func (x *FieldOptions) GetDebugRedact() bool { + if x != nil && x.DebugRedact != nil { + return *x.DebugRedact + } + return Default_FieldOptions_DebugRedact +} + +func (x *FieldOptions) GetRetention() FieldOptions_OptionRetention { + if x != nil && x.Retention != nil { + return *x.Retention + } + return FieldOptions_RETENTION_UNKNOWN +} + +func (x *FieldOptions) GetTarget() FieldOptions_OptionTargetType { + if x != nil && x.Target != nil { + return *x.Target + } + return FieldOptions_TARGET_TYPE_UNKNOWN +} + func (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2014,6 +2301,15 @@ type EnumOptions struct { // for the enum, or it will be completely ignored; in the very least, this // is a formalization for deprecating enums. Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // TODO(b/261750190) Remove this legacy behavior once downstream teams have + // had time to migrate. + // + // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. + DeprecatedLegacyJsonFieldConflicts *bool `protobuf:"varint,6,opt,name=deprecated_legacy_json_field_conflicts,json=deprecatedLegacyJsonFieldConflicts" json:"deprecated_legacy_json_field_conflicts,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2069,6 +2365,14 @@ func (x *EnumOptions) GetDeprecated() bool { return Default_EnumOptions_Deprecated } +// Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. +func (x *EnumOptions) GetDeprecatedLegacyJsonFieldConflicts() bool { + if x != nil && x.DeprecatedLegacyJsonFieldConflicts != nil { + return *x.DeprecatedLegacyJsonFieldConflicts + } + return false +} + func (x *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2399,43 +2703,48 @@ type SourceCodeInfo struct { // tools. // // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } + // + // message Foo { + // optional string foo = 1; + // } + // // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi + // + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). // // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendant. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` } @@ -2715,8 +3024,8 @@ func (x *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { // The name of the uninterpreted option. Each string represents a segment in // a dot-separated name. is_extension is true iff a segment represents an // extension (denoted with parentheses in options specs in .proto files). -// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents -// "foo.(bar.baz).qux". +// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents +// "foo.(bar.baz).moo". type UninterpretedOption_NamePart struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2781,23 +3090,34 @@ type SourceCodeInfo_Location struct { // location. // // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] + // the root FileDescriptorProto to the place where the definition occurs. + // For example, this path: + // + // [ 4, 3, 2, 7, 1 ] + // // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 + // + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; + // + // repeated DescriptorProto message_type = 4; + // // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; + // + // repeated FieldDescriptorProto field = 2; + // // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; + // + // optional string name = 1; // // Thus, the above path gives the location of a field name. If we removed // the last element: - // [ 4, 3, 2, 7 ] + // + // [ 4, 3, 2, 7 ] + // // this path refers to the whole field declaration (from the beginning // of the label to the terminating semicolon). Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` @@ -2826,34 +3146,34 @@ type SourceCodeInfo_Location struct { // // Examples: // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; + // // Comment attached to moo. + // // + // // Another line attached to moo. + // optional double moo = 4; // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. + // // Detached comment for corge. This is not leading or trailing comments + // // to moo or corge because there are blank lines separating it from + // // both. // - // // Detached comment for corge paragraph 2. + // // Detached comment for corge paragraph 2. // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; // - // // ignored detached comments. + // // ignored detached comments. LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` @@ -2940,9 +3260,10 @@ type GeneratedCodeInfo_Annotation struct { // that relates to the identified object. Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past + // relates to the identified object. The end offset should be one past // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + Semantic *GeneratedCodeInfo_Annotation_Semantic `protobuf:"varint,5,opt,name=semantic,enum=google.protobuf.GeneratedCodeInfo_Annotation_Semantic" json:"semantic,omitempty"` } func (x *GeneratedCodeInfo_Annotation) Reset() { @@ -3005,6 +3326,13 @@ func (x *GeneratedCodeInfo_Annotation) GetEnd() int32 { return 0 } +func (x *GeneratedCodeInfo_Annotation) GetSemantic() GeneratedCodeInfo_Annotation_Semantic { + if x != nil && x.Semantic != nil { + return *x.Semantic + } + return GeneratedCodeInfo_Annotation_NONE +} + var File_google_protobuf_descriptor_proto protoreflect.FileDescriptor var file_google_protobuf_descriptor_proto_rawDesc = []byte{ @@ -3016,7 +3344,7 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, - 0x6c, 0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x6c, 0x65, 0x22, 0xfe, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, @@ -3054,330 +3382,391 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, + 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, + 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, + 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, + 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, + 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, + 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, + 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, + 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, + 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, + 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, + 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, + 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, + 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, + 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, + 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, + 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, + 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, + 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, + 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, + 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, + 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, + 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, + 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, + 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, + 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, + 0x03, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, + 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, + 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, - 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, - 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, - 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, - 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, - 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, - 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, - 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, - 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, - 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, - 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, - 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, - 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, - 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, - 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, - 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, - 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, - 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, - 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, - 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, - 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, - 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, - 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, - 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, - 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, - 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, - 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, - 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, - 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, - 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, - 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x91, - 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, - 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, - 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, - 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, - 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c, - 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, - 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, - 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, - 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, - 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, - 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, - 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c, - 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53, - 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, - 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, - 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70, + 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, + 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, + 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x91, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, + 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, + 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, + 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, + 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, + 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, + 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, + 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, + 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, + 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, + 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, + 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, + 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, + 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, + 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, - 0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, - 0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, - 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, - 0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, - 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, - 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, - 0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, - 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x72, 0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, - 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, - 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, - 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, - 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, - 0x10, 0x27, 0x22, 0xd1, 0x02, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, - 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, - 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, - 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, - 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, + 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, + 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, + 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, + 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, 0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, + 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, + 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, + 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, + 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, + 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, + 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, + 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, + 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x70, 0x68, + 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, - 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, - 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xe2, 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, + 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, + 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, + 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, + 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xbb, 0x03, 0x0a, + 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, + 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, + 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, + 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, + 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x42, + 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, + 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, + 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, + 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, + 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xb7, 0x08, 0x0a, 0x0c, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, + 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, - 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, - 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, - 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, - 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, - 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, - 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, - 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, - 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, - 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, - 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, - 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, - 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, - 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, + 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, + 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, + 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, + 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x12, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, - 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, - 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, - 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, + 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, + 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, + 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, + 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, + 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, + 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, + 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, + 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, + 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, + 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, + 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, + 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, + 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, + 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, + 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, + 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, + 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, + 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x98, 0x02, 0x0a, 0x0b, 0x45, 0x6e, + 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, + 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, + 0x08, 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, + 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, @@ -3385,97 +3774,95 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, - 0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, - 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x80, 0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, + 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, + 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, + 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, + 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, + 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, + 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, + 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, + 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, + 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, + 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, + 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, + 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, - 0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, - 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, - 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, - 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, - 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, - 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, - 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, - 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, - 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, - 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, - 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, - 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, - 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, - 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, - 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, - 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, - 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, - 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, - 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, - 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, - 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, - 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, - 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, - 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, - 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd1, 0x01, - 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, - 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, - 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, - 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, - 0x64, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, + 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, + 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, + 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, + 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, + 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, + 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, + 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, + 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd0, + 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, + 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, + 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, + 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, 0x73, + 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, 0x6e, + 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x10, + 0x02, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, @@ -3498,7 +3885,7 @@ func file_google_protobuf_descriptor_proto_rawDescGZIP() []byte { return file_google_protobuf_descriptor_proto_rawDescData } -var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 9) var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_google_protobuf_descriptor_proto_goTypes = []interface{}{ (FieldDescriptorProto_Type)(0), // 0: google.protobuf.FieldDescriptorProto.Type @@ -3506,84 +3893,90 @@ var file_google_protobuf_descriptor_proto_goTypes = []interface{}{ (FileOptions_OptimizeMode)(0), // 2: google.protobuf.FileOptions.OptimizeMode (FieldOptions_CType)(0), // 3: google.protobuf.FieldOptions.CType (FieldOptions_JSType)(0), // 4: google.protobuf.FieldOptions.JSType - (MethodOptions_IdempotencyLevel)(0), // 5: google.protobuf.MethodOptions.IdempotencyLevel - (*FileDescriptorSet)(nil), // 6: google.protobuf.FileDescriptorSet - (*FileDescriptorProto)(nil), // 7: google.protobuf.FileDescriptorProto - (*DescriptorProto)(nil), // 8: google.protobuf.DescriptorProto - (*ExtensionRangeOptions)(nil), // 9: google.protobuf.ExtensionRangeOptions - (*FieldDescriptorProto)(nil), // 10: google.protobuf.FieldDescriptorProto - (*OneofDescriptorProto)(nil), // 11: google.protobuf.OneofDescriptorProto - (*EnumDescriptorProto)(nil), // 12: google.protobuf.EnumDescriptorProto - (*EnumValueDescriptorProto)(nil), // 13: google.protobuf.EnumValueDescriptorProto - (*ServiceDescriptorProto)(nil), // 14: google.protobuf.ServiceDescriptorProto - (*MethodDescriptorProto)(nil), // 15: google.protobuf.MethodDescriptorProto - (*FileOptions)(nil), // 16: google.protobuf.FileOptions - (*MessageOptions)(nil), // 17: google.protobuf.MessageOptions - (*FieldOptions)(nil), // 18: google.protobuf.FieldOptions - (*OneofOptions)(nil), // 19: google.protobuf.OneofOptions - (*EnumOptions)(nil), // 20: google.protobuf.EnumOptions - (*EnumValueOptions)(nil), // 21: google.protobuf.EnumValueOptions - (*ServiceOptions)(nil), // 22: google.protobuf.ServiceOptions - (*MethodOptions)(nil), // 23: google.protobuf.MethodOptions - (*UninterpretedOption)(nil), // 24: google.protobuf.UninterpretedOption - (*SourceCodeInfo)(nil), // 25: google.protobuf.SourceCodeInfo - (*GeneratedCodeInfo)(nil), // 26: google.protobuf.GeneratedCodeInfo - (*DescriptorProto_ExtensionRange)(nil), // 27: google.protobuf.DescriptorProto.ExtensionRange - (*DescriptorProto_ReservedRange)(nil), // 28: google.protobuf.DescriptorProto.ReservedRange - (*EnumDescriptorProto_EnumReservedRange)(nil), // 29: google.protobuf.EnumDescriptorProto.EnumReservedRange - (*UninterpretedOption_NamePart)(nil), // 30: google.protobuf.UninterpretedOption.NamePart - (*SourceCodeInfo_Location)(nil), // 31: google.protobuf.SourceCodeInfo.Location - (*GeneratedCodeInfo_Annotation)(nil), // 32: google.protobuf.GeneratedCodeInfo.Annotation + (FieldOptions_OptionRetention)(0), // 5: google.protobuf.FieldOptions.OptionRetention + (FieldOptions_OptionTargetType)(0), // 6: google.protobuf.FieldOptions.OptionTargetType + (MethodOptions_IdempotencyLevel)(0), // 7: google.protobuf.MethodOptions.IdempotencyLevel + (GeneratedCodeInfo_Annotation_Semantic)(0), // 8: google.protobuf.GeneratedCodeInfo.Annotation.Semantic + (*FileDescriptorSet)(nil), // 9: google.protobuf.FileDescriptorSet + (*FileDescriptorProto)(nil), // 10: google.protobuf.FileDescriptorProto + (*DescriptorProto)(nil), // 11: google.protobuf.DescriptorProto + (*ExtensionRangeOptions)(nil), // 12: google.protobuf.ExtensionRangeOptions + (*FieldDescriptorProto)(nil), // 13: google.protobuf.FieldDescriptorProto + (*OneofDescriptorProto)(nil), // 14: google.protobuf.OneofDescriptorProto + (*EnumDescriptorProto)(nil), // 15: google.protobuf.EnumDescriptorProto + (*EnumValueDescriptorProto)(nil), // 16: google.protobuf.EnumValueDescriptorProto + (*ServiceDescriptorProto)(nil), // 17: google.protobuf.ServiceDescriptorProto + (*MethodDescriptorProto)(nil), // 18: google.protobuf.MethodDescriptorProto + (*FileOptions)(nil), // 19: google.protobuf.FileOptions + (*MessageOptions)(nil), // 20: google.protobuf.MessageOptions + (*FieldOptions)(nil), // 21: google.protobuf.FieldOptions + (*OneofOptions)(nil), // 22: google.protobuf.OneofOptions + (*EnumOptions)(nil), // 23: google.protobuf.EnumOptions + (*EnumValueOptions)(nil), // 24: google.protobuf.EnumValueOptions + (*ServiceOptions)(nil), // 25: google.protobuf.ServiceOptions + (*MethodOptions)(nil), // 26: google.protobuf.MethodOptions + (*UninterpretedOption)(nil), // 27: google.protobuf.UninterpretedOption + (*SourceCodeInfo)(nil), // 28: google.protobuf.SourceCodeInfo + (*GeneratedCodeInfo)(nil), // 29: google.protobuf.GeneratedCodeInfo + (*DescriptorProto_ExtensionRange)(nil), // 30: google.protobuf.DescriptorProto.ExtensionRange + (*DescriptorProto_ReservedRange)(nil), // 31: google.protobuf.DescriptorProto.ReservedRange + (*EnumDescriptorProto_EnumReservedRange)(nil), // 32: google.protobuf.EnumDescriptorProto.EnumReservedRange + (*UninterpretedOption_NamePart)(nil), // 33: google.protobuf.UninterpretedOption.NamePart + (*SourceCodeInfo_Location)(nil), // 34: google.protobuf.SourceCodeInfo.Location + (*GeneratedCodeInfo_Annotation)(nil), // 35: google.protobuf.GeneratedCodeInfo.Annotation } var file_google_protobuf_descriptor_proto_depIdxs = []int32{ - 7, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto - 8, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto - 12, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 14, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto - 10, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 16, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions - 25, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo - 10, // 7: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto - 10, // 8: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 8, // 9: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto - 12, // 10: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 27, // 11: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange - 11, // 12: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto - 17, // 13: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions - 28, // 14: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange - 24, // 15: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 10, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto + 11, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto + 15, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 17, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto + 13, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 19, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions + 28, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo + 13, // 7: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto + 13, // 8: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 11, // 9: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto + 15, // 10: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 30, // 11: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange + 14, // 12: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto + 20, // 13: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions + 31, // 14: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange + 27, // 15: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption 1, // 16: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label 0, // 17: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type - 18, // 18: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions - 19, // 19: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions - 13, // 20: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto - 20, // 21: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions - 29, // 22: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange - 21, // 23: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions - 15, // 24: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto - 22, // 25: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions - 23, // 26: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions + 21, // 18: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions + 22, // 19: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions + 16, // 20: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto + 23, // 21: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions + 32, // 22: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange + 24, // 23: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions + 18, // 24: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto + 25, // 25: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions + 26, // 26: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions 2, // 27: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode - 24, // 28: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // 29: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 27, // 28: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 27, // 29: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption 3, // 30: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType 4, // 31: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType - 24, // 32: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // 33: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // 34: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // 35: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 24, // 36: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 5, // 37: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel - 24, // 38: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 30, // 39: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart - 31, // 40: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location - 32, // 41: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation - 9, // 42: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions - 43, // [43:43] is the sub-list for method output_type - 43, // [43:43] is the sub-list for method input_type - 43, // [43:43] is the sub-list for extension type_name - 43, // [43:43] is the sub-list for extension extendee - 0, // [0:43] is the sub-list for field type_name + 5, // 32: google.protobuf.FieldOptions.retention:type_name -> google.protobuf.FieldOptions.OptionRetention + 6, // 33: google.protobuf.FieldOptions.target:type_name -> google.protobuf.FieldOptions.OptionTargetType + 27, // 34: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 27, // 35: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 27, // 36: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 27, // 37: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 27, // 38: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 7, // 39: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel + 27, // 40: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 33, // 41: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart + 34, // 42: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location + 35, // 43: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation + 12, // 44: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions + 8, // 45: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic + 46, // [46:46] is the sub-list for method output_type + 46, // [46:46] is the sub-list for method input_type + 46, // [46:46] is the sub-list for extension type_name + 46, // [46:46] is the sub-list for extension extendee + 0, // [0:46] is the sub-list for field type_name } func init() { file_google_protobuf_descriptor_proto_init() } @@ -3940,7 +4333,7 @@ func file_google_protobuf_descriptor_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_google_protobuf_descriptor_proto_rawDesc, - NumEnums: 6, + NumEnums: 9, NumMessages: 27, NumExtensions: 0, NumServices: 0, diff --git a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go index 8c10797b..a6c7a33f 100644 --- a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go @@ -37,8 +37,7 @@ // It is functionally a tuple of the full name of the remote message type and // the serialized bytes of the remote message value. // -// -// Constructing an Any +// # Constructing an Any // // An Any message containing another message value is constructed using New: // @@ -48,8 +47,7 @@ // } // ... // make use of any // -// -// Unmarshaling an Any +// # Unmarshaling an Any // // With a populated Any message, the underlying message can be serialized into // a remote concrete message value in a few ways. @@ -95,8 +93,7 @@ // listed in the case clauses are linked into the Go binary and therefore also // registered in the global registry. // -// -// Type checking an Any +// # Type checking an Any // // In order to type check whether an Any message represents some other message, // then use the MessageIs method: @@ -115,7 +112,6 @@ // } // ... // make use of m // } -// package anypb import ( @@ -136,45 +132,49 @@ import ( // // Example 1: Pack and unpack a message in C++. // -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } // // Example 2: Pack and unpack a message in Java. // -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// // or ... +// if (any.isSameTypeAs(Foo.getDefaultInstance())) { +// foo = any.unpack(Foo.getDefaultInstance()); +// } // -// Example 3: Pack and unpack a message in Python. +// Example 3: Pack and unpack a message in Python. // -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... // -// Example 4: Pack and unpack a message in Go +// Example 4: Pack and unpack a message in Go // -// foo := &pb.Foo{...} -// any, err := anypb.New(foo) -// if err != nil { -// ... -// } -// ... -// foo := &pb.Foo{} -// if err := any.UnmarshalTo(foo); err != nil { -// ... -// } +// foo := &pb.Foo{...} +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } +// ... +// foo := &pb.Foo{} +// if err := any.UnmarshalTo(foo); err != nil { +// ... +// } // // The pack methods provided by protobuf library will by default use // 'type.googleapis.com/full.type.name' as the type URL and the unpack @@ -182,35 +182,33 @@ import ( // in the type URL, for example "foo.bar.com/x/y.z" will yield type // name "y.z". // +// # JSON // -// JSON -// ==== // The JSON representation of an `Any` value uses the regular // representation of the deserialized, embedded message, with an // additional field `@type` which contains the type URL. Example: // -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } // -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } // // If the embedded message type is well-known and has a custom JSON // representation, that representation will be embedded adding a field // `value` which holds the custom JSON in addition to the `@type` // field. Example (for message [google.protobuf.Duration][]): // -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } type Any struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -228,14 +226,14 @@ type Any struct { // scheme `http`, `https`, or no scheme, one can optionally set up a type // server that maps type URLs to message definitions as follows: // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) + // - If no scheme is provided, `https` is assumed. + // - An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // - Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) // // Note: this functionality is not currently available in the official // protobuf release, and it is not used for type URLs beginning with @@ -243,7 +241,6 @@ type Any struct { // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. - // TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` // Must be a valid serialized protocol buffer of the above specified type. Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` diff --git a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go index a583ca2f..df709a8d 100644 --- a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go @@ -35,8 +35,7 @@ // // The Duration message represents a signed span of time. // -// -// Conversion to a Go Duration +// # Conversion to a Go Duration // // The AsDuration method can be used to convert a Duration message to a // standard Go time.Duration value: @@ -65,15 +64,13 @@ // the resulting value to the closest representable value (e.g., math.MaxInt64 // for positive overflow and math.MinInt64 for negative overflow). // -// -// Conversion from a Go Duration +// # Conversion from a Go Duration // // The durationpb.New function can be used to construct a Duration message // from a standard Go time.Duration value: // // dur := durationpb.New(d) // ... // make use of d as a *durationpb.Duration -// package durationpb import ( @@ -96,43 +93,43 @@ import ( // // Example 1: Compute Duration from two Timestamps in pseudo code. // -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; +// Timestamp start = ...; +// Timestamp end = ...; +// Duration duration = ...; // -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; +// duration.seconds = end.seconds - start.seconds; +// duration.nanos = end.nanos - start.nanos; // -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (duration.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } +// if (duration.seconds < 0 && duration.nanos > 0) { +// duration.seconds += 1; +// duration.nanos -= 1000000000; +// } else if (duration.seconds > 0 && duration.nanos < 0) { +// duration.seconds -= 1; +// duration.nanos += 1000000000; +// } // // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. // -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; +// Timestamp start = ...; +// Duration duration = ...; +// Timestamp end = ...; // -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; +// end.seconds = start.seconds + duration.seconds; +// end.nanos = start.nanos + duration.nanos; // -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } +// if (end.nanos < 0) { +// end.seconds -= 1; +// end.nanos += 1000000000; +// } else if (end.nanos >= 1000000000) { +// end.seconds += 1; +// end.nanos -= 1000000000; +// } // // Example 3: Compute Duration from datetime.timedelta in Python. // -// td = datetime.timedelta(days=3, minutes=10) -// duration = Duration() -// duration.FromTimedelta(td) +// td = datetime.timedelta(days=3, minutes=10) +// duration = Duration() +// duration.FromTimedelta(td) // // # JSON Mapping // @@ -143,8 +140,6 @@ import ( // encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should // be expressed in JSON format as "3.000000001s", and 3 seconds and 1 // microsecond should be expressed in JSON format as "3.000001s". -// -// type Duration struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go index c9ae9213..61f69fc1 100644 --- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go @@ -36,8 +36,7 @@ // The Timestamp message represents a timestamp, // an instant in time since the Unix epoch (January 1st, 1970). // -// -// Conversion to a Go Time +// # Conversion to a Go Time // // The AsTime method can be used to convert a Timestamp message to a // standard Go time.Time value in UTC: @@ -59,8 +58,7 @@ // ... // handle error // } // -// -// Conversion from a Go Time +// # Conversion from a Go Time // // The timestamppb.New function can be used to construct a Timestamp message // from a standard Go time.Time value: @@ -72,7 +70,6 @@ // // ts := timestamppb.Now() // ... // make use of ts as a *timestamppb.Timestamp -// package timestamppb import ( @@ -101,52 +98,50 @@ import ( // // Example 1: Compute Timestamp from POSIX `time()`. // -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); +// Timestamp timestamp; +// timestamp.set_seconds(time(NULL)); +// timestamp.set_nanos(0); // // Example 2: Compute Timestamp from POSIX `gettimeofday()`. // -// struct timeval tv; -// gettimeofday(&tv, NULL); +// struct timeval tv; +// gettimeofday(&tv, NULL); // -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); +// Timestamp timestamp; +// timestamp.set_seconds(tv.tv_sec); +// timestamp.set_nanos(tv.tv_usec * 1000); // // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. // -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +// FILETIME ft; +// GetSystemTimeAsFileTime(&ft); +// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; // -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +// Timestamp timestamp; +// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); // // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. // -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); +// long millis = System.currentTimeMillis(); // +// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +// .setNanos((int) ((millis % 1000) * 1000000)).build(); // // Example 5: Compute Timestamp from Java `Instant.now()`. // -// Instant now = Instant.now(); -// -// Timestamp timestamp = -// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) -// .setNanos(now.getNano()).build(); +// Instant now = Instant.now(); // +// Timestamp timestamp = +// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +// .setNanos(now.getNano()).build(); // // Example 6: Compute Timestamp from current time in Python. // -// timestamp = Timestamp() -// timestamp.GetCurrentTime() +// timestamp = Timestamp() +// timestamp.GetCurrentTime() // // # JSON Mapping // @@ -174,8 +169,6 @@ import ( // the Joda Time's [`ISODateTimeFormat.dateTime()`]( // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D // ) to obtain a formatter capable of generating timestamps in this format. -// -// type Timestamp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/modules.txt b/vendor/modules.txt index be871c2d..831ff7fc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,7 +2,7 @@ ## explicit; go 1.17 filippo.io/edwards25519 filippo.io/edwards25519/field -# github.com/ManyakRus/logrus v0.0.0-20230425135901-49786dc30ad1 +# github.com/ManyakRus/logrus v0.0.0-20230426064230-515895169d22 ## explicit; go 1.13 github.com/ManyakRus/logrus # github.com/andybalholm/brotli v1.0.4 @@ -30,10 +30,30 @@ github.com/denisenkom/go-mssqldb/internal/cp github.com/denisenkom/go-mssqldb/internal/decimal github.com/denisenkom/go-mssqldb/internal/querytext github.com/denisenkom/go-mssqldb/msdsn +# github.com/emersion/go-imap v1.2.1 +## explicit; go 1.13 +github.com/emersion/go-imap +github.com/emersion/go-imap/client +github.com/emersion/go-imap/commands +github.com/emersion/go-imap/responses +github.com/emersion/go-imap/utf7 +# github.com/emersion/go-message v0.16.0 +## explicit; go 1.14 +github.com/emersion/go-message +github.com/emersion/go-message/mail +github.com/emersion/go-message/textproto +# github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 +## explicit; go 1.12 +github.com/emersion/go-sasl +# github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 +## explicit +github.com/emersion/go-textwrapper # github.com/go-ozzo/ozzo-validation/v4 v4.3.0 ## explicit; go 1.13 github.com/go-ozzo/ozzo-validation/v4 github.com/go-ozzo/ozzo-validation/v4/is +# github.com/go-test/deep v1.1.0 +## explicit; go 1.16 # github.com/gofiber/fiber/v2 v2.42.0 ## explicit; go 1.20 github.com/gofiber/fiber/v2 @@ -202,9 +222,9 @@ github.com/pmezard/go-difflib/difflib # github.com/rivo/uniseg v0.2.0 ## explicit; go 1.12 github.com/rivo/uniseg -# github.com/sashabaranov/go-gpt3 v1.3.1 -## explicit; go 1.17 -github.com/sashabaranov/go-gpt3 +# github.com/sashabaranov/go-openai v1.9.1 +## explicit; go 1.18 +github.com/sashabaranov/go-openai # github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 ## explicit; go 1.13 github.com/savsgio/dictpool @@ -261,6 +281,9 @@ github.com/stretchr/testify/suite # github.com/tinylib/msgp v1.1.6 ## explicit; go 1.14 github.com/tinylib/msgp/msgp +# github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 +## explicit +github.com/toorop/go-dkim # github.com/valyala/bytebufferpool v1.0.0 ## explicit github.com/valyala/bytebufferpool @@ -282,6 +305,9 @@ github.com/vmihailenco/msgpack/v5/msgpcode github.com/vmihailenco/tagparser/v2 github.com/vmihailenco/tagparser/v2/internal github.com/vmihailenco/tagparser/v2/internal/parser +# github.com/xhit/go-simple-mail/v2 v2.13.0 +## explicit; go 1.13 +github.com/xhit/go-simple-mail/v2 # gitlab.aescorp.ru/dsp_dev/claim/common/object_model v0.0.108 ## explicit; go 1.17 gitlab.aescorp.ru/dsp_dev/claim/common/object_model @@ -314,7 +340,7 @@ go.mau.fi/libsignal/util/errorhelper go.mau.fi/libsignal/util/keyhelper go.mau.fi/libsignal/util/medium go.mau.fi/libsignal/util/optional -# go.mau.fi/whatsmeow v0.0.0-20230226124255-e5c8f3c95d78 +# go.mau.fi/whatsmeow v0.0.0-20230427180258-7f679583b39b ## explicit; go 1.19 go.mau.fi/whatsmeow go.mau.fi/whatsmeow/appstate @@ -332,7 +358,7 @@ go.mau.fi/whatsmeow/util/gcmutil go.mau.fi/whatsmeow/util/hkdfutil go.mau.fi/whatsmeow/util/keys go.mau.fi/whatsmeow/util/log -# golang.org/x/crypto v0.6.0 +# golang.org/x/crypto v0.8.0 ## explicit; go 1.17 golang.org/x/crypto/curve25519 golang.org/x/crypto/curve25519/internal/field @@ -343,7 +369,7 @@ golang.org/x/crypto/pbkdf2 # golang.org/x/exp v0.0.0-20230418202329-0354be287a23 ## explicit; go 1.18 golang.org/x/exp/maps -# golang.org/x/net v0.6.0 +# golang.org/x/net v0.9.0 ## explicit; go 1.17 golang.org/x/net/context golang.org/x/net/context/ctxhttp @@ -358,14 +384,16 @@ golang.org/x/net/trace golang.org/x/oauth2 golang.org/x/oauth2/clientcredentials golang.org/x/oauth2/internal -# golang.org/x/sys v0.5.0 +# golang.org/x/sys v0.7.0 ## explicit; go 1.17 golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/text v0.7.0 +# golang.org/x/text v0.9.0 ## explicit; go 1.17 golang.org/x/text/cases +golang.org/x/text/encoding +golang.org/x/text/encoding/internal/identifier golang.org/x/text/internal golang.org/x/text/internal/language golang.org/x/text/internal/language/compact @@ -440,7 +468,7 @@ google.golang.org/grpc/serviceconfig google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap -# google.golang.org/protobuf v1.28.1 +# google.golang.org/protobuf v1.30.0 ## explicit; go 1.11 google.golang.org/protobuf/encoding/protojson google.golang.org/protobuf/encoding/prototext