Tulir Asokan 6 жил өмнө
parent
commit
1cccefd34c
100 өөрчлөгдсөн 158 нэмэгдсэн , 26408 устгасан
  1. 0 201
      Gopkg.lock
  2. 0 64
      Gopkg.toml
  3. 3 1
      commands.go
  4. 2 0
      config/bridge.go
  5. 1 0
      config/config.go
  6. 2 1
      database/database.go
  7. 3 1
      database/message.go
  8. 2 1
      database/portal.go
  9. 2 1
      database/puppet.go
  10. 3 1
      database/user.go
  11. 5 4
      formatting.go
  12. 19 0
      go.mod
  13. 43 0
      go.sum
  14. 2 1
      main.go
  15. 16 15
      matrix.go
  16. 44 42
      portal.go
  17. 3 1
      puppet.go
  18. 3 3
      statestore.go
  19. 5 5
      user.go
  20. 0 2
      vendor/github.com/Rhymen/go-whatsapp/.gitignore
  21. 0 21
      vendor/github.com/Rhymen/go-whatsapp/LICENSE
  22. 0 104
      vendor/github.com/Rhymen/go-whatsapp/README.md
  23. 0 388
      vendor/github.com/Rhymen/go-whatsapp/binary/decoder.go
  24. 0 351
      vendor/github.com/Rhymen/go-whatsapp/binary/encoder.go
  25. 0 103
      vendor/github.com/Rhymen/go-whatsapp/binary/node.go
  26. 0 3800
      vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.pb.go
  27. 0 417
      vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.proto
  28. 0 78
      vendor/github.com/Rhymen/go-whatsapp/binary/token/token.go
  29. 0 389
      vendor/github.com/Rhymen/go-whatsapp/conn.go
  30. 0 255
      vendor/github.com/Rhymen/go-whatsapp/contact.go
  31. 0 101
      vendor/github.com/Rhymen/go-whatsapp/crypto/cbc/cbc.go
  32. 0 44
      vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go
  33. 0 52
      vendor/github.com/Rhymen/go-whatsapp/crypto/hkdf/hkdf.go
  34. 0 169
      vendor/github.com/Rhymen/go-whatsapp/handler.go
  35. 0 199
      vendor/github.com/Rhymen/go-whatsapp/media.go
  36. 0 442
      vendor/github.com/Rhymen/go-whatsapp/message.go
  37. 0 389
      vendor/github.com/Rhymen/go-whatsapp/session.go
  38. 0 45
      vendor/github.com/Rhymen/go-whatsapp/store.go
  39. 0 5
      vendor/github.com/fatih/color/.travis.yml
  40. 0 27
      vendor/github.com/fatih/color/Gopkg.lock
  41. 0 30
      vendor/github.com/fatih/color/Gopkg.toml
  42. 0 20
      vendor/github.com/fatih/color/LICENSE.md
  43. 0 179
      vendor/github.com/fatih/color/README.md
  44. 0 603
      vendor/github.com/fatih/color/color.go
  45. 0 133
      vendor/github.com/fatih/color/doc.go
  46. 0 3
      vendor/github.com/golang/protobuf/AUTHORS
  47. 0 3
      vendor/github.com/golang/protobuf/CONTRIBUTORS
  48. 0 28
      vendor/github.com/golang/protobuf/LICENSE
  49. 0 253
      vendor/github.com/golang/protobuf/proto/clone.go
  50. 0 428
      vendor/github.com/golang/protobuf/proto/decode.go
  51. 0 350
      vendor/github.com/golang/protobuf/proto/discard.go
  52. 0 203
      vendor/github.com/golang/protobuf/proto/encode.go
  53. 0 300
      vendor/github.com/golang/protobuf/proto/equal.go
  54. 0 543
      vendor/github.com/golang/protobuf/proto/extensions.go
  55. 0 979
      vendor/github.com/golang/protobuf/proto/lib.go
  56. 0 314
      vendor/github.com/golang/protobuf/proto/message_set.go
  57. 0 357
      vendor/github.com/golang/protobuf/proto/pointer_reflect.go
  58. 0 308
      vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
  59. 0 544
      vendor/github.com/golang/protobuf/proto/properties.go
  60. 0 2767
      vendor/github.com/golang/protobuf/proto/table_marshal.go
  61. 0 654
      vendor/github.com/golang/protobuf/proto/table_merge.go
  62. 0 2051
      vendor/github.com/golang/protobuf/proto/table_unmarshal.go
  63. 0 843
      vendor/github.com/golang/protobuf/proto/text.go
  64. 0 880
      vendor/github.com/golang/protobuf/proto/text_parser.go
  65. 0 19
      vendor/github.com/gorilla/context/.travis.yml
  66. 0 27
      vendor/github.com/gorilla/context/LICENSE
  67. 0 10
      vendor/github.com/gorilla/context/README.md
  68. 0 143
      vendor/github.com/gorilla/context/context.go
  69. 0 88
      vendor/github.com/gorilla/context/doc.go
  70. 0 23
      vendor/github.com/gorilla/mux/.travis.yml
  71. 0 11
      vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md
  72. 0 27
      vendor/github.com/gorilla/mux/LICENSE
  73. 0 649
      vendor/github.com/gorilla/mux/README.md
  74. 0 26
      vendor/github.com/gorilla/mux/context_gorilla.go
  75. 0 24
      vendor/github.com/gorilla/mux/context_native.go
  76. 0 306
      vendor/github.com/gorilla/mux/doc.go
  77. 0 72
      vendor/github.com/gorilla/mux/middleware.go
  78. 0 588
      vendor/github.com/gorilla/mux/mux.go
  79. 0 332
      vendor/github.com/gorilla/mux/regexp.go
  80. 0 763
      vendor/github.com/gorilla/mux/route.go
  81. 0 19
      vendor/github.com/gorilla/mux/test_helpers.go
  82. 0 25
      vendor/github.com/gorilla/websocket/.gitignore
  83. 0 19
      vendor/github.com/gorilla/websocket/.travis.yml
  84. 0 9
      vendor/github.com/gorilla/websocket/AUTHORS
  85. 0 22
      vendor/github.com/gorilla/websocket/LICENSE
  86. 0 64
      vendor/github.com/gorilla/websocket/README.md
  87. 0 395
      vendor/github.com/gorilla/websocket/client.go
  88. 0 16
      vendor/github.com/gorilla/websocket/client_clone.go
  89. 0 38
      vendor/github.com/gorilla/websocket/client_clone_legacy.go
  90. 0 148
      vendor/github.com/gorilla/websocket/compression.go
  91. 0 1165
      vendor/github.com/gorilla/websocket/conn.go
  92. 0 15
      vendor/github.com/gorilla/websocket/conn_write.go
  93. 0 18
      vendor/github.com/gorilla/websocket/conn_write_legacy.go
  94. 0 180
      vendor/github.com/gorilla/websocket/doc.go
  95. 0 60
      vendor/github.com/gorilla/websocket/json.go
  96. 0 54
      vendor/github.com/gorilla/websocket/mask.go
  97. 0 15
      vendor/github.com/gorilla/websocket/mask_safe.go
  98. 0 102
      vendor/github.com/gorilla/websocket/prepared.go
  99. 0 77
      vendor/github.com/gorilla/websocket/proxy.go
  100. 0 363
      vendor/github.com/gorilla/websocket/server.go

+ 0 - 201
Gopkg.lock

@@ -1,201 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
-  branch = "master"
-  digest = "1:a61c18c5d4f7dc36969d6dd360102075358afda537677d384de9bc981632e206"
-  name = "github.com/Rhymen/go-whatsapp"
-  packages = [
-    ".",
-    "binary",
-    "binary/proto",
-    "binary/token",
-    "crypto/cbc",
-    "crypto/curve25519",
-    "crypto/hkdf",
-  ]
-  pruneopts = "UT"
-  revision = "fd35ed50821362de2c766c451dfb1a11e12b5c4e"
-
-[[projects]]
-  digest = "1:865079840386857c809b72ce300be7580cb50d3d3129ce11bf9aa6ca2bc1934a"
-  name = "github.com/fatih/color"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4"
-  version = "v1.7.0"
-
-[[projects]]
-  digest = "1:97df918963298c287643883209a2c3f642e6593379f97ab400c2a2e219ab647d"
-  name = "github.com/golang/protobuf"
-  packages = ["proto"]
-  pruneopts = "UT"
-  revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
-  version = "v1.2.0"
-
-[[projects]]
-  digest = "1:c79fb010be38a59d657c48c6ba1d003a8aa651fa56b579d959d74573b7dff8e1"
-  name = "github.com/gorilla/context"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
-  version = "v1.1.1"
-
-[[projects]]
-  digest = "1:e73f5b0152105f18bc131fba127d9949305c8693f8a762588a82a48f61756f5f"
-  name = "github.com/gorilla/mux"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf"
-  version = "v1.6.2"
-
-[[projects]]
-  digest = "1:7b5c6e2eeaa9ae5907c391a91c132abfd5c9e8a784a341b5625e750c67e6825d"
-  name = "github.com/gorilla/websocket"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "66b9c49e59c6c48f0ffce28c2d8b8a5678502c6d"
-  version = "v1.4.0"
-
-[[projects]]
-  digest = "1:c658e84ad3916da105a761660dcaeb01e63416c8ec7bc62256a9b411a05fcd67"
-  name = "github.com/mattn/go-colorable"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
-  version = "v0.0.9"
-
-[[projects]]
-  digest = "1:0981502f9816113c9c8c4ac301583841855c8cf4da8c72f696b3ebedf6d0e4e5"
-  name = "github.com/mattn/go-isatty"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c"
-  version = "v0.0.4"
-
-[[projects]]
-  digest = "1:4a49346ca45376a2bba679ca0e83bec949d780d4e927931317904bad482943ec"
-  name = "github.com/mattn/go-sqlite3"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "c7c4067b79cc51e6dfdcef5c702e74b1e0fa7c75"
-  version = "v1.10.0"
-
-[[projects]]
-  branch = "master"
-  digest = "1:def689e73e9252f6f7fe66834a76751a41b767e03daab299e607e7226c58a855"
-  name = "github.com/shurcooL/sanitized_anchor_name"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "86672fcb3f950f35f2e675df2240550f2a50762f"
-
-[[projects]]
-  branch = "master"
-  digest = "1:bf1cb2d456a753d515d90e43c4b05afa4837e75d7808d1752607b91007ce25bb"
-  name = "github.com/skip2/go-qrcode"
-  packages = [
-    ".",
-    "bitset",
-    "reedsolomon",
-  ]
-  pruneopts = "UT"
-  revision = "cf5f9fa2f0d847edb8e038db7ed975e239095e1a"
-
-[[projects]]
-  branch = "master"
-  digest = "1:969079c35a5f96673cb14543c49a03c3dae91e7219147eca0cfced9f82fbabf3"
-  name = "golang.org/x/crypto"
-  packages = [
-    "curve25519",
-    "hkdf",
-  ]
-  pruneopts = "UT"
-  revision = "505ab145d0a99da450461ae2c1a9f6cd10d1f447"
-
-[[projects]]
-  branch = "master"
-  digest = "1:1a1ecfa7b54ca3f7a0115ab5c578d7d6a5d8b605839c549e80260468c42f8be7"
-  name = "golang.org/x/net"
-  packages = [
-    "html",
-    "html/atom",
-  ]
-  pruneopts = "UT"
-  revision = "891ebc4b82d6e74f468c533b06f983c7be918a96"
-
-[[projects]]
-  branch = "master"
-  digest = "1:48a949ee15f5f03524b792547822221b07f828dd26522b5e08688f25a10d14c1"
-  name = "golang.org/x/sys"
-  packages = ["unix"]
-  pruneopts = "UT"
-  revision = "4d1cda033e0619309c606fc686de3adcf599539e"
-
-[[projects]]
-  digest = "1:2ee0f15eb0fb04f918db7c2dcf39745f40d69f798ef171610a730e8a56aaa4fd"
-  name = "gopkg.in/russross/blackfriday.v2"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "d3b5b032dc8e8927d31a5071b56e14c89f045135"
-  version = "v2.0.1"
-
-[[projects]]
-  digest = "1:4d2e5a73dc1500038e504a8d78b986630e3626dc027bc030ba5c75da257cdb96"
-  name = "gopkg.in/yaml.v2"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "51d6538a90f86fe93ac480b35f37b2be17fef232"
-  version = "v2.2.2"
-
-[[projects]]
-  branch = "master"
-  digest = "1:96b43c61e79c3513e19b056f4e4bf5549277e788cc712ae209165e00cb03125f"
-  name = "maunium.net/go/gomatrix"
-  packages = [
-    ".",
-    "format",
-  ]
-  pruneopts = "UT"
-  revision = "de42b317fe25aa9aaebb5219afae90c92b8a3ea8"
-
-[[projects]]
-  branch = "master"
-  digest = "1:184639f9d6556e9afb2549cab03863a1496039b2d9b184ab368e6b32ae106097"
-  name = "maunium.net/go/mauflag"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "8337821952ba5e919673bd62c502d43474e5e71d"
-
-[[projects]]
-  branch = "master"
-  digest = "1:4954a951a4e89b8c42c75a5c0caab7baff4cf36eab7e9a01274c7c3011445dbd"
-  name = "maunium.net/go/maulogger"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "ed98745dedb5f9296c1b2a0ed9424d7347d7e7d4"
-
-[[projects]]
-  branch = "master"
-  digest = "1:1489e76c1885bcc75a591b50ed055e435f081e8c959c350833787011240174dc"
-  name = "maunium.net/go/mautrix-appservice"
-  packages = ["."]
-  pruneopts = "UT"
-  revision = "edcf9d415342721a03cda9ba0bac0b84dd221b34"
-
-[solve-meta]
-  analyzer-name = "dep"
-  analyzer-version = 1
-  input-imports = [
-    "github.com/Rhymen/go-whatsapp",
-    "github.com/Rhymen/go-whatsapp/binary/proto",
-    "github.com/mattn/go-sqlite3",
-    "github.com/skip2/go-qrcode",
-    "gopkg.in/yaml.v2",
-    "maunium.net/go/gomatrix",
-    "maunium.net/go/gomatrix/format",
-    "maunium.net/go/mauflag",
-    "maunium.net/go/maulogger",
-    "maunium.net/go/mautrix-appservice",
-  ]
-  solver-name = "gps-cdcl"
-  solver-version = 1

+ 0 - 64
Gopkg.toml

@@ -1,64 +0,0 @@
-# Gopkg.toml example
-#
-# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-#   name = "github.com/user/project"
-#   version = "1.0.0"
-#
-# [[constraint]]
-#   name = "github.com/user/project2"
-#   branch = "dev"
-#   source = "github.com/myfork/project2"
-#
-# [[override]]
-#   name = "github.com/x/y"
-#   version = "2.4.0"
-#
-# [prune]
-#   non-go = false
-#   go-tests = true
-#   unused-packages = true
-
-
-[[constraint]]
-  branch = "master"
-  name = "github.com/Rhymen/go-whatsapp"
-#  branch = "develop"
-#  source = "github.com/tulir/go-whatsapp"
-
-[[constraint]]
-  name = "github.com/mattn/go-sqlite3"
-  version = "1.9.0"
-
-[[constraint]]
-  branch = "master"
-  name = "github.com/skip2/go-qrcode"
-
-[[constraint]]
-  name = "gopkg.in/yaml.v2"
-  version = "2.2.1"
-
-[[constraint]]
-  branch = "master"
-  name = "maunium.net/go/gomatrix"
-
-[[constraint]]
-  branch = "master"
-  name = "maunium.net/go/mauflag"
-
-[[constraint]]
-  name = "maunium.net/go/maulogger"
-  branch = "master"
-
-[[constraint]]
-  branch = "master"
-  name = "maunium.net/go/mautrix-appservice"
-
-[prune]
-  go-tests = true
-  unused-packages = true

+ 3 - 1
commands.go

@@ -20,8 +20,10 @@ import (
 	"strings"
 
 	"github.com/Rhymen/go-whatsapp"
-	"maunium.net/go/maulogger"
+
+	"maunium.net/go/maulogger/v2"
 	"maunium.net/go/mautrix-appservice"
+
 	"maunium.net/go/mautrix-whatsapp/database"
 	"maunium.net/go/mautrix-whatsapp/types"
 	"maunium.net/go/mautrix-whatsapp/whatsapp-ext"

+ 2 - 0
config/bridge.go

@@ -23,7 +23,9 @@ import (
 	"text/template"
 
 	"github.com/Rhymen/go-whatsapp"
+
 	"maunium.net/go/mautrix-appservice"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 )
 

+ 1 - 0
config/config.go

@@ -20,6 +20,7 @@ import (
 	"io/ioutil"
 
 	"gopkg.in/yaml.v2"
+
 	"maunium.net/go/mautrix-appservice"
 )
 

+ 2 - 1
database/database.go

@@ -20,7 +20,8 @@ import (
 	"database/sql"
 
 	_ "github.com/mattn/go-sqlite3"
-	log "maunium.net/go/maulogger"
+
+	log "maunium.net/go/maulogger/v2"
 )
 
 type Database struct {

+ 3 - 1
database/message.go

@@ -22,7 +22,9 @@ import (
 	"encoding/json"
 
 	waProto "github.com/Rhymen/go-whatsapp/binary/proto"
-	log "maunium.net/go/maulogger"
+
+	log "maunium.net/go/maulogger/v2"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 )
 

+ 2 - 1
database/portal.go

@@ -20,7 +20,8 @@ import (
 	"database/sql"
 	"strings"
 
-	log "maunium.net/go/maulogger"
+	log "maunium.net/go/maulogger/v2"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 )
 

+ 2 - 1
database/puppet.go

@@ -19,7 +19,8 @@ package database
 import (
 	"database/sql"
 
-	log "maunium.net/go/maulogger"
+	log "maunium.net/go/maulogger/v2"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 )
 

+ 3 - 1
database/user.go

@@ -21,7 +21,9 @@ import (
 	"strings"
 
 	"github.com/Rhymen/go-whatsapp"
-	log "maunium.net/go/maulogger"
+
+	log "maunium.net/go/maulogger/v2"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 	"maunium.net/go/mautrix-whatsapp/whatsapp-ext"
 )

+ 5 - 4
formatting.go

@@ -22,8 +22,9 @@ import (
 	"regexp"
 	"strings"
 
-	"maunium.net/go/gomatrix"
-	"maunium.net/go/gomatrix/format"
+	"maunium.net/go/mautrix"
+	"maunium.net/go/mautrix/format"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 	"maunium.net/go/mautrix-whatsapp/whatsapp-ext"
 )
@@ -116,7 +117,7 @@ func (formatter *Formatter) getMatrixInfoByJID(jid types.WhatsAppID) (mxid, disp
 	return
 }
 
-func (formatter *Formatter) ParseWhatsApp(content *gomatrix.Content) {
+func (formatter *Formatter) ParseWhatsApp(content *mautrix.Content) {
 	output := html.EscapeString(content.Body)
 	for regex, replacement := range formatter.waReplString {
 		output = regex.ReplaceAllString(output, replacement)
@@ -126,7 +127,7 @@ func (formatter *Formatter) ParseWhatsApp(content *gomatrix.Content) {
 	}
 	if output != content.Body {
 		content.FormattedBody = output
-		content.Format = gomatrix.FormatHTML
+		content.Format = mautrix.FormatHTML
 		for regex, replacer := range formatter.waReplFuncText {
 			content.Body = regex.ReplaceAllStringFunc(content.Body, replacer)
 		}

+ 19 - 0
go.mod

@@ -0,0 +1,19 @@
+module maunium.net/go/mautrix-whatsapp
+
+require (
+	github.com/Rhymen/go-whatsapp v0.0.0-20181218094654-2ca6af00572c
+	github.com/mattn/go-sqlite3 v1.10.0
+	github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect
+	github.com/skip2/go-qrcode v0.0.0-20171229120447-cf5f9fa2f0d8
+	golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
+	golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 // indirect
+	gopkg.in/yaml.v2 v2.2.2
+	maunium.net/go/mauflag v1.0.0
+	maunium.net/go/maulogger/v2 v2.0.0
+	maunium.net/go/mautrix v0.1.0-alpha.2
+	maunium.net/go/mautrix-appservice v0.1.0-alpha.2
+)
+
+replace maunium.net/go/mautrix-appservice => ../mautrix-appservice-go
+
+replace maunium.net/go/mautrix => ../mautrix-go

+ 43 - 0
go.sum

@@ -0,0 +1,43 @@
+github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f/go.mod h1:4a58ifQTEe2uwwsaqbh3i2un5/CBPg+At/qHpt18Tmk=
+github.com/Rhymen/go-whatsapp v0.0.0-20181218094654-2ca6af00572c h1:ldRXgMEfKmzBomrZusl3edG9AGEeztA7jovLEQy62us=
+github.com/Rhymen/go-whatsapp v0.0.0-20181218094654-2ca6af00572c/go.mod h1:MSDmePOOkbFFbVW2WRRppBcbA+aabwpXRgyIIG7jDFQ=
+github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk=
+github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
+github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
+github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
+github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
+github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 h1:/vdW8Cb7EXrkqWGufVMES1OH2sU9gKVb2n9/1y5NMBY=
+github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
+github.com/skip2/go-qrcode v0.0.0-20171229120447-cf5f9fa2f0d8 h1:5C4yAeYifeRO+7z2/H2kxL8tJZE9ZE9LpxK6YUZPByo=
+github.com/skip2/go-qrcode v0.0.0-20171229120447-cf5f9fa2f0d8/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
+golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
+golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20181212120007-b05ddf57801d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+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/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
+maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
+maunium.net/go/maulogger/v2 v2.0.0 h1:8PB95zf6e7Ddw8iOWqjrJjAjPcAI50LagA1X0Ur64os=
+maunium.net/go/maulogger/v2 v2.0.0/go.mod h1:Hbbkq3NV6jvJodByZu1mgEF3fpT7Kz9z0MjEZ3/BusI=
+maunium.net/go/mautrix v0.1.0-alpha.2 h1:NsLc5tyrp5tyrKTvFSmqcLi+FISQ+FsuWC/ycL08PzI=
+maunium.net/go/mautrix v0.1.0-alpha.2/go.mod h1:C8akEpHpmmO8gQhLvmInr3HujhUXyKvCoCAzFsxHjGE=
+maunium.net/go/mautrix-appservice v0.1.0-alpha.2 h1:DjD51rUN8TevayBmL4lOd0bDOpOuC1LpGIJ1BPJpZZI=
+maunium.net/go/mautrix-appservice v0.1.0-alpha.2/go.mod h1:KBMPJMDtUuyDm0qgG851O0mOrm5toYiOftvwzqTGs6k=

+ 2 - 1
main.go

@@ -24,8 +24,9 @@ import (
 	"syscall"
 
 	flag "maunium.net/go/mauflag"
-	log "maunium.net/go/maulogger"
+	log "maunium.net/go/maulogger/v2"
 	"maunium.net/go/mautrix-appservice"
+
 	"maunium.net/go/mautrix-whatsapp/config"
 	"maunium.net/go/mautrix-whatsapp/database"
 	"maunium.net/go/mautrix-whatsapp/types"

+ 16 - 15
matrix.go

@@ -19,9 +19,10 @@ package main
 import (
 	"strings"
 
-	"maunium.net/go/gomatrix"
-	"maunium.net/go/maulogger"
+	"maunium.net/go/maulogger/v2"
+	"maunium.net/go/mautrix"
 	"maunium.net/go/mautrix-appservice"
+
 	"maunium.net/go/mautrix-whatsapp/types"
 )
 
@@ -39,15 +40,15 @@ func NewMatrixHandler(bridge *Bridge) *MatrixHandler {
 		log:    bridge.Log.Sub("Matrix"),
 		cmd:    NewCommandHandler(bridge),
 	}
-	bridge.EventProcessor.On(gomatrix.EventMessage, handler.HandleMessage)
-	bridge.EventProcessor.On(gomatrix.StateMember, handler.HandleMembership)
-	bridge.EventProcessor.On(gomatrix.StateRoomName, handler.HandleRoomMetadata)
-	bridge.EventProcessor.On(gomatrix.StateRoomAvatar, handler.HandleRoomMetadata)
-	bridge.EventProcessor.On(gomatrix.StateTopic, handler.HandleRoomMetadata)
+	bridge.EventProcessor.On(mautrix.EventMessage, handler.HandleMessage)
+	bridge.EventProcessor.On(mautrix.StateMember, handler.HandleMembership)
+	bridge.EventProcessor.On(mautrix.StateRoomName, handler.HandleRoomMetadata)
+	bridge.EventProcessor.On(mautrix.StateRoomAvatar, handler.HandleRoomMetadata)
+	bridge.EventProcessor.On(mautrix.StateTopic, handler.HandleRoomMetadata)
 	return handler
 }
 
-func (mx *MatrixHandler) HandleBotInvite(evt *gomatrix.Event) {
+func (mx *MatrixHandler) HandleBotInvite(evt *mautrix.Event) {
 	intent := mx.as.BotIntent()
 
 	user := mx.bridge.GetUserByMXID(evt.Sender)
@@ -103,13 +104,13 @@ func (mx *MatrixHandler) HandleBotInvite(evt *gomatrix.Event) {
 	}
 }
 
-func (mx *MatrixHandler) HandleMembership(evt *gomatrix.Event) {
+func (mx *MatrixHandler) HandleMembership(evt *mautrix.Event) {
 	if evt.Content.Membership == "invite" && evt.GetStateKey() == mx.as.BotMXID() {
 		mx.HandleBotInvite(evt)
 	}
 }
 
-func (mx *MatrixHandler) HandleRoomMetadata(evt *gomatrix.Event) {
+func (mx *MatrixHandler) HandleRoomMetadata(evt *mautrix.Event) {
 	user := mx.bridge.GetUserByMXID(types.MatrixUserID(evt.Sender))
 	if user == nil || !user.Whitelisted || !user.IsLoggedIn() {
 		return
@@ -123,11 +124,11 @@ func (mx *MatrixHandler) HandleRoomMetadata(evt *gomatrix.Event) {
 	var resp <-chan string
 	var err error
 	switch evt.Type {
-	case gomatrix.StateRoomName:
+	case mautrix.StateRoomName:
 		resp, err = user.Conn.UpdateGroupSubject(evt.Content.Name, portal.Key.JID)
-	case gomatrix.StateRoomAvatar:
+	case mautrix.StateRoomAvatar:
 		return
-	case gomatrix.StateTopic:
+	case mautrix.StateTopic:
 		return
 	}
 	if err != nil {
@@ -138,7 +139,7 @@ func (mx *MatrixHandler) HandleRoomMetadata(evt *gomatrix.Event) {
 	}
 }
 
-func (mx *MatrixHandler) HandleMessage(evt *gomatrix.Event) {
+func (mx *MatrixHandler) HandleMessage(evt *mautrix.Event) {
 	if _, isPuppet := mx.bridge.ParsePuppetMXID(evt.Sender); evt.Sender == mx.bridge.Bot.UserID || isPuppet {
 		return
 	}
@@ -150,7 +151,7 @@ func (mx *MatrixHandler) HandleMessage(evt *gomatrix.Event) {
 		return
 	}
 
-	if evt.Content.MsgType == gomatrix.MsgText {
+	if evt.Content.MsgType == mautrix.MsgText {
 		commandPrefix := mx.bridge.Config.Bridge.CommandPrefix
 		hasCommandPrefix := strings.HasPrefix(evt.Content.Body, commandPrefix)
 		if hasCommandPrefix {

+ 44 - 42
portal.go

@@ -33,9 +33,11 @@ import (
 
 	"github.com/Rhymen/go-whatsapp"
 	waProto "github.com/Rhymen/go-whatsapp/binary/proto"
-	"maunium.net/go/gomatrix"
-	log "maunium.net/go/maulogger"
+
+	log "maunium.net/go/maulogger/v2"
+	"maunium.net/go/mautrix"
 	"maunium.net/go/mautrix-appservice"
+
 	"maunium.net/go/mautrix-whatsapp/database"
 	"maunium.net/go/mautrix-whatsapp/types"
 	"maunium.net/go/mautrix-whatsapp/whatsapp-ext"
@@ -224,7 +226,7 @@ func (portal *Portal) SyncParticipants(metadata *whatsappExt.GroupInfo) {
 
 		user := portal.bridge.GetUserByJID(participant.JID)
 		if user != nil && !portal.bridge.AS.StateStore.IsInvited(portal.MXID, user.MXID) {
-			portal.MainIntent().InviteUser(portal.MXID, &gomatrix.ReqInviteUser{
+			portal.MainIntent().InviteUser(portal.MXID, &mautrix.ReqInviteUser{
 				UserID: user.MXID,
 			})
 		}
@@ -363,10 +365,10 @@ func (portal *Portal) Sync(user *User, contact whatsapp.Contact) {
 	}
 }
 
-func (portal *Portal) GetBasePowerLevels() *gomatrix.PowerLevels {
+func (portal *Portal) GetBasePowerLevels() *mautrix.PowerLevels {
 	anyone := 0
 	nope := 99
-	return &gomatrix.PowerLevels{
+	return &mautrix.PowerLevels{
 		UsersDefault:    anyone,
 		EventsDefault:   anyone,
 		RedactPtr:       &anyone,
@@ -377,9 +379,9 @@ func (portal *Portal) GetBasePowerLevels() *gomatrix.PowerLevels {
 			portal.MainIntent().UserID: 100,
 		},
 		Events: map[string]int{
-			gomatrix.StateRoomName.Type:   anyone,
-			gomatrix.StateRoomAvatar.Type: anyone,
-			gomatrix.StateTopic.Type:      anyone,
+			mautrix.StateRoomName.Type:   anyone,
+			mautrix.StateRoomAvatar.Type: anyone,
+			mautrix.StateTopic.Type:      anyone,
 		},
 	}
 }
@@ -437,9 +439,9 @@ func (portal *Portal) RestrictMetadataChanges(restrict bool) {
 		newLevel = 50
 	}
 	changed := false
-	changed = levels.EnsureEventLevel(gomatrix.StateRoomName, newLevel) || changed
-	changed = levels.EnsureEventLevel(gomatrix.StateRoomAvatar, newLevel) || changed
-	changed = levels.EnsureEventLevel(gomatrix.StateTopic, newLevel) || changed
+	changed = levels.EnsureEventLevel(mautrix.StateRoomName, newLevel) || changed
+	changed = levels.EnsureEventLevel(mautrix.StateRoomAvatar, newLevel) || changed
+	changed = levels.EnsureEventLevel(mautrix.StateTopic, newLevel) || changed
 	if changed {
 		_, err = portal.MainIntent().SetPowerLevels(portal.MXID, levels)
 		if err != nil {
@@ -469,17 +471,17 @@ func (portal *Portal) CreateMatrixRoom(invite []string) error {
 		isPrivateChat = true
 	}
 
-	resp, err := intent.CreateRoom(&gomatrix.ReqCreateRoom{
+	resp, err := intent.CreateRoom(&mautrix.ReqCreateRoom{
 		Visibility: "private",
 		Name:       name,
 		Topic:      topic,
 		Invite:     invite,
 		Preset:     "private_chat",
 		IsDirect:   isPrivateChat,
-		InitialState: []*gomatrix.Event{{
-			Type: gomatrix.StatePowerLevels,
-			Content: gomatrix.Content{
-				PowerLevels: *portal.GetBasePowerLevels(),
+		InitialState: []*mautrix.Event{{
+			Type: mautrix.StatePowerLevels,
+			Content: mautrix.Content{
+				PowerLevels: portal.GetBasePowerLevels(),
 			},
 		}},
 	})
@@ -525,7 +527,7 @@ func (portal *Portal) GetMessageIntent(user *User, info whatsapp.MessageInfo) *a
 	return portal.bridge.GetPuppetByJID(info.SenderJid).Intent()
 }
 
-func (portal *Portal) SetReply(content *gomatrix.Content, info whatsapp.MessageInfo) {
+func (portal *Portal) SetReply(content *mautrix.Content, info whatsapp.MessageInfo) {
 	if len(info.QuotedMessageID) == 0 {
 		return
 	}
@@ -559,16 +561,16 @@ func (portal *Portal) HandleTextMessage(source *User, message whatsapp.TextMessa
 		return
 	}
 
-	content := &gomatrix.Content{
+	content := &mautrix.Content{
 		Body:    message.Text,
-		MsgType: gomatrix.MsgText,
+		MsgType: mautrix.MsgText,
 	}
 
 	portal.bridge.Formatter.ParseWhatsApp(content)
 	portal.SetReply(content, message.Info)
 
 	intent.UserTyping(portal.MXID, false, 0)
-	resp, err := intent.SendMassagedMessageEvent(portal.MXID, gomatrix.EventMessage, content, int64(message.Info.Timestamp*1000))
+	resp, err := intent.SendMassagedMessageEvent(portal.MXID, mautrix.EventMessage, content, int64(message.Info.Timestamp*1000))
 	if err != nil {
 		portal.log.Errorfln("Failed to handle message %s: %v", message.Info.Id, err)
 		return
@@ -612,10 +614,10 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
 		fileName += exts[0]
 	}
 
-	content := &gomatrix.Content{
+	content := &mautrix.Content{
 		Body: fileName,
 		URL:  uploaded.ContentURI,
-		Info: &gomatrix.FileInfo{
+		Info: &mautrix.FileInfo{
 			Size:     len(data),
 			MimeType: mimeType,
 		},
@@ -628,7 +630,7 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
 		if uploadedThumbnail != nil {
 			content.Info.ThumbnailURL = uploadedThumbnail.ContentURI
 			cfg, _, _ := image.DecodeConfig(bytes.NewReader(data))
-			content.Info.ThumbnailInfo = &gomatrix.FileInfo{
+			content.Info.ThumbnailInfo = &mautrix.FileInfo{
 				Size:     len(thumbnail),
 				Width:    cfg.Width,
 				Height:   cfg.Height,
@@ -639,35 +641,35 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
 
 	switch strings.ToLower(strings.Split(mimeType, "/")[0]) {
 	case "image":
-		content.MsgType = gomatrix.MsgImage
+		content.MsgType = mautrix.MsgImage
 		cfg, _, _ := image.DecodeConfig(bytes.NewReader(data))
 		content.Info.Width = cfg.Width
 		content.Info.Height = cfg.Height
 	case "video":
-		content.MsgType = gomatrix.MsgVideo
+		content.MsgType = mautrix.MsgVideo
 	case "audio":
-		content.MsgType = gomatrix.MsgAudio
+		content.MsgType = mautrix.MsgAudio
 	default:
-		content.MsgType = gomatrix.MsgFile
+		content.MsgType = mautrix.MsgFile
 	}
 
 	intent.UserTyping(portal.MXID, false, 0)
 	ts := int64(info.Timestamp * 1000)
-	resp, err := intent.SendMassagedMessageEvent(portal.MXID, gomatrix.EventMessage, content, ts)
+	resp, err := intent.SendMassagedMessageEvent(portal.MXID, mautrix.EventMessage, content, ts)
 	if err != nil {
 		portal.log.Errorfln("Failed to handle message %s: %v", info.Id, err)
 		return
 	}
 
 	if len(caption) > 0 {
-		captionContent := &gomatrix.Content{
+		captionContent := &mautrix.Content{
 			Body:    caption,
-			MsgType: gomatrix.MsgNotice,
+			MsgType: mautrix.MsgNotice,
 		}
 
 		portal.bridge.Formatter.ParseWhatsApp(captionContent)
 
-		_, err := intent.SendMassagedMessageEvent(portal.MXID, gomatrix.EventMessage, captionContent, ts)
+		_, err := intent.SendMassagedMessageEvent(portal.MXID, mautrix.EventMessage, captionContent, ts)
 		if err != nil {
 			portal.log.Warnfln("Failed to handle caption of message %s: %v", info.Id, err)
 		}
@@ -684,7 +686,7 @@ func makeMessageID() *string {
 	return &str
 }
 
-func (portal *Portal) downloadThumbnail(evt *gomatrix.Event) []byte {
+func (portal *Portal) downloadThumbnail(evt *mautrix.Event) []byte {
 	if evt.Content.Info == nil || len(evt.Content.Info.ThumbnailURL) == 0 {
 		return nil
 	}
@@ -717,9 +719,9 @@ func (portal *Portal) downloadThumbnail(evt *gomatrix.Event) []byte {
 	return buf.Bytes()
 }
 
-func (portal *Portal) preprocessMatrixMedia(sender *User, evt *gomatrix.Event, mediaType whatsapp.MediaType) *MediaUpload {
+func (portal *Portal) preprocessMatrixMedia(sender *User, evt *mautrix.Event, mediaType whatsapp.MediaType) *MediaUpload {
 	if evt.Content.Info == nil {
-		evt.Content.Info = &gomatrix.FileInfo{}
+		evt.Content.Info = &mautrix.FileInfo{}
 	}
 	caption := evt.Content.Body
 	exts, err := mime.ExtensionsByType(evt.Content.Info.MimeType)
@@ -762,7 +764,7 @@ type MediaUpload struct {
 	Thumbnail     []byte
 }
 
-func (portal *Portal) HandleMatrixMessage(sender *User, evt *gomatrix.Event) {
+func (portal *Portal) HandleMatrixMessage(sender *User, evt *mautrix.Event) {
 	if portal.IsPrivateChat() && sender.JID != portal.Key.Receiver {
 		return
 	}
@@ -793,12 +795,12 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *gomatrix.Event) {
 	}
 	var err error
 	switch evt.Content.MsgType {
-	case gomatrix.MsgText, gomatrix.MsgEmote:
+	case mautrix.MsgText, mautrix.MsgEmote:
 		text := evt.Content.Body
-		if evt.Content.Format == gomatrix.FormatHTML {
+		if evt.Content.Format == mautrix.FormatHTML {
 			text = portal.bridge.Formatter.ParseMatrix(evt.Content.FormattedBody)
 		}
-		if evt.Content.MsgType == gomatrix.MsgEmote {
+		if evt.Content.MsgType == mautrix.MsgEmote {
 			text = "/me " + text
 		}
 		ctxInfo.MentionedJid = mentionRegex.FindAllString(text, -1)
@@ -813,7 +815,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *gomatrix.Event) {
 		} else {
 			info.Message.Conversation = &text
 		}
-	case gomatrix.MsgImage:
+	case mautrix.MsgImage:
 		media := portal.preprocessMatrixMedia(sender, evt, whatsapp.MediaImage)
 		if media == nil {
 			return
@@ -828,7 +830,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *gomatrix.Event) {
 			FileSha256:    media.FileSHA256,
 			FileLength:    &media.FileLength,
 		}
-	case gomatrix.MsgVideo:
+	case mautrix.MsgVideo:
 		media := portal.preprocessMatrixMedia(sender, evt, whatsapp.MediaVideo)
 		if media == nil {
 			return
@@ -845,7 +847,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *gomatrix.Event) {
 			FileSha256:    media.FileSHA256,
 			FileLength:    &media.FileLength,
 		}
-	case gomatrix.MsgAudio:
+	case mautrix.MsgAudio:
 		media := portal.preprocessMatrixMedia(sender, evt, whatsapp.MediaAudio)
 		if media == nil {
 			return
@@ -860,7 +862,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *gomatrix.Event) {
 			FileSha256:    media.FileSHA256,
 			FileLength:    &media.FileLength,
 		}
-	case gomatrix.MsgFile:
+	case mautrix.MsgFile:
 		media := portal.preprocessMatrixMedia(sender, evt, whatsapp.MediaDocument)
 		if media == nil {
 			return

+ 3 - 1
puppet.go

@@ -23,8 +23,10 @@ import (
 	"strings"
 
 	"github.com/Rhymen/go-whatsapp"
-	log "maunium.net/go/maulogger"
+
+	log "maunium.net/go/maulogger/v2"
 	"maunium.net/go/mautrix-appservice"
+
 	"maunium.net/go/mautrix-whatsapp/database"
 	"maunium.net/go/mautrix-whatsapp/types"
 	"maunium.net/go/mautrix-whatsapp/whatsapp-ext"

+ 3 - 3
statestore.go

@@ -21,8 +21,8 @@ import (
 	"io/ioutil"
 	"os"
 
-	"maunium.net/go/gomatrix"
 	"maunium.net/go/mautrix-appservice"
+	"maunium.net/go/mautrix"
 )
 
 type AutosavingStateStore struct {
@@ -67,12 +67,12 @@ func (store *AutosavingStateStore) MarkRegistered(userID string) {
 	store.Save()
 }
 
-func (store *AutosavingStateStore) SetMembership(roomID, userID string, membership gomatrix.Membership) {
+func (store *AutosavingStateStore) SetMembership(roomID, userID string, membership mautrix.Membership) {
 	store.StateStore.SetMembership(roomID, userID, membership)
 	store.Save()
 }
 
-func (store *AutosavingStateStore) SetPowerLevels(roomID string, levels *gomatrix.PowerLevels) {
+func (store *AutosavingStateStore) SetPowerLevels(roomID string, levels *mautrix.PowerLevels) {
 	store.StateStore.SetPowerLevels(roomID, levels)
 	store.Save()
 }

+ 5 - 5
user.go

@@ -22,7 +22,8 @@ import (
 
 	"github.com/Rhymen/go-whatsapp"
 	"github.com/skip2/go-qrcode"
-	log "maunium.net/go/maulogger"
+	log "maunium.net/go/maulogger/v2"
+
 	"maunium.net/go/mautrix-whatsapp/database"
 	"maunium.net/go/mautrix-whatsapp/types"
 	"maunium.net/go/mautrix-whatsapp/whatsapp-ext"
@@ -62,7 +63,6 @@ func (bridge *Bridge) GetUserByMXID(userID types.MatrixUserID) *User {
 	return user
 }
 
-
 func (bridge *Bridge) GetUserByJID(userID types.WhatsAppID) *User {
 	bridge.usersLock.Lock()
 	defer bridge.usersLock.Unlock()
@@ -106,9 +106,9 @@ func (bridge *Bridge) GetAllUsers() []*User {
 
 func (bridge *Bridge) NewUser(dbUser *database.User) *User {
 	user := &User{
-		User:          dbUser,
-		bridge:        bridge,
-		log:           bridge.Log.Sub("User").Sub(string(dbUser.MXID)),
+		User:   dbUser,
+		bridge: bridge,
+		log:    bridge.Log.Sub("User").Sub(string(dbUser.MXID)),
 	}
 	user.Whitelisted = user.bridge.Config.Bridge.Permissions.IsWhitelisted(user.MXID)
 	user.Admin = user.bridge.Config.Bridge.Permissions.IsAdmin(user.MXID)

+ 0 - 2
vendor/github.com/Rhymen/go-whatsapp/.gitignore

@@ -1,2 +0,0 @@
-.idea/
-docs/

+ 0 - 21
vendor/github.com/Rhymen/go-whatsapp/LICENSE

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2018
-
-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.

+ 0 - 104
vendor/github.com/Rhymen/go-whatsapp/README.md

@@ -1,104 +0,0 @@
-# go-whatsapp
-Package rhymen/go-whatsapp implements the WhatsApp Web API to provide a clean interface for developers. Big thanks to all contributors of the [sigalor/whatsapp-web-reveng](https://github.com/sigalor/whatsapp-web-reveng) project. The official WhatsApp Business API was released in August 2018. You can check it out [here](https://www.whatsapp.com/business/api).
-
-## Installation
-```sh
-go get github.com/rhymen/go-whatsapp
-```
-
-## Usage
-### Creating a connection
-```go
-import (
-    whatsapp "github.com/Rhymen/go-whatsapp"
-)
-
-wac, err := whatsapp.NewConn(20 * time.Second)
-```
-The duration passed to the NewConn function is used to timeout login requests. If you have a bad internet connection use a higher timeout value. This function only creates a websocket connection, it does not handle authentication.
-
-### Login
-```go
-qrChan := make(chan string)
-go func() {
-    fmt.Printf("qr code: %v\n", <-qrChan)
-    //show qr code or save it somewhere to scan
-}
-sess, err := wac.Login(qrChan)
-```
-The authentication process requires you to scan the qr code, that is send through the channel, with the device you are using whatsapp on. The session struct that is returned can be saved and used to restore the login without scanning the qr code again. The qr code has a ttl of 20 seconds and the login function throws a timeout err if the time has passed or any other request fails.
-
-### Restore
-```go
-newSess, err := wac.RestoreSession(sess)
-```
-The restore function needs a valid session and returns the new session that was created.
-
-### Add message handlers
-```go
-type myHandler struct{}
-
-func (myHandler) HandleError(err error) {
-	fmt.Fprintf(os.Stderr, "%v", err)
-}
-
-func (myHandler) HandleTextMessage(message whatsapp.TextMessage) {
-	fmt.Println(message)
-}
-
-func (myHandler) HandleImageMessage(message whatsapp.ImageMessage) {
-	fmt.Println(message)
-}
-
-func (myHandler) HandleVideoMessage(message whatsapp.VideoMessage) {
-	fmt.Println(message)
-}
-
-func (myHandler) HandleJsonMessage(message string) {
-	fmt.Println(message)
-}
-
-wac.AddHandler(myHandler{})
-```
-The message handlers are all optional, you don't need to implement anything but the error handler to implement the interface. The ImageMessage and VideoMessage provide a Download function to get the media data.
-
-### Sending text messages
-```go
-text := whatsapp.TextMessage{
-    Info: whatsapp.MessageInfo{
-        RemoteJid: "0123456789@s.whatsapp.net",
-    },
-    Text: "Hello Whatsapp",
-}
-
-err := wac.Send(text)
-```
-The message will be send over the websocket. The attributes seen above are the required ones. All other relevant attributes (id, timestamp, fromMe, status) are set if they are missing in the struct. For the time being we only support text messages, but other types are planned for the near future.
-
-## Legal
-This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its
-affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk.
-
-## License
-
-The MIT License (MIT)
-
-Copyright (c) 2018
-
-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.

+ 0 - 388
vendor/github.com/Rhymen/go-whatsapp/binary/decoder.go

@@ -1,388 +0,0 @@
-package binary
-
-import (
-	"fmt"
-	"github.com/Rhymen/go-whatsapp/binary/token"
-	"io"
-	"strconv"
-)
-
-type binaryDecoder struct {
-	data  []byte
-	index int
-}
-
-func NewDecoder(data []byte) *binaryDecoder {
-	return &binaryDecoder{data, 0}
-}
-
-func (r *binaryDecoder) checkEOS(length int) error {
-	if r.index+length > len(r.data) {
-		return io.EOF
-	}
-
-	return nil
-}
-
-func (r *binaryDecoder) readByte() (byte, error) {
-	if err := r.checkEOS(1); err != nil {
-		return 0, err
-	}
-
-	b := r.data[r.index]
-	r.index++
-
-	return b, nil
-}
-
-func (r *binaryDecoder) readIntN(n int, littleEndian bool) (int, error) {
-	if err := r.checkEOS(n); err != nil {
-		return 0, err
-	}
-
-	var ret int
-
-	for i := 0; i < n; i++ {
-		var curShift int
-		if littleEndian {
-			curShift = i
-		} else {
-			curShift = n - i - 1
-		}
-		ret |= int(r.data[r.index+i]) << uint(curShift*8)
-	}
-
-	r.index += n
-	return ret, nil
-}
-
-func (r *binaryDecoder) readInt8(littleEndian bool) (int, error) {
-	return r.readIntN(1, littleEndian)
-}
-
-func (r *binaryDecoder) readInt16(littleEndian bool) (int, error) {
-	return r.readIntN(2, littleEndian)
-}
-
-func (r *binaryDecoder) readInt20() (int, error) {
-	if err := r.checkEOS(3); err != nil {
-		return 0, err
-	}
-
-	ret := ((int(r.data[r.index]) & 15) << 16) + (int(r.data[r.index+1]) << 8) + int(r.data[r.index+2])
-	r.index += 3
-	return ret, nil
-}
-
-func (r *binaryDecoder) readInt32(littleEndian bool) (int, error) {
-	return r.readIntN(4, littleEndian)
-}
-
-func (r *binaryDecoder) readInt64(littleEndian bool) (int, error) {
-	return r.readIntN(8, littleEndian)
-}
-
-func (r *binaryDecoder) readPacked8(tag int) (string, error) {
-	startByte, err := r.readByte()
-	if err != nil {
-		return "", err
-	}
-
-	ret := ""
-
-	for i := 0; i < int(startByte&127); i++ {
-		currByte, err := r.readByte()
-		if err != nil {
-			return "", err
-		}
-
-		lower, err := unpackByte(tag, currByte&0xF0>>4)
-		if err != nil {
-			return "", err
-		}
-
-		upper, err := unpackByte(tag, currByte&0x0F)
-		if err != nil {
-			return "", err
-		}
-
-		ret += lower + upper
-	}
-
-	if startByte>>7 != 0 {
-		ret = ret[:len(ret)-1]
-	}
-	return ret, nil
-}
-
-func unpackByte(tag int, value byte) (string, error) {
-	switch tag {
-	case token.NIBBLE_8:
-		return unpackNibble(value)
-	case token.HEX_8:
-		return unpackHex(value)
-	default:
-		return "", fmt.Errorf("unpackByte with unknown tag %d", tag)
-	}
-}
-
-func unpackNibble(value byte) (string, error) {
-	switch {
-	case value < 0 || value > 15:
-		return "", fmt.Errorf("unpackNibble with value %d", value)
-	case value == 10:
-		return "-", nil
-	case value == 11:
-		return ".", nil
-	case value == 15:
-		return "\x00", nil
-	default:
-		return strconv.Itoa(int(value)), nil
-	}
-}
-
-func unpackHex(value byte) (string, error) {
-	switch {
-	case value < 0 || value > 15:
-		return "", fmt.Errorf("unpackHex with value %d", value)
-	case value < 10:
-		return strconv.Itoa(int(value)), nil
-	default:
-		return string('A' + value - 10), nil
-	}
-}
-
-func (r *binaryDecoder) readListSize(tag int) (int, error) {
-	switch tag {
-	case token.LIST_EMPTY:
-		return 0, nil
-	case token.LIST_8:
-		return r.readInt8(false)
-	case token.LIST_16:
-		return r.readInt16(false)
-	default:
-		return 0, fmt.Errorf("readListSize with unknown tag %d at position %d", tag, r.index)
-	}
-}
-
-func (r *binaryDecoder) readString(tag int) (string, error) {
-	switch {
-	case tag >= 3 && tag <= len(token.SingleByteTokens):
-		tok, err := token.GetSingleToken(tag)
-		if err != nil {
-			return "", err
-		}
-
-		if tok == "s.whatsapp.net" {
-			tok = "c.us"
-		}
-
-		return tok, nil
-	case tag == token.DICTIONARY_0 || tag == token.DICTIONARY_1 || tag == token.DICTIONARY_2 || tag == token.DICTIONARY_3:
-		i, err := r.readInt8(false)
-		if err != nil {
-			return "", err
-		}
-
-		return token.GetDoubleToken(tag-token.DICTIONARY_0, i)
-	case tag == token.LIST_EMPTY:
-		return "", nil
-	case tag == token.BINARY_8:
-		length, err := r.readInt8(false)
-		if err != nil {
-			return "", err
-		}
-
-		return r.readStringFromChars(length)
-	case tag == token.BINARY_20:
-		length, err := r.readInt20()
-		if err != nil {
-			return "", err
-		}
-
-		return r.readStringFromChars(length)
-	case tag == token.BINARY_32:
-		length, err := r.readInt32(false)
-		if err != nil {
-			return "", err
-		}
-
-		return r.readStringFromChars(length)
-	case tag == token.JID_PAIR:
-		b, err := r.readByte()
-		if err != nil {
-			return "", err
-		}
-		i, err := r.readString(int(b))
-		if err != nil {
-			return "", err
-		}
-
-		b, err = r.readByte()
-		if err != nil {
-			return "", err
-		}
-		j, err := r.readString(int(b))
-		if err != nil {
-			return "", err
-		}
-
-		if i == "" || j == "" {
-			return "", fmt.Errorf("invalid jid pair: %s - %s", i, j)
-		}
-
-		return i + "@" + j, nil
-	case tag == token.NIBBLE_8 || tag == token.HEX_8:
-		return r.readPacked8(tag)
-	default:
-		return "", fmt.Errorf("invalid string with tag %d", tag)
-	}
-}
-
-func (r *binaryDecoder) readStringFromChars(length int) (string, error) {
-	if err := r.checkEOS(length); err != nil {
-		return "", err
-	}
-
-	ret := r.data[r.index : r.index+length]
-	r.index += length
-
-	return string(ret), nil
-}
-
-func (r *binaryDecoder) readAttributes(n int) (map[string]string, error) {
-	if n == 0 {
-		return nil, nil
-	}
-
-	ret := make(map[string]string)
-	for i := 0; i < n; i++ {
-		idx, err := r.readInt8(false)
-		if err != nil {
-			return nil, err
-		}
-
-		index, err := r.readString(idx)
-		if err != nil {
-			return nil, err
-		}
-
-		idx, err = r.readInt8(false)
-		if err != nil {
-			return nil, err
-		}
-
-		ret[index], err = r.readString(idx)
-		if err != nil {
-			return nil, err
-		}
-	}
-
-	return ret, nil
-}
-
-func (r *binaryDecoder) readList(tag int) ([]Node, error) {
-	size, err := r.readListSize(tag)
-	if err != nil {
-		return nil, err
-	}
-
-	ret := make([]Node, size)
-	for i := 0; i < size; i++ {
-		n, err := r.ReadNode()
-
-		if err != nil {
-			return nil, err
-		}
-
-		ret[i] = *n
-	}
-
-	return ret, nil
-}
-
-func (r *binaryDecoder) ReadNode() (*Node, error) {
-	ret := &Node{}
-
-	size, err := r.readInt8(false)
-	if err != nil {
-		return nil, err
-	}
-	listSize, err := r.readListSize(size)
-	if err != nil {
-		return nil, err
-	}
-
-	descrTag, err := r.readInt8(false)
-	if descrTag == token.STREAM_END {
-		return nil, fmt.Errorf("unexpected stream end")
-	}
-	ret.Description, err = r.readString(descrTag)
-	if err != nil {
-		return nil, err
-	}
-	if listSize == 0 || ret.Description == "" {
-		return nil, fmt.Errorf("invalid Node")
-	}
-
-	ret.Attributes, err = r.readAttributes((listSize - 1) >> 1)
-	if err != nil {
-		return nil, err
-	}
-
-	if listSize%2 == 1 {
-		return ret, nil
-	}
-
-	tag, err := r.readInt8(false)
-	if err != nil {
-		return nil, err
-	}
-
-	switch tag {
-	case token.LIST_EMPTY, token.LIST_8, token.LIST_16:
-		ret.Content, err = r.readList(tag)
-	case token.BINARY_8:
-		size, err = r.readInt8(false)
-		if err != nil {
-			return nil, err
-		}
-
-		ret.Content, err = r.readBytes(size)
-	case token.BINARY_20:
-		size, err = r.readInt20()
-		if err != nil {
-			return nil, err
-		}
-
-		ret.Content, err = r.readBytes(size)
-	case token.BINARY_32:
-		size, err = r.readInt32(false)
-		if err != nil {
-			return nil, err
-		}
-
-		ret.Content, err = r.readBytes(size)
-	default:
-		ret.Content, err = r.readString(tag)
-	}
-
-	if err != nil {
-		return nil, err
-	}
-	return ret, nil
-}
-
-func (r *binaryDecoder) readBytes(n int) ([]byte, error) {
-	ret := make([]byte, n)
-	var err error
-
-	for i := range ret {
-		ret[i], err = r.readByte()
-		if err != nil {
-			return nil, err
-		}
-	}
-
-	return ret, nil
-}

+ 0 - 351
vendor/github.com/Rhymen/go-whatsapp/binary/encoder.go

@@ -1,351 +0,0 @@
-package binary
-
-import (
-	"fmt"
-	"github.com/Rhymen/go-whatsapp/binary/token"
-	"math"
-	"strconv"
-	"strings"
-)
-
-type binaryEncoder struct {
-	data []byte
-}
-
-func NewEncoder() *binaryEncoder {
-	return &binaryEncoder{make([]byte, 0)}
-}
-
-func (w *binaryEncoder) GetData() []byte {
-	return w.data
-}
-
-func (w *binaryEncoder) pushByte(b byte) {
-	w.data = append(w.data, b)
-}
-
-func (w *binaryEncoder) pushBytes(bytes []byte) {
-	w.data = append(w.data, bytes...)
-}
-
-func (w *binaryEncoder) pushIntN(value, n int, littleEndian bool) {
-	for i := 0; i < n; i++ {
-		var curShift int
-		if littleEndian {
-			curShift = i
-		} else {
-			curShift = n - i - 1
-		}
-		w.pushByte(byte((value >> uint(curShift*8)) & 0xFF))
-	}
-}
-
-func (w *binaryEncoder) pushInt20(value int) {
-	w.pushBytes([]byte{byte((value >> 16) & 0x0F), byte((value >> 8) & 0xFF), byte(value & 0xFF)})
-}
-
-func (w *binaryEncoder) pushInt8(value int) {
-	w.pushIntN(value, 1, false)
-}
-
-func (w *binaryEncoder) pushInt16(value int) {
-	w.pushIntN(value, 2, false)
-}
-
-func (w *binaryEncoder) pushInt32(value int) {
-	w.pushIntN(value, 4, false)
-}
-
-func (w *binaryEncoder) pushInt64(value int) {
-	w.pushIntN(value, 8, false)
-}
-
-func (w *binaryEncoder) pushString(value string) {
-	w.pushBytes([]byte(value))
-}
-
-func (w *binaryEncoder) writeByteLength(length int) error {
-	if length > math.MaxInt32 {
-		return fmt.Errorf("length is too large: %d", length)
-	} else if length >= (1 << 20) {
-		w.pushByte(token.BINARY_32)
-		w.pushInt32(length)
-	} else if length >= 256 {
-		w.pushByte(token.BINARY_20)
-		w.pushInt20(length)
-	} else {
-		w.pushByte(token.BINARY_8)
-		w.pushInt8(length)
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) WriteNode(n Node) error {
-	numAttributes := 0
-	if n.Attributes != nil {
-		numAttributes = len(n.Attributes)
-	}
-
-	hasContent := 0
-	if n.Content != nil {
-		hasContent = 1
-	}
-
-	w.writeListStart(2*numAttributes + 1 + hasContent)
-	if err := w.writeString(n.Description, false); err != nil {
-		return err
-	}
-
-	if err := w.writeAttributes(n.Attributes); err != nil {
-		return err
-	}
-
-	if err := w.writeChildren(n.Content); err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writeString(tok string, i bool) error {
-	if !i && tok == "c.us" {
-		if err := w.writeToken(token.IndexOfSingleToken("s.whatsapp.net")); err != nil {
-			return err
-		}
-		return nil
-	}
-
-	tokenIndex := token.IndexOfSingleToken(tok)
-	if tokenIndex == -1 {
-		jidSepIndex := strings.Index(tok, "@")
-		if jidSepIndex < 1 {
-			w.writeStringRaw(tok)
-		} else {
-			w.writeJid(tok[:jidSepIndex], tok[jidSepIndex+1:])
-		}
-	} else {
-		if tokenIndex < token.SINGLE_BYTE_MAX {
-			if err := w.writeToken(tokenIndex); err != nil {
-				return err
-			}
-		} else {
-			singleByteOverflow := tokenIndex - token.SINGLE_BYTE_MAX
-			dictionaryIndex := singleByteOverflow >> 8
-			if dictionaryIndex < 0 || dictionaryIndex > 3 {
-				return fmt.Errorf("double byte dictionary token out of range: %v", tok)
-			}
-			if err := w.writeToken(token.DICTIONARY_0 + dictionaryIndex); err != nil {
-				return err
-			}
-			if err := w.writeToken(singleByteOverflow % 256); err != nil {
-				return err
-			}
-		}
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writeStringRaw(value string) error {
-	if err := w.writeByteLength(len(value)); err != nil {
-		return err
-	}
-
-	w.pushString(value)
-
-	return nil
-}
-
-func (w *binaryEncoder) writeJid(jidLeft, jidRight string) error {
-	w.pushByte(token.JID_PAIR)
-
-	if jidLeft != "" {
-		if err := w.writePackedBytes(jidLeft); err != nil {
-			return err
-		}
-	} else {
-		if err := w.writeToken(token.LIST_EMPTY); err != nil {
-			return err
-		}
-	}
-
-	if err := w.writeString(jidRight, false); err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writeToken(tok int) error {
-	if tok < len(token.SingleByteTokens) {
-		w.pushByte(byte(tok))
-	} else if tok <= 500 {
-		return fmt.Errorf("invalid token: %d", tok)
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writeAttributes(attributes map[string]string) error {
-	if attributes == nil {
-		return nil
-	}
-
-	for key, val := range attributes {
-		if val == "" {
-			continue
-		}
-
-		if err := w.writeString(key, false); err != nil {
-			return err
-		}
-
-		if err := w.writeString(val, false); err != nil {
-			return err
-		}
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writeChildren(children interface{}) error {
-	if children == nil {
-		return nil
-	}
-
-	switch childs := children.(type) {
-	case string:
-		if err := w.writeString(childs, true); err != nil {
-			return err
-		}
-	case []byte:
-		if err := w.writeByteLength(len(childs)); err != nil {
-			return err
-		}
-
-		w.pushBytes(childs)
-	case []Node:
-		w.writeListStart(len(childs))
-		for _, n := range childs {
-			if err := w.WriteNode(n); err != nil {
-				return err
-			}
-		}
-	default:
-		return fmt.Errorf("cannot write child of type: %T", children)
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writeListStart(listSize int) {
-	if listSize == 0 {
-		w.pushByte(byte(token.LIST_EMPTY))
-	} else if listSize < 256 {
-		w.pushByte(byte(token.LIST_8))
-		w.pushInt8(listSize)
-	} else {
-		w.pushByte(byte(token.LIST_16))
-		w.pushInt16(listSize)
-	}
-}
-
-func (w *binaryEncoder) writePackedBytes(value string) error {
-	if err := w.writePackedBytesImpl(value, token.NIBBLE_8); err != nil {
-		if err := w.writePackedBytesImpl(value, token.HEX_8); err != nil {
-			return err
-		}
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) writePackedBytesImpl(value string, dataType int) error {
-	numBytes := len(value)
-	if numBytes > token.PACKED_MAX {
-		return fmt.Errorf("too many bytes to pack: %d", numBytes)
-	}
-
-	w.pushByte(byte(dataType))
-
-	x := 0
-	if numBytes%2 != 0 {
-		x = 128
-	}
-	w.pushByte(byte(x | int(math.Ceil(float64(numBytes)/2.0))))
-	for i, l := 0, numBytes/2; i < l; i++ {
-		b, err := w.packBytePair(dataType, value[2*i:2*i+1], value[2*i+1:2*i+2])
-		if err != nil {
-			return err
-		}
-
-		w.pushByte(byte(b))
-	}
-
-	if (numBytes % 2) != 0 {
-		b, err := w.packBytePair(dataType, value[numBytes-1:], "\x00")
-		if err != nil {
-			return err
-		}
-
-		w.pushByte(byte(b))
-	}
-
-	return nil
-}
-
-func (w *binaryEncoder) packBytePair(packType int, part1, part2 string) (int, error) {
-	if packType == token.NIBBLE_8 {
-		n1, err := packNibble(part1)
-		if err != nil {
-			return 0, err
-		}
-
-		n2, err := packNibble(part2)
-		if err != nil {
-			return 0, err
-		}
-
-		return (n1 << 4) | n2, nil
-	} else if packType == token.HEX_8 {
-		n1, err := packHex(part1)
-		if err != nil {
-			return 0, err
-		}
-
-		n2, err := packHex(part2)
-		if err != nil {
-			return 0, err
-		}
-
-		return (n1 << 4) | n2, nil
-	} else {
-		return 0, fmt.Errorf("invalid pack type (%d) for byte pair: %s / %s", packType, part1, part2)
-	}
-}
-
-func packNibble(value string) (int, error) {
-	if value >= "0" && value <= "9" {
-		return strconv.Atoi(value)
-	} else if value == "-" {
-		return 10, nil
-	} else if value == "." {
-		return 11, nil
-	} else if value == "\x00" {
-		return 15, nil
-	}
-
-	return 0, fmt.Errorf("invalid string to pack as nibble: %v", value)
-}
-
-func packHex(value string) (int, error) {
-	if (value >= "0" && value <= "9") || (value >= "A" && value <= "F") || (value >= "a" && value <= "f") {
-		d, err := strconv.ParseInt(value, 16, 0)
-		return int(d), err
-	} else if value == "\x00" {
-		return 15, nil
-	}
-
-	return 0, fmt.Errorf("invalid string to pack as hex: %v", value)
-}

+ 0 - 103
vendor/github.com/Rhymen/go-whatsapp/binary/node.go

@@ -1,103 +0,0 @@
-package binary
-
-import (
-	"fmt"
-	pb "github.com/Rhymen/go-whatsapp/binary/proto"
-	"github.com/golang/protobuf/proto"
-)
-
-type Node struct {
-	Description string
-	Attributes  map[string]string
-	Content     interface{}
-}
-
-func Marshal(n Node) ([]byte, error) {
-	if n.Attributes != nil && n.Content != nil {
-		a, err := marshalMessageArray(n.Content.([]interface{}))
-		if err != nil {
-			return nil, err
-		}
-		n.Content = a
-	}
-
-	w := NewEncoder()
-	if err := w.WriteNode(n); err != nil {
-		return nil, err
-	}
-
-	return w.GetData(), nil
-}
-
-func marshalMessageArray(messages []interface{}) ([]Node, error) {
-	ret := make([]Node, len(messages))
-
-	for i, m := range messages {
-		if wmi, ok := m.(*pb.WebMessageInfo); ok {
-			b, err := marshalWebMessageInfo(wmi)
-			if err != nil {
-				return nil, nil
-			}
-			ret[i] = Node{"message", nil, b}
-		} else {
-			ret[i], ok = m.(Node)
-			if !ok {
-				return nil, fmt.Errorf("invalid Node")
-			}
-		}
-	}
-
-	return ret, nil
-}
-
-func marshalWebMessageInfo(p *pb.WebMessageInfo) ([]byte, error) {
-	b, err := proto.Marshal(p)
-	if err != nil {
-		return nil, err
-	}
-	return b, nil
-}
-
-func Unmarshal(data []byte) (*Node, error) {
-	r := NewDecoder(data)
-	n, err := r.ReadNode()
-	if err != nil {
-		return nil, err
-	}
-
-	if n != nil && n.Attributes != nil && n.Content != nil {
-		n.Content, err = unmarshalMessageArray(n.Content.([]Node))
-		if err != nil {
-			return nil, err
-		}
-	}
-
-	return n, nil
-}
-
-func unmarshalMessageArray(messages []Node) ([]interface{}, error) {
-	ret := make([]interface{}, len(messages))
-
-	for i, msg := range messages {
-		if msg.Description == "message" {
-			info, err := unmarshalWebMessageInfo(msg.Content.([]byte))
-			if err != nil {
-				return nil, err
-			}
-			ret[i] = info
-		} else {
-			ret[i] = msg
-		}
-	}
-
-	return ret, nil
-}
-
-func unmarshalWebMessageInfo(msg []byte) (*pb.WebMessageInfo, error) {
-	message := &pb.WebMessageInfo{}
-	err := proto.Unmarshal(msg, message)
-	if err != nil {
-		return nil, err
-	}
-	return message, nil
-}

+ 0 - 3800
vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.pb.go

@@ -1,3800 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: def.proto
-
-package proto
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
-
-type ExtendedTextMessage_FONTTYPE int32
-
-const (
-	ExtendedTextMessage_SANS_SERIF        ExtendedTextMessage_FONTTYPE = 0
-	ExtendedTextMessage_SERIF             ExtendedTextMessage_FONTTYPE = 1
-	ExtendedTextMessage_NORICAN_REGULAR   ExtendedTextMessage_FONTTYPE = 2
-	ExtendedTextMessage_BRYNDAN_WRITE     ExtendedTextMessage_FONTTYPE = 3
-	ExtendedTextMessage_BEBASNEUE_REGULAR ExtendedTextMessage_FONTTYPE = 4
-	ExtendedTextMessage_OSWALD_HEAVY      ExtendedTextMessage_FONTTYPE = 5
-)
-
-var ExtendedTextMessage_FONTTYPE_name = map[int32]string{
-	0: "SANS_SERIF",
-	1: "SERIF",
-	2: "NORICAN_REGULAR",
-	3: "BRYNDAN_WRITE",
-	4: "BEBASNEUE_REGULAR",
-	5: "OSWALD_HEAVY",
-}
-var ExtendedTextMessage_FONTTYPE_value = map[string]int32{
-	"SANS_SERIF":        0,
-	"SERIF":             1,
-	"NORICAN_REGULAR":   2,
-	"BRYNDAN_WRITE":     3,
-	"BEBASNEUE_REGULAR": 4,
-	"OSWALD_HEAVY":      5,
-}
-
-func (x ExtendedTextMessage_FONTTYPE) Enum() *ExtendedTextMessage_FONTTYPE {
-	p := new(ExtendedTextMessage_FONTTYPE)
-	*p = x
-	return p
-}
-func (x ExtendedTextMessage_FONTTYPE) String() string {
-	return proto.EnumName(ExtendedTextMessage_FONTTYPE_name, int32(x))
-}
-func (x *ExtendedTextMessage_FONTTYPE) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(ExtendedTextMessage_FONTTYPE_value, data, "ExtendedTextMessage_FONTTYPE")
-	if err != nil {
-		return err
-	}
-	*x = ExtendedTextMessage_FONTTYPE(value)
-	return nil
-}
-func (ExtendedTextMessage_FONTTYPE) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{7, 0}
-}
-
-type VideoMessage_ATTRIBUTION int32
-
-const (
-	VideoMessage_NONE  VideoMessage_ATTRIBUTION = 0
-	VideoMessage_GIPHY VideoMessage_ATTRIBUTION = 1
-	VideoMessage_TENOR VideoMessage_ATTRIBUTION = 2
-)
-
-var VideoMessage_ATTRIBUTION_name = map[int32]string{
-	0: "NONE",
-	1: "GIPHY",
-	2: "TENOR",
-}
-var VideoMessage_ATTRIBUTION_value = map[string]int32{
-	"NONE":  0,
-	"GIPHY": 1,
-	"TENOR": 2,
-}
-
-func (x VideoMessage_ATTRIBUTION) Enum() *VideoMessage_ATTRIBUTION {
-	p := new(VideoMessage_ATTRIBUTION)
-	*p = x
-	return p
-}
-func (x VideoMessage_ATTRIBUTION) String() string {
-	return proto.EnumName(VideoMessage_ATTRIBUTION_name, int32(x))
-}
-func (x *VideoMessage_ATTRIBUTION) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(VideoMessage_ATTRIBUTION_value, data, "VideoMessage_ATTRIBUTION")
-	if err != nil {
-		return err
-	}
-	*x = VideoMessage_ATTRIBUTION(value)
-	return nil
-}
-func (VideoMessage_ATTRIBUTION) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{10, 0}
-}
-
-type ProtocolMessage_TYPE int32
-
-const (
-	ProtocolMessage_REVOKE ProtocolMessage_TYPE = 0
-)
-
-var ProtocolMessage_TYPE_name = map[int32]string{
-	0: "REVOKE",
-}
-var ProtocolMessage_TYPE_value = map[string]int32{
-	"REVOKE": 0,
-}
-
-func (x ProtocolMessage_TYPE) Enum() *ProtocolMessage_TYPE {
-	p := new(ProtocolMessage_TYPE)
-	*p = x
-	return p
-}
-func (x ProtocolMessage_TYPE) String() string {
-	return proto.EnumName(ProtocolMessage_TYPE_name, int32(x))
-}
-func (x *ProtocolMessage_TYPE) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(ProtocolMessage_TYPE_value, data, "ProtocolMessage_TYPE")
-	if err != nil {
-		return err
-	}
-	*x = ProtocolMessage_TYPE(value)
-	return nil
-}
-func (ProtocolMessage_TYPE) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{13, 0}
-}
-
-type HSMDateTimeComponent_DAYOFWEEKTYPE int32
-
-const (
-	HSMDateTimeComponent_MONDAY    HSMDateTimeComponent_DAYOFWEEKTYPE = 1
-	HSMDateTimeComponent_TUESDAY   HSMDateTimeComponent_DAYOFWEEKTYPE = 2
-	HSMDateTimeComponent_WEDNESDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 3
-	HSMDateTimeComponent_THURSDAY  HSMDateTimeComponent_DAYOFWEEKTYPE = 4
-	HSMDateTimeComponent_FRIDAY    HSMDateTimeComponent_DAYOFWEEKTYPE = 5
-	HSMDateTimeComponent_SATURDAY  HSMDateTimeComponent_DAYOFWEEKTYPE = 6
-	HSMDateTimeComponent_SUNDAY    HSMDateTimeComponent_DAYOFWEEKTYPE = 7
-)
-
-var HSMDateTimeComponent_DAYOFWEEKTYPE_name = map[int32]string{
-	1: "MONDAY",
-	2: "TUESDAY",
-	3: "WEDNESDAY",
-	4: "THURSDAY",
-	5: "FRIDAY",
-	6: "SATURDAY",
-	7: "SUNDAY",
-}
-var HSMDateTimeComponent_DAYOFWEEKTYPE_value = map[string]int32{
-	"MONDAY":    1,
-	"TUESDAY":   2,
-	"WEDNESDAY": 3,
-	"THURSDAY":  4,
-	"FRIDAY":    5,
-	"SATURDAY":  6,
-	"SUNDAY":    7,
-}
-
-func (x HSMDateTimeComponent_DAYOFWEEKTYPE) Enum() *HSMDateTimeComponent_DAYOFWEEKTYPE {
-	p := new(HSMDateTimeComponent_DAYOFWEEKTYPE)
-	*p = x
-	return p
-}
-func (x HSMDateTimeComponent_DAYOFWEEKTYPE) String() string {
-	return proto.EnumName(HSMDateTimeComponent_DAYOFWEEKTYPE_name, int32(x))
-}
-func (x *HSMDateTimeComponent_DAYOFWEEKTYPE) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(HSMDateTimeComponent_DAYOFWEEKTYPE_value, data, "HSMDateTimeComponent_DAYOFWEEKTYPE")
-	if err != nil {
-		return err
-	}
-	*x = HSMDateTimeComponent_DAYOFWEEKTYPE(value)
-	return nil
-}
-func (HSMDateTimeComponent_DAYOFWEEKTYPE) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{16, 0}
-}
-
-type HSMDateTimeComponent_CALENDARTYPE int32
-
-const (
-	HSMDateTimeComponent_GREGORIAN   HSMDateTimeComponent_CALENDARTYPE = 1
-	HSMDateTimeComponent_SOLAR_HIJRI HSMDateTimeComponent_CALENDARTYPE = 2
-)
-
-var HSMDateTimeComponent_CALENDARTYPE_name = map[int32]string{
-	1: "GREGORIAN",
-	2: "SOLAR_HIJRI",
-}
-var HSMDateTimeComponent_CALENDARTYPE_value = map[string]int32{
-	"GREGORIAN":   1,
-	"SOLAR_HIJRI": 2,
-}
-
-func (x HSMDateTimeComponent_CALENDARTYPE) Enum() *HSMDateTimeComponent_CALENDARTYPE {
-	p := new(HSMDateTimeComponent_CALENDARTYPE)
-	*p = x
-	return p
-}
-func (x HSMDateTimeComponent_CALENDARTYPE) String() string {
-	return proto.EnumName(HSMDateTimeComponent_CALENDARTYPE_name, int32(x))
-}
-func (x *HSMDateTimeComponent_CALENDARTYPE) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(HSMDateTimeComponent_CALENDARTYPE_value, data, "HSMDateTimeComponent_CALENDARTYPE")
-	if err != nil {
-		return err
-	}
-	*x = HSMDateTimeComponent_CALENDARTYPE(value)
-	return nil
-}
-func (HSMDateTimeComponent_CALENDARTYPE) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{16, 1}
-}
-
-type WebMessageInfo_STATUS int32
-
-const (
-	WebMessageInfo_ERROR        WebMessageInfo_STATUS = 0
-	WebMessageInfo_PENDING      WebMessageInfo_STATUS = 1
-	WebMessageInfo_SERVER_ACK   WebMessageInfo_STATUS = 2
-	WebMessageInfo_DELIVERY_ACK WebMessageInfo_STATUS = 3
-	WebMessageInfo_READ         WebMessageInfo_STATUS = 4
-	WebMessageInfo_PLAYED       WebMessageInfo_STATUS = 5
-)
-
-var WebMessageInfo_STATUS_name = map[int32]string{
-	0: "ERROR",
-	1: "PENDING",
-	2: "SERVER_ACK",
-	3: "DELIVERY_ACK",
-	4: "READ",
-	5: "PLAYED",
-}
-var WebMessageInfo_STATUS_value = map[string]int32{
-	"ERROR":        0,
-	"PENDING":      1,
-	"SERVER_ACK":   2,
-	"DELIVERY_ACK": 3,
-	"READ":         4,
-	"PLAYED":       5,
-}
-
-func (x WebMessageInfo_STATUS) Enum() *WebMessageInfo_STATUS {
-	p := new(WebMessageInfo_STATUS)
-	*p = x
-	return p
-}
-func (x WebMessageInfo_STATUS) String() string {
-	return proto.EnumName(WebMessageInfo_STATUS_name, int32(x))
-}
-func (x *WebMessageInfo_STATUS) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(WebMessageInfo_STATUS_value, data, "WebMessageInfo_STATUS")
-	if err != nil {
-		return err
-	}
-	*x = WebMessageInfo_STATUS(value)
-	return nil
-}
-func (WebMessageInfo_STATUS) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{30, 0}
-}
-
-type WebMessageInfo_STUBTYPE int32
-
-const (
-	WebMessageInfo_UNKNOWN                             WebMessageInfo_STUBTYPE = 0
-	WebMessageInfo_REVOKE                              WebMessageInfo_STUBTYPE = 1
-	WebMessageInfo_CIPHERTEXT                          WebMessageInfo_STUBTYPE = 2
-	WebMessageInfo_FUTUREPROOF                         WebMessageInfo_STUBTYPE = 3
-	WebMessageInfo_NON_VERIFIED_TRANSITION             WebMessageInfo_STUBTYPE = 4
-	WebMessageInfo_UNVERIFIED_TRANSITION               WebMessageInfo_STUBTYPE = 5
-	WebMessageInfo_VERIFIED_TRANSITION                 WebMessageInfo_STUBTYPE = 6
-	WebMessageInfo_VERIFIED_LOW_UNKNOWN                WebMessageInfo_STUBTYPE = 7
-	WebMessageInfo_VERIFIED_HIGH                       WebMessageInfo_STUBTYPE = 8
-	WebMessageInfo_VERIFIED_INITIAL_UNKNOWN            WebMessageInfo_STUBTYPE = 9
-	WebMessageInfo_VERIFIED_INITIAL_LOW                WebMessageInfo_STUBTYPE = 10
-	WebMessageInfo_VERIFIED_INITIAL_HIGH               WebMessageInfo_STUBTYPE = 11
-	WebMessageInfo_VERIFIED_TRANSITION_ANY_TO_NONE     WebMessageInfo_STUBTYPE = 12
-	WebMessageInfo_VERIFIED_TRANSITION_ANY_TO_HIGH     WebMessageInfo_STUBTYPE = 13
-	WebMessageInfo_VERIFIED_TRANSITION_HIGH_TO_LOW     WebMessageInfo_STUBTYPE = 14
-	WebMessageInfo_VERIFIED_TRANSITION_HIGH_TO_UNKNOWN WebMessageInfo_STUBTYPE = 15
-	WebMessageInfo_VERIFIED_TRANSITION_UNKNOWN_TO_LOW  WebMessageInfo_STUBTYPE = 16
-	WebMessageInfo_VERIFIED_TRANSITION_LOW_TO_UNKNOWN  WebMessageInfo_STUBTYPE = 17
-	WebMessageInfo_VERIFIED_TRANSITION_NONE_TO_LOW     WebMessageInfo_STUBTYPE = 18
-	WebMessageInfo_VERIFIED_TRANSITION_NONE_TO_UNKNOWN WebMessageInfo_STUBTYPE = 19
-	WebMessageInfo_GROUP_CREATE                        WebMessageInfo_STUBTYPE = 20
-	WebMessageInfo_GROUP_CHANGE_SUBJECT                WebMessageInfo_STUBTYPE = 21
-	WebMessageInfo_GROUP_CHANGE_ICON                   WebMessageInfo_STUBTYPE = 22
-	WebMessageInfo_GROUP_CHANGE_INVITE_LINK            WebMessageInfo_STUBTYPE = 23
-	WebMessageInfo_GROUP_CHANGE_DESCRIPTION            WebMessageInfo_STUBTYPE = 24
-	WebMessageInfo_GROUP_CHANGE_RESTRICT               WebMessageInfo_STUBTYPE = 25
-	WebMessageInfo_GROUP_CHANGE_ANNOUNCE               WebMessageInfo_STUBTYPE = 26
-	WebMessageInfo_GROUP_PARTICIPANT_ADD               WebMessageInfo_STUBTYPE = 27
-	WebMessageInfo_GROUP_PARTICIPANT_REMOVE            WebMessageInfo_STUBTYPE = 28
-	WebMessageInfo_GROUP_PARTICIPANT_PROMOTE           WebMessageInfo_STUBTYPE = 29
-	WebMessageInfo_GROUP_PARTICIPANT_DEMOTE            WebMessageInfo_STUBTYPE = 30
-	WebMessageInfo_GROUP_PARTICIPANT_INVITE            WebMessageInfo_STUBTYPE = 31
-	WebMessageInfo_GROUP_PARTICIPANT_LEAVE             WebMessageInfo_STUBTYPE = 32
-	WebMessageInfo_GROUP_PARTICIPANT_CHANGE_NUMBER     WebMessageInfo_STUBTYPE = 33
-	WebMessageInfo_BROADCAST_CREATE                    WebMessageInfo_STUBTYPE = 34
-	WebMessageInfo_BROADCAST_ADD                       WebMessageInfo_STUBTYPE = 35
-	WebMessageInfo_BROADCAST_REMOVE                    WebMessageInfo_STUBTYPE = 36
-	WebMessageInfo_GENERIC_NOTIFICATION                WebMessageInfo_STUBTYPE = 37
-	WebMessageInfo_E2E_IDENTITY_CHANGED                WebMessageInfo_STUBTYPE = 38
-	WebMessageInfo_E2E_ENCRYPTED                       WebMessageInfo_STUBTYPE = 39
-	WebMessageInfo_CALL_MISSED_VOICE                   WebMessageInfo_STUBTYPE = 40
-	WebMessageInfo_CALL_MISSED_VIDEO                   WebMessageInfo_STUBTYPE = 41
-	WebMessageInfo_INDIVIDUAL_CHANGE_NUMBER            WebMessageInfo_STUBTYPE = 42
-	WebMessageInfo_GROUP_DELETE                        WebMessageInfo_STUBTYPE = 43
-)
-
-var WebMessageInfo_STUBTYPE_name = map[int32]string{
-	0:  "UNKNOWN",
-	1:  "REVOKE",
-	2:  "CIPHERTEXT",
-	3:  "FUTUREPROOF",
-	4:  "NON_VERIFIED_TRANSITION",
-	5:  "UNVERIFIED_TRANSITION",
-	6:  "VERIFIED_TRANSITION",
-	7:  "VERIFIED_LOW_UNKNOWN",
-	8:  "VERIFIED_HIGH",
-	9:  "VERIFIED_INITIAL_UNKNOWN",
-	10: "VERIFIED_INITIAL_LOW",
-	11: "VERIFIED_INITIAL_HIGH",
-	12: "VERIFIED_TRANSITION_ANY_TO_NONE",
-	13: "VERIFIED_TRANSITION_ANY_TO_HIGH",
-	14: "VERIFIED_TRANSITION_HIGH_TO_LOW",
-	15: "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN",
-	16: "VERIFIED_TRANSITION_UNKNOWN_TO_LOW",
-	17: "VERIFIED_TRANSITION_LOW_TO_UNKNOWN",
-	18: "VERIFIED_TRANSITION_NONE_TO_LOW",
-	19: "VERIFIED_TRANSITION_NONE_TO_UNKNOWN",
-	20: "GROUP_CREATE",
-	21: "GROUP_CHANGE_SUBJECT",
-	22: "GROUP_CHANGE_ICON",
-	23: "GROUP_CHANGE_INVITE_LINK",
-	24: "GROUP_CHANGE_DESCRIPTION",
-	25: "GROUP_CHANGE_RESTRICT",
-	26: "GROUP_CHANGE_ANNOUNCE",
-	27: "GROUP_PARTICIPANT_ADD",
-	28: "GROUP_PARTICIPANT_REMOVE",
-	29: "GROUP_PARTICIPANT_PROMOTE",
-	30: "GROUP_PARTICIPANT_DEMOTE",
-	31: "GROUP_PARTICIPANT_INVITE",
-	32: "GROUP_PARTICIPANT_LEAVE",
-	33: "GROUP_PARTICIPANT_CHANGE_NUMBER",
-	34: "BROADCAST_CREATE",
-	35: "BROADCAST_ADD",
-	36: "BROADCAST_REMOVE",
-	37: "GENERIC_NOTIFICATION",
-	38: "E2E_IDENTITY_CHANGED",
-	39: "E2E_ENCRYPTED",
-	40: "CALL_MISSED_VOICE",
-	41: "CALL_MISSED_VIDEO",
-	42: "INDIVIDUAL_CHANGE_NUMBER",
-	43: "GROUP_DELETE",
-}
-var WebMessageInfo_STUBTYPE_value = map[string]int32{
-	"UNKNOWN":                             0,
-	"REVOKE":                              1,
-	"CIPHERTEXT":                          2,
-	"FUTUREPROOF":                         3,
-	"NON_VERIFIED_TRANSITION":             4,
-	"UNVERIFIED_TRANSITION":               5,
-	"VERIFIED_TRANSITION":                 6,
-	"VERIFIED_LOW_UNKNOWN":                7,
-	"VERIFIED_HIGH":                       8,
-	"VERIFIED_INITIAL_UNKNOWN":            9,
-	"VERIFIED_INITIAL_LOW":                10,
-	"VERIFIED_INITIAL_HIGH":               11,
-	"VERIFIED_TRANSITION_ANY_TO_NONE":     12,
-	"VERIFIED_TRANSITION_ANY_TO_HIGH":     13,
-	"VERIFIED_TRANSITION_HIGH_TO_LOW":     14,
-	"VERIFIED_TRANSITION_HIGH_TO_UNKNOWN": 15,
-	"VERIFIED_TRANSITION_UNKNOWN_TO_LOW":  16,
-	"VERIFIED_TRANSITION_LOW_TO_UNKNOWN":  17,
-	"VERIFIED_TRANSITION_NONE_TO_LOW":     18,
-	"VERIFIED_TRANSITION_NONE_TO_UNKNOWN": 19,
-	"GROUP_CREATE":                        20,
-	"GROUP_CHANGE_SUBJECT":                21,
-	"GROUP_CHANGE_ICON":                   22,
-	"GROUP_CHANGE_INVITE_LINK":            23,
-	"GROUP_CHANGE_DESCRIPTION":            24,
-	"GROUP_CHANGE_RESTRICT":               25,
-	"GROUP_CHANGE_ANNOUNCE":               26,
-	"GROUP_PARTICIPANT_ADD":               27,
-	"GROUP_PARTICIPANT_REMOVE":            28,
-	"GROUP_PARTICIPANT_PROMOTE":           29,
-	"GROUP_PARTICIPANT_DEMOTE":            30,
-	"GROUP_PARTICIPANT_INVITE":            31,
-	"GROUP_PARTICIPANT_LEAVE":             32,
-	"GROUP_PARTICIPANT_CHANGE_NUMBER":     33,
-	"BROADCAST_CREATE":                    34,
-	"BROADCAST_ADD":                       35,
-	"BROADCAST_REMOVE":                    36,
-	"GENERIC_NOTIFICATION":                37,
-	"E2E_IDENTITY_CHANGED":                38,
-	"E2E_ENCRYPTED":                       39,
-	"CALL_MISSED_VOICE":                   40,
-	"CALL_MISSED_VIDEO":                   41,
-	"INDIVIDUAL_CHANGE_NUMBER":            42,
-	"GROUP_DELETE":                        43,
-}
-
-func (x WebMessageInfo_STUBTYPE) Enum() *WebMessageInfo_STUBTYPE {
-	p := new(WebMessageInfo_STUBTYPE)
-	*p = x
-	return p
-}
-func (x WebMessageInfo_STUBTYPE) String() string {
-	return proto.EnumName(WebMessageInfo_STUBTYPE_name, int32(x))
-}
-func (x *WebMessageInfo_STUBTYPE) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(WebMessageInfo_STUBTYPE_value, data, "WebMessageInfo_STUBTYPE")
-	if err != nil {
-		return err
-	}
-	*x = WebMessageInfo_STUBTYPE(value)
-	return nil
-}
-func (WebMessageInfo_STUBTYPE) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{30, 1}
-}
-
-type WebFeatures_FLAG int32
-
-const (
-	WebFeatures_NOT_IMPLEMENTED WebFeatures_FLAG = 0
-	WebFeatures_IMPLEMENTED     WebFeatures_FLAG = 1
-	WebFeatures_OPTIONAL        WebFeatures_FLAG = 2
-)
-
-var WebFeatures_FLAG_name = map[int32]string{
-	0: "NOT_IMPLEMENTED",
-	1: "IMPLEMENTED",
-	2: "OPTIONAL",
-}
-var WebFeatures_FLAG_value = map[string]int32{
-	"NOT_IMPLEMENTED": 0,
-	"IMPLEMENTED":     1,
-	"OPTIONAL":        2,
-}
-
-func (x WebFeatures_FLAG) Enum() *WebFeatures_FLAG {
-	p := new(WebFeatures_FLAG)
-	*p = x
-	return p
-}
-func (x WebFeatures_FLAG) String() string {
-	return proto.EnumName(WebFeatures_FLAG_name, int32(x))
-}
-func (x *WebFeatures_FLAG) UnmarshalJSON(data []byte) error {
-	value, err := proto.UnmarshalJSONEnum(WebFeatures_FLAG_value, data, "WebFeatures_FLAG")
-	if err != nil {
-		return err
-	}
-	*x = WebFeatures_FLAG(value)
-	return nil
-}
-func (WebFeatures_FLAG) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{34, 0}
-}
-
-type FingerprintData struct {
-	PublicKey            *string  `protobuf:"bytes,1,opt,name=publicKey" json:"publicKey,omitempty"`
-	Identifier           *string  `protobuf:"bytes,2,opt,name=identifier" json:"identifier,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *FingerprintData) Reset()         { *m = FingerprintData{} }
-func (m *FingerprintData) String() string { return proto.CompactTextString(m) }
-func (*FingerprintData) ProtoMessage()    {}
-func (*FingerprintData) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{0}
-}
-func (m *FingerprintData) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_FingerprintData.Unmarshal(m, b)
-}
-func (m *FingerprintData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_FingerprintData.Marshal(b, m, deterministic)
-}
-func (dst *FingerprintData) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_FingerprintData.Merge(dst, src)
-}
-func (m *FingerprintData) XXX_Size() int {
-	return xxx_messageInfo_FingerprintData.Size(m)
-}
-func (m *FingerprintData) XXX_DiscardUnknown() {
-	xxx_messageInfo_FingerprintData.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_FingerprintData proto.InternalMessageInfo
-
-func (m *FingerprintData) GetPublicKey() string {
-	if m != nil && m.PublicKey != nil {
-		return *m.PublicKey
-	}
-	return ""
-}
-
-func (m *FingerprintData) GetIdentifier() string {
-	if m != nil && m.Identifier != nil {
-		return *m.Identifier
-	}
-	return ""
-}
-
-type CombinedFingerprint struct {
-	Version              *uint32          `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
-	LocalFingerprint     *FingerprintData `protobuf:"bytes,2,opt,name=localFingerprint" json:"localFingerprint,omitempty"`
-	RemoteFingerprint    *FingerprintData `protobuf:"bytes,3,opt,name=remoteFingerprint" json:"remoteFingerprint,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
-	XXX_unrecognized     []byte           `json:"-"`
-	XXX_sizecache        int32            `json:"-"`
-}
-
-func (m *CombinedFingerprint) Reset()         { *m = CombinedFingerprint{} }
-func (m *CombinedFingerprint) String() string { return proto.CompactTextString(m) }
-func (*CombinedFingerprint) ProtoMessage()    {}
-func (*CombinedFingerprint) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{1}
-}
-func (m *CombinedFingerprint) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_CombinedFingerprint.Unmarshal(m, b)
-}
-func (m *CombinedFingerprint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_CombinedFingerprint.Marshal(b, m, deterministic)
-}
-func (dst *CombinedFingerprint) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_CombinedFingerprint.Merge(dst, src)
-}
-func (m *CombinedFingerprint) XXX_Size() int {
-	return xxx_messageInfo_CombinedFingerprint.Size(m)
-}
-func (m *CombinedFingerprint) XXX_DiscardUnknown() {
-	xxx_messageInfo_CombinedFingerprint.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_CombinedFingerprint proto.InternalMessageInfo
-
-func (m *CombinedFingerprint) GetVersion() uint32 {
-	if m != nil && m.Version != nil {
-		return *m.Version
-	}
-	return 0
-}
-
-func (m *CombinedFingerprint) GetLocalFingerprint() *FingerprintData {
-	if m != nil {
-		return m.LocalFingerprint
-	}
-	return nil
-}
-
-func (m *CombinedFingerprint) GetRemoteFingerprint() *FingerprintData {
-	if m != nil {
-		return m.RemoteFingerprint
-	}
-	return nil
-}
-
-type MessageKey struct {
-	RemoteJid            *string  `protobuf:"bytes,1,opt,name=remoteJid" json:"remoteJid,omitempty"`
-	FromMe               *bool    `protobuf:"varint,2,opt,name=fromMe" json:"fromMe,omitempty"`
-	Id                   *string  `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"`
-	Participant          *string  `protobuf:"bytes,4,opt,name=participant" json:"participant,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *MessageKey) Reset()         { *m = MessageKey{} }
-func (m *MessageKey) String() string { return proto.CompactTextString(m) }
-func (*MessageKey) ProtoMessage()    {}
-func (*MessageKey) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{2}
-}
-func (m *MessageKey) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_MessageKey.Unmarshal(m, b)
-}
-func (m *MessageKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_MessageKey.Marshal(b, m, deterministic)
-}
-func (dst *MessageKey) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_MessageKey.Merge(dst, src)
-}
-func (m *MessageKey) XXX_Size() int {
-	return xxx_messageInfo_MessageKey.Size(m)
-}
-func (m *MessageKey) XXX_DiscardUnknown() {
-	xxx_messageInfo_MessageKey.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_MessageKey proto.InternalMessageInfo
-
-func (m *MessageKey) GetRemoteJid() string {
-	if m != nil && m.RemoteJid != nil {
-		return *m.RemoteJid
-	}
-	return ""
-}
-
-func (m *MessageKey) GetFromMe() bool {
-	if m != nil && m.FromMe != nil {
-		return *m.FromMe
-	}
-	return false
-}
-
-func (m *MessageKey) GetId() string {
-	if m != nil && m.Id != nil {
-		return *m.Id
-	}
-	return ""
-}
-
-func (m *MessageKey) GetParticipant() string {
-	if m != nil && m.Participant != nil {
-		return *m.Participant
-	}
-	return ""
-}
-
-type SenderKeyDistributionMessage struct {
-	GroupId                             *string  `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"`
-	AxolotlSenderKeyDistributionMessage []byte   `protobuf:"bytes,2,opt,name=axolotlSenderKeyDistributionMessage" json:"axolotlSenderKeyDistributionMessage,omitempty"`
-	XXX_NoUnkeyedLiteral                struct{} `json:"-"`
-	XXX_unrecognized                    []byte   `json:"-"`
-	XXX_sizecache                       int32    `json:"-"`
-}
-
-func (m *SenderKeyDistributionMessage) Reset()         { *m = SenderKeyDistributionMessage{} }
-func (m *SenderKeyDistributionMessage) String() string { return proto.CompactTextString(m) }
-func (*SenderKeyDistributionMessage) ProtoMessage()    {}
-func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{3}
-}
-func (m *SenderKeyDistributionMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_SenderKeyDistributionMessage.Unmarshal(m, b)
-}
-func (m *SenderKeyDistributionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_SenderKeyDistributionMessage.Marshal(b, m, deterministic)
-}
-func (dst *SenderKeyDistributionMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_SenderKeyDistributionMessage.Merge(dst, src)
-}
-func (m *SenderKeyDistributionMessage) XXX_Size() int {
-	return xxx_messageInfo_SenderKeyDistributionMessage.Size(m)
-}
-func (m *SenderKeyDistributionMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_SenderKeyDistributionMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_SenderKeyDistributionMessage proto.InternalMessageInfo
-
-func (m *SenderKeyDistributionMessage) GetGroupId() string {
-	if m != nil && m.GroupId != nil {
-		return *m.GroupId
-	}
-	return ""
-}
-
-func (m *SenderKeyDistributionMessage) GetAxolotlSenderKeyDistributionMessage() []byte {
-	if m != nil {
-		return m.AxolotlSenderKeyDistributionMessage
-	}
-	return nil
-}
-
-type ImageMessage struct {
-	Url                    *string                  `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
-	Mimetype               *string                  `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"`
-	Caption                *string                  `protobuf:"bytes,3,opt,name=caption" json:"caption,omitempty"`
-	FileSha256             []byte                   `protobuf:"bytes,4,opt,name=fileSha256" json:"fileSha256,omitempty"`
-	FileLength             *uint64                  `protobuf:"varint,5,opt,name=fileLength" json:"fileLength,omitempty"`
-	Height                 *uint32                  `protobuf:"varint,6,opt,name=height" json:"height,omitempty"`
-	Width                  *uint32                  `protobuf:"varint,7,opt,name=width" json:"width,omitempty"`
-	MediaKey               []byte                   `protobuf:"bytes,8,opt,name=mediaKey" json:"mediaKey,omitempty"`
-	FileEncSha256          []byte                   `protobuf:"bytes,9,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"`
-	InteractiveAnnotations []*InteractiveAnnotation `protobuf:"bytes,10,rep,name=interactiveAnnotations" json:"interactiveAnnotations,omitempty"`
-	DirectPath             *string                  `protobuf:"bytes,11,opt,name=directPath" json:"directPath,omitempty"`
-	JpegThumbnail          []byte                   `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"`
-	ContextInfo            *ContextInfo             `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	FirstScanSidecar       []byte                   `protobuf:"bytes,18,opt,name=firstScanSidecar" json:"firstScanSidecar,omitempty"`
-	FirstScanLength        *uint32                  `protobuf:"varint,19,opt,name=firstScanLength" json:"firstScanLength,omitempty"`
-	XXX_NoUnkeyedLiteral   struct{}                 `json:"-"`
-	XXX_unrecognized       []byte                   `json:"-"`
-	XXX_sizecache          int32                    `json:"-"`
-}
-
-func (m *ImageMessage) Reset()         { *m = ImageMessage{} }
-func (m *ImageMessage) String() string { return proto.CompactTextString(m) }
-func (*ImageMessage) ProtoMessage()    {}
-func (*ImageMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{4}
-}
-func (m *ImageMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ImageMessage.Unmarshal(m, b)
-}
-func (m *ImageMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ImageMessage.Marshal(b, m, deterministic)
-}
-func (dst *ImageMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ImageMessage.Merge(dst, src)
-}
-func (m *ImageMessage) XXX_Size() int {
-	return xxx_messageInfo_ImageMessage.Size(m)
-}
-func (m *ImageMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_ImageMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ImageMessage proto.InternalMessageInfo
-
-func (m *ImageMessage) GetUrl() string {
-	if m != nil && m.Url != nil {
-		return *m.Url
-	}
-	return ""
-}
-
-func (m *ImageMessage) GetMimetype() string {
-	if m != nil && m.Mimetype != nil {
-		return *m.Mimetype
-	}
-	return ""
-}
-
-func (m *ImageMessage) GetCaption() string {
-	if m != nil && m.Caption != nil {
-		return *m.Caption
-	}
-	return ""
-}
-
-func (m *ImageMessage) GetFileSha256() []byte {
-	if m != nil {
-		return m.FileSha256
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetFileLength() uint64 {
-	if m != nil && m.FileLength != nil {
-		return *m.FileLength
-	}
-	return 0
-}
-
-func (m *ImageMessage) GetHeight() uint32 {
-	if m != nil && m.Height != nil {
-		return *m.Height
-	}
-	return 0
-}
-
-func (m *ImageMessage) GetWidth() uint32 {
-	if m != nil && m.Width != nil {
-		return *m.Width
-	}
-	return 0
-}
-
-func (m *ImageMessage) GetMediaKey() []byte {
-	if m != nil {
-		return m.MediaKey
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetFileEncSha256() []byte {
-	if m != nil {
-		return m.FileEncSha256
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetInteractiveAnnotations() []*InteractiveAnnotation {
-	if m != nil {
-		return m.InteractiveAnnotations
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetDirectPath() string {
-	if m != nil && m.DirectPath != nil {
-		return *m.DirectPath
-	}
-	return ""
-}
-
-func (m *ImageMessage) GetJpegThumbnail() []byte {
-	if m != nil {
-		return m.JpegThumbnail
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetFirstScanSidecar() []byte {
-	if m != nil {
-		return m.FirstScanSidecar
-	}
-	return nil
-}
-
-func (m *ImageMessage) GetFirstScanLength() uint32 {
-	if m != nil && m.FirstScanLength != nil {
-		return *m.FirstScanLength
-	}
-	return 0
-}
-
-type ContactMessage struct {
-	DisplayName          *string      `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"`
-	Vcard                *string      `protobuf:"bytes,16,opt,name=vcard" json:"vcard,omitempty"`
-	ContextInfo          *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
-	XXX_unrecognized     []byte       `json:"-"`
-	XXX_sizecache        int32        `json:"-"`
-}
-
-func (m *ContactMessage) Reset()         { *m = ContactMessage{} }
-func (m *ContactMessage) String() string { return proto.CompactTextString(m) }
-func (*ContactMessage) ProtoMessage()    {}
-func (*ContactMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{5}
-}
-func (m *ContactMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ContactMessage.Unmarshal(m, b)
-}
-func (m *ContactMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ContactMessage.Marshal(b, m, deterministic)
-}
-func (dst *ContactMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ContactMessage.Merge(dst, src)
-}
-func (m *ContactMessage) XXX_Size() int {
-	return xxx_messageInfo_ContactMessage.Size(m)
-}
-func (m *ContactMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_ContactMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ContactMessage proto.InternalMessageInfo
-
-func (m *ContactMessage) GetDisplayName() string {
-	if m != nil && m.DisplayName != nil {
-		return *m.DisplayName
-	}
-	return ""
-}
-
-func (m *ContactMessage) GetVcard() string {
-	if m != nil && m.Vcard != nil {
-		return *m.Vcard
-	}
-	return ""
-}
-
-func (m *ContactMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type LocationMessage struct {
-	DegreesLatitude      *float64     `protobuf:"fixed64,1,opt,name=degreesLatitude" json:"degreesLatitude,omitempty"`
-	DegreesLongitude     *float64     `protobuf:"fixed64,2,opt,name=degreesLongitude" json:"degreesLongitude,omitempty"`
-	Name                 *string      `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
-	Address              *string      `protobuf:"bytes,4,opt,name=address" json:"address,omitempty"`
-	Url                  *string      `protobuf:"bytes,5,opt,name=url" json:"url,omitempty"`
-	JpegThumbnail        []byte       `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"`
-	ContextInfo          *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
-	XXX_unrecognized     []byte       `json:"-"`
-	XXX_sizecache        int32        `json:"-"`
-}
-
-func (m *LocationMessage) Reset()         { *m = LocationMessage{} }
-func (m *LocationMessage) String() string { return proto.CompactTextString(m) }
-func (*LocationMessage) ProtoMessage()    {}
-func (*LocationMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{6}
-}
-func (m *LocationMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_LocationMessage.Unmarshal(m, b)
-}
-func (m *LocationMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_LocationMessage.Marshal(b, m, deterministic)
-}
-func (dst *LocationMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_LocationMessage.Merge(dst, src)
-}
-func (m *LocationMessage) XXX_Size() int {
-	return xxx_messageInfo_LocationMessage.Size(m)
-}
-func (m *LocationMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_LocationMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_LocationMessage proto.InternalMessageInfo
-
-func (m *LocationMessage) GetDegreesLatitude() float64 {
-	if m != nil && m.DegreesLatitude != nil {
-		return *m.DegreesLatitude
-	}
-	return 0
-}
-
-func (m *LocationMessage) GetDegreesLongitude() float64 {
-	if m != nil && m.DegreesLongitude != nil {
-		return *m.DegreesLongitude
-	}
-	return 0
-}
-
-func (m *LocationMessage) GetName() string {
-	if m != nil && m.Name != nil {
-		return *m.Name
-	}
-	return ""
-}
-
-func (m *LocationMessage) GetAddress() string {
-	if m != nil && m.Address != nil {
-		return *m.Address
-	}
-	return ""
-}
-
-func (m *LocationMessage) GetUrl() string {
-	if m != nil && m.Url != nil {
-		return *m.Url
-	}
-	return ""
-}
-
-func (m *LocationMessage) GetJpegThumbnail() []byte {
-	if m != nil {
-		return m.JpegThumbnail
-	}
-	return nil
-}
-
-func (m *LocationMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type ExtendedTextMessage struct {
-	Text                 *string                       `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"`
-	MatchedText          *string                       `protobuf:"bytes,2,opt,name=matchedText" json:"matchedText,omitempty"`
-	CanonicalUrl         *string                       `protobuf:"bytes,4,opt,name=canonicalUrl" json:"canonicalUrl,omitempty"`
-	Description          *string                       `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"`
-	Title                *string                       `protobuf:"bytes,6,opt,name=title" json:"title,omitempty"`
-	TextArgb             *uint32                       `protobuf:"fixed32,7,opt,name=textArgb" json:"textArgb,omitempty"`
-	BackgroundArgb       *uint32                       `protobuf:"fixed32,8,opt,name=backgroundArgb" json:"backgroundArgb,omitempty"`
-	Font                 *ExtendedTextMessage_FONTTYPE `protobuf:"varint,9,opt,name=font,enum=proto.ExtendedTextMessage_FONTTYPE" json:"font,omitempty"`
-	JpegThumbnail        []byte                        `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"`
-	ContextInfo          *ContextInfo                  `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}                      `json:"-"`
-	XXX_unrecognized     []byte                        `json:"-"`
-	XXX_sizecache        int32                         `json:"-"`
-}
-
-func (m *ExtendedTextMessage) Reset()         { *m = ExtendedTextMessage{} }
-func (m *ExtendedTextMessage) String() string { return proto.CompactTextString(m) }
-func (*ExtendedTextMessage) ProtoMessage()    {}
-func (*ExtendedTextMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{7}
-}
-func (m *ExtendedTextMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ExtendedTextMessage.Unmarshal(m, b)
-}
-func (m *ExtendedTextMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ExtendedTextMessage.Marshal(b, m, deterministic)
-}
-func (dst *ExtendedTextMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ExtendedTextMessage.Merge(dst, src)
-}
-func (m *ExtendedTextMessage) XXX_Size() int {
-	return xxx_messageInfo_ExtendedTextMessage.Size(m)
-}
-func (m *ExtendedTextMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_ExtendedTextMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ExtendedTextMessage proto.InternalMessageInfo
-
-func (m *ExtendedTextMessage) GetText() string {
-	if m != nil && m.Text != nil {
-		return *m.Text
-	}
-	return ""
-}
-
-func (m *ExtendedTextMessage) GetMatchedText() string {
-	if m != nil && m.MatchedText != nil {
-		return *m.MatchedText
-	}
-	return ""
-}
-
-func (m *ExtendedTextMessage) GetCanonicalUrl() string {
-	if m != nil && m.CanonicalUrl != nil {
-		return *m.CanonicalUrl
-	}
-	return ""
-}
-
-func (m *ExtendedTextMessage) GetDescription() string {
-	if m != nil && m.Description != nil {
-		return *m.Description
-	}
-	return ""
-}
-
-func (m *ExtendedTextMessage) GetTitle() string {
-	if m != nil && m.Title != nil {
-		return *m.Title
-	}
-	return ""
-}
-
-func (m *ExtendedTextMessage) GetTextArgb() uint32 {
-	if m != nil && m.TextArgb != nil {
-		return *m.TextArgb
-	}
-	return 0
-}
-
-func (m *ExtendedTextMessage) GetBackgroundArgb() uint32 {
-	if m != nil && m.BackgroundArgb != nil {
-		return *m.BackgroundArgb
-	}
-	return 0
-}
-
-func (m *ExtendedTextMessage) GetFont() ExtendedTextMessage_FONTTYPE {
-	if m != nil && m.Font != nil {
-		return *m.Font
-	}
-	return ExtendedTextMessage_SANS_SERIF
-}
-
-func (m *ExtendedTextMessage) GetJpegThumbnail() []byte {
-	if m != nil {
-		return m.JpegThumbnail
-	}
-	return nil
-}
-
-func (m *ExtendedTextMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type DocumentMessage struct {
-	Url                  *string      `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
-	Mimetype             *string      `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"`
-	Title                *string      `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"`
-	FileSha256           []byte       `protobuf:"bytes,4,opt,name=fileSha256" json:"fileSha256,omitempty"`
-	FileLength           *uint64      `protobuf:"varint,5,opt,name=fileLength" json:"fileLength,omitempty"`
-	PageCount            *uint32      `protobuf:"varint,6,opt,name=pageCount" json:"pageCount,omitempty"`
-	MediaKey             []byte       `protobuf:"bytes,7,opt,name=mediaKey" json:"mediaKey,omitempty"`
-	FileName             *string      `protobuf:"bytes,8,opt,name=fileName" json:"fileName,omitempty"`
-	FileEncSha256        []byte       `protobuf:"bytes,9,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"`
-	DirectPath           *string      `protobuf:"bytes,10,opt,name=directPath" json:"directPath,omitempty"`
-	JpegThumbnail        []byte       `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"`
-	ContextInfo          *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
-	XXX_unrecognized     []byte       `json:"-"`
-	XXX_sizecache        int32        `json:"-"`
-}
-
-func (m *DocumentMessage) Reset()         { *m = DocumentMessage{} }
-func (m *DocumentMessage) String() string { return proto.CompactTextString(m) }
-func (*DocumentMessage) ProtoMessage()    {}
-func (*DocumentMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{8}
-}
-func (m *DocumentMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_DocumentMessage.Unmarshal(m, b)
-}
-func (m *DocumentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_DocumentMessage.Marshal(b, m, deterministic)
-}
-func (dst *DocumentMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_DocumentMessage.Merge(dst, src)
-}
-func (m *DocumentMessage) XXX_Size() int {
-	return xxx_messageInfo_DocumentMessage.Size(m)
-}
-func (m *DocumentMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_DocumentMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_DocumentMessage proto.InternalMessageInfo
-
-func (m *DocumentMessage) GetUrl() string {
-	if m != nil && m.Url != nil {
-		return *m.Url
-	}
-	return ""
-}
-
-func (m *DocumentMessage) GetMimetype() string {
-	if m != nil && m.Mimetype != nil {
-		return *m.Mimetype
-	}
-	return ""
-}
-
-func (m *DocumentMessage) GetTitle() string {
-	if m != nil && m.Title != nil {
-		return *m.Title
-	}
-	return ""
-}
-
-func (m *DocumentMessage) GetFileSha256() []byte {
-	if m != nil {
-		return m.FileSha256
-	}
-	return nil
-}
-
-func (m *DocumentMessage) GetFileLength() uint64 {
-	if m != nil && m.FileLength != nil {
-		return *m.FileLength
-	}
-	return 0
-}
-
-func (m *DocumentMessage) GetPageCount() uint32 {
-	if m != nil && m.PageCount != nil {
-		return *m.PageCount
-	}
-	return 0
-}
-
-func (m *DocumentMessage) GetMediaKey() []byte {
-	if m != nil {
-		return m.MediaKey
-	}
-	return nil
-}
-
-func (m *DocumentMessage) GetFileName() string {
-	if m != nil && m.FileName != nil {
-		return *m.FileName
-	}
-	return ""
-}
-
-func (m *DocumentMessage) GetFileEncSha256() []byte {
-	if m != nil {
-		return m.FileEncSha256
-	}
-	return nil
-}
-
-func (m *DocumentMessage) GetDirectPath() string {
-	if m != nil && m.DirectPath != nil {
-		return *m.DirectPath
-	}
-	return ""
-}
-
-func (m *DocumentMessage) GetJpegThumbnail() []byte {
-	if m != nil {
-		return m.JpegThumbnail
-	}
-	return nil
-}
-
-func (m *DocumentMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type AudioMessage struct {
-	Url                  *string      `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
-	Mimetype             *string      `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"`
-	FileSha256           []byte       `protobuf:"bytes,3,opt,name=fileSha256" json:"fileSha256,omitempty"`
-	FileLength           *uint64      `protobuf:"varint,4,opt,name=fileLength" json:"fileLength,omitempty"`
-	Seconds              *uint32      `protobuf:"varint,5,opt,name=seconds" json:"seconds,omitempty"`
-	Ptt                  *bool        `protobuf:"varint,6,opt,name=ptt" json:"ptt,omitempty"`
-	MediaKey             []byte       `protobuf:"bytes,7,opt,name=mediaKey" json:"mediaKey,omitempty"`
-	FileEncSha256        []byte       `protobuf:"bytes,8,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"`
-	DirectPath           *string      `protobuf:"bytes,9,opt,name=directPath" json:"directPath,omitempty"`
-	ContextInfo          *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	StreamingSidecar     []byte       `protobuf:"bytes,18,opt,name=streamingSidecar" json:"streamingSidecar,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
-	XXX_unrecognized     []byte       `json:"-"`
-	XXX_sizecache        int32        `json:"-"`
-}
-
-func (m *AudioMessage) Reset()         { *m = AudioMessage{} }
-func (m *AudioMessage) String() string { return proto.CompactTextString(m) }
-func (*AudioMessage) ProtoMessage()    {}
-func (*AudioMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{9}
-}
-func (m *AudioMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_AudioMessage.Unmarshal(m, b)
-}
-func (m *AudioMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_AudioMessage.Marshal(b, m, deterministic)
-}
-func (dst *AudioMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_AudioMessage.Merge(dst, src)
-}
-func (m *AudioMessage) XXX_Size() int {
-	return xxx_messageInfo_AudioMessage.Size(m)
-}
-func (m *AudioMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_AudioMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_AudioMessage proto.InternalMessageInfo
-
-func (m *AudioMessage) GetUrl() string {
-	if m != nil && m.Url != nil {
-		return *m.Url
-	}
-	return ""
-}
-
-func (m *AudioMessage) GetMimetype() string {
-	if m != nil && m.Mimetype != nil {
-		return *m.Mimetype
-	}
-	return ""
-}
-
-func (m *AudioMessage) GetFileSha256() []byte {
-	if m != nil {
-		return m.FileSha256
-	}
-	return nil
-}
-
-func (m *AudioMessage) GetFileLength() uint64 {
-	if m != nil && m.FileLength != nil {
-		return *m.FileLength
-	}
-	return 0
-}
-
-func (m *AudioMessage) GetSeconds() uint32 {
-	if m != nil && m.Seconds != nil {
-		return *m.Seconds
-	}
-	return 0
-}
-
-func (m *AudioMessage) GetPtt() bool {
-	if m != nil && m.Ptt != nil {
-		return *m.Ptt
-	}
-	return false
-}
-
-func (m *AudioMessage) GetMediaKey() []byte {
-	if m != nil {
-		return m.MediaKey
-	}
-	return nil
-}
-
-func (m *AudioMessage) GetFileEncSha256() []byte {
-	if m != nil {
-		return m.FileEncSha256
-	}
-	return nil
-}
-
-func (m *AudioMessage) GetDirectPath() string {
-	if m != nil && m.DirectPath != nil {
-		return *m.DirectPath
-	}
-	return ""
-}
-
-func (m *AudioMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-func (m *AudioMessage) GetStreamingSidecar() []byte {
-	if m != nil {
-		return m.StreamingSidecar
-	}
-	return nil
-}
-
-type VideoMessage struct {
-	Url                    *string                   `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
-	Mimetype               *string                   `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"`
-	FileSha256             []byte                    `protobuf:"bytes,3,opt,name=fileSha256" json:"fileSha256,omitempty"`
-	FileLength             *uint64                   `protobuf:"varint,4,opt,name=fileLength" json:"fileLength,omitempty"`
-	Seconds                *uint32                   `protobuf:"varint,5,opt,name=seconds" json:"seconds,omitempty"`
-	MediaKey               []byte                    `protobuf:"bytes,6,opt,name=mediaKey" json:"mediaKey,omitempty"`
-	Caption                *string                   `protobuf:"bytes,7,opt,name=caption" json:"caption,omitempty"`
-	GifPlayback            *bool                     `protobuf:"varint,8,opt,name=gifPlayback" json:"gifPlayback,omitempty"`
-	Height                 *uint32                   `protobuf:"varint,9,opt,name=height" json:"height,omitempty"`
-	Width                  *uint32                   `protobuf:"varint,10,opt,name=width" json:"width,omitempty"`
-	FileEncSha256          []byte                    `protobuf:"bytes,11,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"`
-	InteractiveAnnotations []*InteractiveAnnotation  `protobuf:"bytes,12,rep,name=interactiveAnnotations" json:"interactiveAnnotations,omitempty"`
-	DirectPath             *string                   `protobuf:"bytes,13,opt,name=directPath" json:"directPath,omitempty"`
-	JpegThumbnail          []byte                    `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"`
-	ContextInfo            *ContextInfo              `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	StreamingSidecar       []byte                    `protobuf:"bytes,18,opt,name=streamingSidecar" json:"streamingSidecar,omitempty"`
-	GifAttribution         *VideoMessage_ATTRIBUTION `protobuf:"varint,19,opt,name=gifAttribution,enum=proto.VideoMessage_ATTRIBUTION" json:"gifAttribution,omitempty"`
-	XXX_NoUnkeyedLiteral   struct{}                  `json:"-"`
-	XXX_unrecognized       []byte                    `json:"-"`
-	XXX_sizecache          int32                     `json:"-"`
-}
-
-func (m *VideoMessage) Reset()         { *m = VideoMessage{} }
-func (m *VideoMessage) String() string { return proto.CompactTextString(m) }
-func (*VideoMessage) ProtoMessage()    {}
-func (*VideoMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{10}
-}
-func (m *VideoMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_VideoMessage.Unmarshal(m, b)
-}
-func (m *VideoMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_VideoMessage.Marshal(b, m, deterministic)
-}
-func (dst *VideoMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_VideoMessage.Merge(dst, src)
-}
-func (m *VideoMessage) XXX_Size() int {
-	return xxx_messageInfo_VideoMessage.Size(m)
-}
-func (m *VideoMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_VideoMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_VideoMessage proto.InternalMessageInfo
-
-func (m *VideoMessage) GetUrl() string {
-	if m != nil && m.Url != nil {
-		return *m.Url
-	}
-	return ""
-}
-
-func (m *VideoMessage) GetMimetype() string {
-	if m != nil && m.Mimetype != nil {
-		return *m.Mimetype
-	}
-	return ""
-}
-
-func (m *VideoMessage) GetFileSha256() []byte {
-	if m != nil {
-		return m.FileSha256
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetFileLength() uint64 {
-	if m != nil && m.FileLength != nil {
-		return *m.FileLength
-	}
-	return 0
-}
-
-func (m *VideoMessage) GetSeconds() uint32 {
-	if m != nil && m.Seconds != nil {
-		return *m.Seconds
-	}
-	return 0
-}
-
-func (m *VideoMessage) GetMediaKey() []byte {
-	if m != nil {
-		return m.MediaKey
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetCaption() string {
-	if m != nil && m.Caption != nil {
-		return *m.Caption
-	}
-	return ""
-}
-
-func (m *VideoMessage) GetGifPlayback() bool {
-	if m != nil && m.GifPlayback != nil {
-		return *m.GifPlayback
-	}
-	return false
-}
-
-func (m *VideoMessage) GetHeight() uint32 {
-	if m != nil && m.Height != nil {
-		return *m.Height
-	}
-	return 0
-}
-
-func (m *VideoMessage) GetWidth() uint32 {
-	if m != nil && m.Width != nil {
-		return *m.Width
-	}
-	return 0
-}
-
-func (m *VideoMessage) GetFileEncSha256() []byte {
-	if m != nil {
-		return m.FileEncSha256
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetInteractiveAnnotations() []*InteractiveAnnotation {
-	if m != nil {
-		return m.InteractiveAnnotations
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetDirectPath() string {
-	if m != nil && m.DirectPath != nil {
-		return *m.DirectPath
-	}
-	return ""
-}
-
-func (m *VideoMessage) GetJpegThumbnail() []byte {
-	if m != nil {
-		return m.JpegThumbnail
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetStreamingSidecar() []byte {
-	if m != nil {
-		return m.StreamingSidecar
-	}
-	return nil
-}
-
-func (m *VideoMessage) GetGifAttribution() VideoMessage_ATTRIBUTION {
-	if m != nil && m.GifAttribution != nil {
-		return *m.GifAttribution
-	}
-	return VideoMessage_NONE
-}
-
-type Call struct {
-	CallKey              []byte   `protobuf:"bytes,1,opt,name=callKey" json:"callKey,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *Call) Reset()         { *m = Call{} }
-func (m *Call) String() string { return proto.CompactTextString(m) }
-func (*Call) ProtoMessage()    {}
-func (*Call) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{11}
-}
-func (m *Call) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Call.Unmarshal(m, b)
-}
-func (m *Call) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Call.Marshal(b, m, deterministic)
-}
-func (dst *Call) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Call.Merge(dst, src)
-}
-func (m *Call) XXX_Size() int {
-	return xxx_messageInfo_Call.Size(m)
-}
-func (m *Call) XXX_DiscardUnknown() {
-	xxx_messageInfo_Call.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Call proto.InternalMessageInfo
-
-func (m *Call) GetCallKey() []byte {
-	if m != nil {
-		return m.CallKey
-	}
-	return nil
-}
-
-type Chat struct {
-	DisplayName          *string  `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"`
-	Id                   *string  `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *Chat) Reset()         { *m = Chat{} }
-func (m *Chat) String() string { return proto.CompactTextString(m) }
-func (*Chat) ProtoMessage()    {}
-func (*Chat) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{12}
-}
-func (m *Chat) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Chat.Unmarshal(m, b)
-}
-func (m *Chat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Chat.Marshal(b, m, deterministic)
-}
-func (dst *Chat) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Chat.Merge(dst, src)
-}
-func (m *Chat) XXX_Size() int {
-	return xxx_messageInfo_Chat.Size(m)
-}
-func (m *Chat) XXX_DiscardUnknown() {
-	xxx_messageInfo_Chat.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Chat proto.InternalMessageInfo
-
-func (m *Chat) GetDisplayName() string {
-	if m != nil && m.DisplayName != nil {
-		return *m.DisplayName
-	}
-	return ""
-}
-
-func (m *Chat) GetId() string {
-	if m != nil && m.Id != nil {
-		return *m.Id
-	}
-	return ""
-}
-
-type ProtocolMessage struct {
-	Key                  *MessageKey           `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
-	Type                 *ProtocolMessage_TYPE `protobuf:"varint,2,opt,name=type,enum=proto.ProtocolMessage_TYPE" json:"type,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
-	XXX_unrecognized     []byte                `json:"-"`
-	XXX_sizecache        int32                 `json:"-"`
-}
-
-func (m *ProtocolMessage) Reset()         { *m = ProtocolMessage{} }
-func (m *ProtocolMessage) String() string { return proto.CompactTextString(m) }
-func (*ProtocolMessage) ProtoMessage()    {}
-func (*ProtocolMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{13}
-}
-func (m *ProtocolMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ProtocolMessage.Unmarshal(m, b)
-}
-func (m *ProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ProtocolMessage.Marshal(b, m, deterministic)
-}
-func (dst *ProtocolMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ProtocolMessage.Merge(dst, src)
-}
-func (m *ProtocolMessage) XXX_Size() int {
-	return xxx_messageInfo_ProtocolMessage.Size(m)
-}
-func (m *ProtocolMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_ProtocolMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ProtocolMessage proto.InternalMessageInfo
-
-func (m *ProtocolMessage) GetKey() *MessageKey {
-	if m != nil {
-		return m.Key
-	}
-	return nil
-}
-
-func (m *ProtocolMessage) GetType() ProtocolMessage_TYPE {
-	if m != nil && m.Type != nil {
-		return *m.Type
-	}
-	return ProtocolMessage_REVOKE
-}
-
-type ContactsArrayMessage struct {
-	DisplayName          *string           `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"`
-	Contacts             []*ContactMessage `protobuf:"bytes,2,rep,name=contacts" json:"contacts,omitempty"`
-	ContextInfo          *ContextInfo      `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
-	XXX_unrecognized     []byte            `json:"-"`
-	XXX_sizecache        int32             `json:"-"`
-}
-
-func (m *ContactsArrayMessage) Reset()         { *m = ContactsArrayMessage{} }
-func (m *ContactsArrayMessage) String() string { return proto.CompactTextString(m) }
-func (*ContactsArrayMessage) ProtoMessage()    {}
-func (*ContactsArrayMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{14}
-}
-func (m *ContactsArrayMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ContactsArrayMessage.Unmarshal(m, b)
-}
-func (m *ContactsArrayMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ContactsArrayMessage.Marshal(b, m, deterministic)
-}
-func (dst *ContactsArrayMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ContactsArrayMessage.Merge(dst, src)
-}
-func (m *ContactsArrayMessage) XXX_Size() int {
-	return xxx_messageInfo_ContactsArrayMessage.Size(m)
-}
-func (m *ContactsArrayMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_ContactsArrayMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ContactsArrayMessage proto.InternalMessageInfo
-
-func (m *ContactsArrayMessage) GetDisplayName() string {
-	if m != nil && m.DisplayName != nil {
-		return *m.DisplayName
-	}
-	return ""
-}
-
-func (m *ContactsArrayMessage) GetContacts() []*ContactMessage {
-	if m != nil {
-		return m.Contacts
-	}
-	return nil
-}
-
-func (m *ContactsArrayMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type HSMCurrency struct {
-	CurrencyCode         *string  `protobuf:"bytes,1,opt,name=currencyCode" json:"currencyCode,omitempty"`
-	Amount1000           *int64   `protobuf:"varint,2,opt,name=amount1000" json:"amount1000,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *HSMCurrency) Reset()         { *m = HSMCurrency{} }
-func (m *HSMCurrency) String() string { return proto.CompactTextString(m) }
-func (*HSMCurrency) ProtoMessage()    {}
-func (*HSMCurrency) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{15}
-}
-func (m *HSMCurrency) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_HSMCurrency.Unmarshal(m, b)
-}
-func (m *HSMCurrency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_HSMCurrency.Marshal(b, m, deterministic)
-}
-func (dst *HSMCurrency) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_HSMCurrency.Merge(dst, src)
-}
-func (m *HSMCurrency) XXX_Size() int {
-	return xxx_messageInfo_HSMCurrency.Size(m)
-}
-func (m *HSMCurrency) XXX_DiscardUnknown() {
-	xxx_messageInfo_HSMCurrency.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HSMCurrency proto.InternalMessageInfo
-
-func (m *HSMCurrency) GetCurrencyCode() string {
-	if m != nil && m.CurrencyCode != nil {
-		return *m.CurrencyCode
-	}
-	return ""
-}
-
-func (m *HSMCurrency) GetAmount1000() int64 {
-	if m != nil && m.Amount1000 != nil {
-		return *m.Amount1000
-	}
-	return 0
-}
-
-type HSMDateTimeComponent struct {
-	DayOfWeek            *HSMDateTimeComponent_DAYOFWEEKTYPE `protobuf:"varint,1,opt,name=dayOfWeek,enum=proto.HSMDateTimeComponent_DAYOFWEEKTYPE" json:"dayOfWeek,omitempty"`
-	Year                 *uint32                             `protobuf:"varint,2,opt,name=year" json:"year,omitempty"`
-	Month                *uint32                             `protobuf:"varint,3,opt,name=month" json:"month,omitempty"`
-	DayOfMonth           *uint32                             `protobuf:"varint,4,opt,name=dayOfMonth" json:"dayOfMonth,omitempty"`
-	Hour                 *uint32                             `protobuf:"varint,5,opt,name=hour" json:"hour,omitempty"`
-	Minute               *uint32                             `protobuf:"varint,6,opt,name=minute" json:"minute,omitempty"`
-	Calendar             *HSMDateTimeComponent_CALENDARTYPE  `protobuf:"varint,7,opt,name=calendar,enum=proto.HSMDateTimeComponent_CALENDARTYPE" json:"calendar,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}                            `json:"-"`
-	XXX_unrecognized     []byte                              `json:"-"`
-	XXX_sizecache        int32                               `json:"-"`
-}
-
-func (m *HSMDateTimeComponent) Reset()         { *m = HSMDateTimeComponent{} }
-func (m *HSMDateTimeComponent) String() string { return proto.CompactTextString(m) }
-func (*HSMDateTimeComponent) ProtoMessage()    {}
-func (*HSMDateTimeComponent) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{16}
-}
-func (m *HSMDateTimeComponent) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_HSMDateTimeComponent.Unmarshal(m, b)
-}
-func (m *HSMDateTimeComponent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_HSMDateTimeComponent.Marshal(b, m, deterministic)
-}
-func (dst *HSMDateTimeComponent) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_HSMDateTimeComponent.Merge(dst, src)
-}
-func (m *HSMDateTimeComponent) XXX_Size() int {
-	return xxx_messageInfo_HSMDateTimeComponent.Size(m)
-}
-func (m *HSMDateTimeComponent) XXX_DiscardUnknown() {
-	xxx_messageInfo_HSMDateTimeComponent.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HSMDateTimeComponent proto.InternalMessageInfo
-
-func (m *HSMDateTimeComponent) GetDayOfWeek() HSMDateTimeComponent_DAYOFWEEKTYPE {
-	if m != nil && m.DayOfWeek != nil {
-		return *m.DayOfWeek
-	}
-	return HSMDateTimeComponent_MONDAY
-}
-
-func (m *HSMDateTimeComponent) GetYear() uint32 {
-	if m != nil && m.Year != nil {
-		return *m.Year
-	}
-	return 0
-}
-
-func (m *HSMDateTimeComponent) GetMonth() uint32 {
-	if m != nil && m.Month != nil {
-		return *m.Month
-	}
-	return 0
-}
-
-func (m *HSMDateTimeComponent) GetDayOfMonth() uint32 {
-	if m != nil && m.DayOfMonth != nil {
-		return *m.DayOfMonth
-	}
-	return 0
-}
-
-func (m *HSMDateTimeComponent) GetHour() uint32 {
-	if m != nil && m.Hour != nil {
-		return *m.Hour
-	}
-	return 0
-}
-
-func (m *HSMDateTimeComponent) GetMinute() uint32 {
-	if m != nil && m.Minute != nil {
-		return *m.Minute
-	}
-	return 0
-}
-
-func (m *HSMDateTimeComponent) GetCalendar() HSMDateTimeComponent_CALENDARTYPE {
-	if m != nil && m.Calendar != nil {
-		return *m.Calendar
-	}
-	return HSMDateTimeComponent_GREGORIAN
-}
-
-type HSMDateTimeUnixEpoch struct {
-	Timestamp            *int64   `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *HSMDateTimeUnixEpoch) Reset()         { *m = HSMDateTimeUnixEpoch{} }
-func (m *HSMDateTimeUnixEpoch) String() string { return proto.CompactTextString(m) }
-func (*HSMDateTimeUnixEpoch) ProtoMessage()    {}
-func (*HSMDateTimeUnixEpoch) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{17}
-}
-func (m *HSMDateTimeUnixEpoch) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_HSMDateTimeUnixEpoch.Unmarshal(m, b)
-}
-func (m *HSMDateTimeUnixEpoch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_HSMDateTimeUnixEpoch.Marshal(b, m, deterministic)
-}
-func (dst *HSMDateTimeUnixEpoch) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_HSMDateTimeUnixEpoch.Merge(dst, src)
-}
-func (m *HSMDateTimeUnixEpoch) XXX_Size() int {
-	return xxx_messageInfo_HSMDateTimeUnixEpoch.Size(m)
-}
-func (m *HSMDateTimeUnixEpoch) XXX_DiscardUnknown() {
-	xxx_messageInfo_HSMDateTimeUnixEpoch.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HSMDateTimeUnixEpoch proto.InternalMessageInfo
-
-func (m *HSMDateTimeUnixEpoch) GetTimestamp() int64 {
-	if m != nil && m.Timestamp != nil {
-		return *m.Timestamp
-	}
-	return 0
-}
-
-type HSMDateTime struct {
-	// Types that are valid to be assigned to DatetimeOneof:
-	//	*HSMDateTime_Component
-	//	*HSMDateTime_UnixEpoch
-	DatetimeOneof        isHSMDateTime_DatetimeOneof `protobuf_oneof:"datetimeOneof"`
-	XXX_NoUnkeyedLiteral struct{}                    `json:"-"`
-	XXX_unrecognized     []byte                      `json:"-"`
-	XXX_sizecache        int32                       `json:"-"`
-}
-
-func (m *HSMDateTime) Reset()         { *m = HSMDateTime{} }
-func (m *HSMDateTime) String() string { return proto.CompactTextString(m) }
-func (*HSMDateTime) ProtoMessage()    {}
-func (*HSMDateTime) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{18}
-}
-func (m *HSMDateTime) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_HSMDateTime.Unmarshal(m, b)
-}
-func (m *HSMDateTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_HSMDateTime.Marshal(b, m, deterministic)
-}
-func (dst *HSMDateTime) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_HSMDateTime.Merge(dst, src)
-}
-func (m *HSMDateTime) XXX_Size() int {
-	return xxx_messageInfo_HSMDateTime.Size(m)
-}
-func (m *HSMDateTime) XXX_DiscardUnknown() {
-	xxx_messageInfo_HSMDateTime.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HSMDateTime proto.InternalMessageInfo
-
-type isHSMDateTime_DatetimeOneof interface {
-	isHSMDateTime_DatetimeOneof()
-}
-
-type HSMDateTime_Component struct {
-	Component *HSMDateTimeComponent `protobuf:"bytes,1,opt,name=component,oneof"`
-}
-type HSMDateTime_UnixEpoch struct {
-	UnixEpoch *HSMDateTimeUnixEpoch `protobuf:"bytes,2,opt,name=unixEpoch,oneof"`
-}
-
-func (*HSMDateTime_Component) isHSMDateTime_DatetimeOneof() {}
-func (*HSMDateTime_UnixEpoch) isHSMDateTime_DatetimeOneof() {}
-
-func (m *HSMDateTime) GetDatetimeOneof() isHSMDateTime_DatetimeOneof {
-	if m != nil {
-		return m.DatetimeOneof
-	}
-	return nil
-}
-
-func (m *HSMDateTime) GetComponent() *HSMDateTimeComponent {
-	if x, ok := m.GetDatetimeOneof().(*HSMDateTime_Component); ok {
-		return x.Component
-	}
-	return nil
-}
-
-func (m *HSMDateTime) GetUnixEpoch() *HSMDateTimeUnixEpoch {
-	if x, ok := m.GetDatetimeOneof().(*HSMDateTime_UnixEpoch); ok {
-		return x.UnixEpoch
-	}
-	return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*HSMDateTime) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
-	return _HSMDateTime_OneofMarshaler, _HSMDateTime_OneofUnmarshaler, _HSMDateTime_OneofSizer, []interface{}{
-		(*HSMDateTime_Component)(nil),
-		(*HSMDateTime_UnixEpoch)(nil),
-	}
-}
-
-func _HSMDateTime_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
-	m := msg.(*HSMDateTime)
-	// datetimeOneof
-	switch x := m.DatetimeOneof.(type) {
-	case *HSMDateTime_Component:
-		b.EncodeVarint(1<<3 | proto.WireBytes)
-		if err := b.EncodeMessage(x.Component); err != nil {
-			return err
-		}
-	case *HSMDateTime_UnixEpoch:
-		b.EncodeVarint(2<<3 | proto.WireBytes)
-		if err := b.EncodeMessage(x.UnixEpoch); err != nil {
-			return err
-		}
-	case nil:
-	default:
-		return fmt.Errorf("HSMDateTime.DatetimeOneof has unexpected type %T", x)
-	}
-	return nil
-}
-
-func _HSMDateTime_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
-	m := msg.(*HSMDateTime)
-	switch tag {
-	case 1: // datetimeOneof.component
-		if wire != proto.WireBytes {
-			return true, proto.ErrInternalBadWireType
-		}
-		msg := new(HSMDateTimeComponent)
-		err := b.DecodeMessage(msg)
-		m.DatetimeOneof = &HSMDateTime_Component{msg}
-		return true, err
-	case 2: // datetimeOneof.unixEpoch
-		if wire != proto.WireBytes {
-			return true, proto.ErrInternalBadWireType
-		}
-		msg := new(HSMDateTimeUnixEpoch)
-		err := b.DecodeMessage(msg)
-		m.DatetimeOneof = &HSMDateTime_UnixEpoch{msg}
-		return true, err
-	default:
-		return false, nil
-	}
-}
-
-func _HSMDateTime_OneofSizer(msg proto.Message) (n int) {
-	m := msg.(*HSMDateTime)
-	// datetimeOneof
-	switch x := m.DatetimeOneof.(type) {
-	case *HSMDateTime_Component:
-		s := proto.Size(x.Component)
-		n += 1 // tag and wire
-		n += proto.SizeVarint(uint64(s))
-		n += s
-	case *HSMDateTime_UnixEpoch:
-		s := proto.Size(x.UnixEpoch)
-		n += 1 // tag and wire
-		n += proto.SizeVarint(uint64(s))
-		n += s
-	case nil:
-	default:
-		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
-	}
-	return n
-}
-
-type HSMLocalizableParameter struct {
-	Default *string `protobuf:"bytes,1,opt,name=default" json:"default,omitempty"`
-	// Types that are valid to be assigned to ParamOneof:
-	//	*HSMLocalizableParameter_Currency
-	//	*HSMLocalizableParameter_DateTime
-	ParamOneof           isHSMLocalizableParameter_ParamOneof `protobuf_oneof:"paramOneof"`
-	XXX_NoUnkeyedLiteral struct{}                             `json:"-"`
-	XXX_unrecognized     []byte                               `json:"-"`
-	XXX_sizecache        int32                                `json:"-"`
-}
-
-func (m *HSMLocalizableParameter) Reset()         { *m = HSMLocalizableParameter{} }
-func (m *HSMLocalizableParameter) String() string { return proto.CompactTextString(m) }
-func (*HSMLocalizableParameter) ProtoMessage()    {}
-func (*HSMLocalizableParameter) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{19}
-}
-func (m *HSMLocalizableParameter) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_HSMLocalizableParameter.Unmarshal(m, b)
-}
-func (m *HSMLocalizableParameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_HSMLocalizableParameter.Marshal(b, m, deterministic)
-}
-func (dst *HSMLocalizableParameter) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_HSMLocalizableParameter.Merge(dst, src)
-}
-func (m *HSMLocalizableParameter) XXX_Size() int {
-	return xxx_messageInfo_HSMLocalizableParameter.Size(m)
-}
-func (m *HSMLocalizableParameter) XXX_DiscardUnknown() {
-	xxx_messageInfo_HSMLocalizableParameter.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HSMLocalizableParameter proto.InternalMessageInfo
-
-type isHSMLocalizableParameter_ParamOneof interface {
-	isHSMLocalizableParameter_ParamOneof()
-}
-
-type HSMLocalizableParameter_Currency struct {
-	Currency *HSMCurrency `protobuf:"bytes,2,opt,name=currency,oneof"`
-}
-type HSMLocalizableParameter_DateTime struct {
-	DateTime *HSMDateTime `protobuf:"bytes,3,opt,name=dateTime,oneof"`
-}
-
-func (*HSMLocalizableParameter_Currency) isHSMLocalizableParameter_ParamOneof() {}
-func (*HSMLocalizableParameter_DateTime) isHSMLocalizableParameter_ParamOneof() {}
-
-func (m *HSMLocalizableParameter) GetParamOneof() isHSMLocalizableParameter_ParamOneof {
-	if m != nil {
-		return m.ParamOneof
-	}
-	return nil
-}
-
-func (m *HSMLocalizableParameter) GetDefault() string {
-	if m != nil && m.Default != nil {
-		return *m.Default
-	}
-	return ""
-}
-
-func (m *HSMLocalizableParameter) GetCurrency() *HSMCurrency {
-	if x, ok := m.GetParamOneof().(*HSMLocalizableParameter_Currency); ok {
-		return x.Currency
-	}
-	return nil
-}
-
-func (m *HSMLocalizableParameter) GetDateTime() *HSMDateTime {
-	if x, ok := m.GetParamOneof().(*HSMLocalizableParameter_DateTime); ok {
-		return x.DateTime
-	}
-	return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*HSMLocalizableParameter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
-	return _HSMLocalizableParameter_OneofMarshaler, _HSMLocalizableParameter_OneofUnmarshaler, _HSMLocalizableParameter_OneofSizer, []interface{}{
-		(*HSMLocalizableParameter_Currency)(nil),
-		(*HSMLocalizableParameter_DateTime)(nil),
-	}
-}
-
-func _HSMLocalizableParameter_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
-	m := msg.(*HSMLocalizableParameter)
-	// paramOneof
-	switch x := m.ParamOneof.(type) {
-	case *HSMLocalizableParameter_Currency:
-		b.EncodeVarint(2<<3 | proto.WireBytes)
-		if err := b.EncodeMessage(x.Currency); err != nil {
-			return err
-		}
-	case *HSMLocalizableParameter_DateTime:
-		b.EncodeVarint(3<<3 | proto.WireBytes)
-		if err := b.EncodeMessage(x.DateTime); err != nil {
-			return err
-		}
-	case nil:
-	default:
-		return fmt.Errorf("HSMLocalizableParameter.ParamOneof has unexpected type %T", x)
-	}
-	return nil
-}
-
-func _HSMLocalizableParameter_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
-	m := msg.(*HSMLocalizableParameter)
-	switch tag {
-	case 2: // paramOneof.currency
-		if wire != proto.WireBytes {
-			return true, proto.ErrInternalBadWireType
-		}
-		msg := new(HSMCurrency)
-		err := b.DecodeMessage(msg)
-		m.ParamOneof = &HSMLocalizableParameter_Currency{msg}
-		return true, err
-	case 3: // paramOneof.dateTime
-		if wire != proto.WireBytes {
-			return true, proto.ErrInternalBadWireType
-		}
-		msg := new(HSMDateTime)
-		err := b.DecodeMessage(msg)
-		m.ParamOneof = &HSMLocalizableParameter_DateTime{msg}
-		return true, err
-	default:
-		return false, nil
-	}
-}
-
-func _HSMLocalizableParameter_OneofSizer(msg proto.Message) (n int) {
-	m := msg.(*HSMLocalizableParameter)
-	// paramOneof
-	switch x := m.ParamOneof.(type) {
-	case *HSMLocalizableParameter_Currency:
-		s := proto.Size(x.Currency)
-		n += 1 // tag and wire
-		n += proto.SizeVarint(uint64(s))
-		n += s
-	case *HSMLocalizableParameter_DateTime:
-		s := proto.Size(x.DateTime)
-		n += 1 // tag and wire
-		n += proto.SizeVarint(uint64(s))
-		n += s
-	case nil:
-	default:
-		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
-	}
-	return n
-}
-
-type HighlyStructuredMessage struct {
-	Namespace            *string                    `protobuf:"bytes,1,opt,name=namespace" json:"namespace,omitempty"`
-	ElementName          *string                    `protobuf:"bytes,2,opt,name=elementName" json:"elementName,omitempty"`
-	Params               []string                   `protobuf:"bytes,3,rep,name=params" json:"params,omitempty"`
-	FallbackLg           *string                    `protobuf:"bytes,4,opt,name=fallbackLg" json:"fallbackLg,omitempty"`
-	FallbackLc           *string                    `protobuf:"bytes,5,opt,name=fallbackLc" json:"fallbackLc,omitempty"`
-	LocalizableParams    []*HSMLocalizableParameter `protobuf:"bytes,6,rep,name=localizableParams" json:"localizableParams,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
-	XXX_unrecognized     []byte                     `json:"-"`
-	XXX_sizecache        int32                      `json:"-"`
-}
-
-func (m *HighlyStructuredMessage) Reset()         { *m = HighlyStructuredMessage{} }
-func (m *HighlyStructuredMessage) String() string { return proto.CompactTextString(m) }
-func (*HighlyStructuredMessage) ProtoMessage()    {}
-func (*HighlyStructuredMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{20}
-}
-func (m *HighlyStructuredMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_HighlyStructuredMessage.Unmarshal(m, b)
-}
-func (m *HighlyStructuredMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_HighlyStructuredMessage.Marshal(b, m, deterministic)
-}
-func (dst *HighlyStructuredMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_HighlyStructuredMessage.Merge(dst, src)
-}
-func (m *HighlyStructuredMessage) XXX_Size() int {
-	return xxx_messageInfo_HighlyStructuredMessage.Size(m)
-}
-func (m *HighlyStructuredMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_HighlyStructuredMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HighlyStructuredMessage proto.InternalMessageInfo
-
-func (m *HighlyStructuredMessage) GetNamespace() string {
-	if m != nil && m.Namespace != nil {
-		return *m.Namespace
-	}
-	return ""
-}
-
-func (m *HighlyStructuredMessage) GetElementName() string {
-	if m != nil && m.ElementName != nil {
-		return *m.ElementName
-	}
-	return ""
-}
-
-func (m *HighlyStructuredMessage) GetParams() []string {
-	if m != nil {
-		return m.Params
-	}
-	return nil
-}
-
-func (m *HighlyStructuredMessage) GetFallbackLg() string {
-	if m != nil && m.FallbackLg != nil {
-		return *m.FallbackLg
-	}
-	return ""
-}
-
-func (m *HighlyStructuredMessage) GetFallbackLc() string {
-	if m != nil && m.FallbackLc != nil {
-		return *m.FallbackLc
-	}
-	return ""
-}
-
-func (m *HighlyStructuredMessage) GetLocalizableParams() []*HSMLocalizableParameter {
-	if m != nil {
-		return m.LocalizableParams
-	}
-	return nil
-}
-
-type SendPaymentMessage struct {
-	NoteMessage          *Message `protobuf:"bytes,2,opt,name=noteMessage" json:"noteMessage,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *SendPaymentMessage) Reset()         { *m = SendPaymentMessage{} }
-func (m *SendPaymentMessage) String() string { return proto.CompactTextString(m) }
-func (*SendPaymentMessage) ProtoMessage()    {}
-func (*SendPaymentMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{21}
-}
-func (m *SendPaymentMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_SendPaymentMessage.Unmarshal(m, b)
-}
-func (m *SendPaymentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_SendPaymentMessage.Marshal(b, m, deterministic)
-}
-func (dst *SendPaymentMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_SendPaymentMessage.Merge(dst, src)
-}
-func (m *SendPaymentMessage) XXX_Size() int {
-	return xxx_messageInfo_SendPaymentMessage.Size(m)
-}
-func (m *SendPaymentMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_SendPaymentMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_SendPaymentMessage proto.InternalMessageInfo
-
-func (m *SendPaymentMessage) GetNoteMessage() *Message {
-	if m != nil {
-		return m.NoteMessage
-	}
-	return nil
-}
-
-type RequestPaymentMessage struct {
-	CurrencyCodeIso4217  *string  `protobuf:"bytes,1,opt,name=currencyCodeIso4217" json:"currencyCodeIso4217,omitempty"`
-	Amount1000           *uint64  `protobuf:"varint,2,opt,name=amount1000" json:"amount1000,omitempty"`
-	RequestFrom          *string  `protobuf:"bytes,3,opt,name=requestFrom" json:"requestFrom,omitempty"`
-	NoteMessage          *Message `protobuf:"bytes,4,opt,name=noteMessage" json:"noteMessage,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *RequestPaymentMessage) Reset()         { *m = RequestPaymentMessage{} }
-func (m *RequestPaymentMessage) String() string { return proto.CompactTextString(m) }
-func (*RequestPaymentMessage) ProtoMessage()    {}
-func (*RequestPaymentMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{22}
-}
-func (m *RequestPaymentMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_RequestPaymentMessage.Unmarshal(m, b)
-}
-func (m *RequestPaymentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_RequestPaymentMessage.Marshal(b, m, deterministic)
-}
-func (dst *RequestPaymentMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_RequestPaymentMessage.Merge(dst, src)
-}
-func (m *RequestPaymentMessage) XXX_Size() int {
-	return xxx_messageInfo_RequestPaymentMessage.Size(m)
-}
-func (m *RequestPaymentMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_RequestPaymentMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_RequestPaymentMessage proto.InternalMessageInfo
-
-func (m *RequestPaymentMessage) GetCurrencyCodeIso4217() string {
-	if m != nil && m.CurrencyCodeIso4217 != nil {
-		return *m.CurrencyCodeIso4217
-	}
-	return ""
-}
-
-func (m *RequestPaymentMessage) GetAmount1000() uint64 {
-	if m != nil && m.Amount1000 != nil {
-		return *m.Amount1000
-	}
-	return 0
-}
-
-func (m *RequestPaymentMessage) GetRequestFrom() string {
-	if m != nil && m.RequestFrom != nil {
-		return *m.RequestFrom
-	}
-	return ""
-}
-
-func (m *RequestPaymentMessage) GetNoteMessage() *Message {
-	if m != nil {
-		return m.NoteMessage
-	}
-	return nil
-}
-
-type LiveLocationMessage struct {
-	DegreesLatitude                   *float64     `protobuf:"fixed64,1,opt,name=degreesLatitude" json:"degreesLatitude,omitempty"`
-	DegreesLongitude                  *float64     `protobuf:"fixed64,2,opt,name=degreesLongitude" json:"degreesLongitude,omitempty"`
-	AccuracyInMeters                  *uint32      `protobuf:"varint,3,opt,name=accuracyInMeters" json:"accuracyInMeters,omitempty"`
-	SpeedInMps                        *float32     `protobuf:"fixed32,4,opt,name=speedInMps" json:"speedInMps,omitempty"`
-	DegreesClockwiseFromMagneticNorth *uint32      `protobuf:"varint,5,opt,name=degreesClockwiseFromMagneticNorth" json:"degreesClockwiseFromMagneticNorth,omitempty"`
-	Caption                           *string      `protobuf:"bytes,6,opt,name=caption" json:"caption,omitempty"`
-	SequenceNumber                    *int64       `protobuf:"varint,7,opt,name=sequenceNumber" json:"sequenceNumber,omitempty"`
-	JpegThumbnail                     []byte       `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"`
-	ContextInfo                       *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral              struct{}     `json:"-"`
-	XXX_unrecognized                  []byte       `json:"-"`
-	XXX_sizecache                     int32        `json:"-"`
-}
-
-func (m *LiveLocationMessage) Reset()         { *m = LiveLocationMessage{} }
-func (m *LiveLocationMessage) String() string { return proto.CompactTextString(m) }
-func (*LiveLocationMessage) ProtoMessage()    {}
-func (*LiveLocationMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{23}
-}
-func (m *LiveLocationMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_LiveLocationMessage.Unmarshal(m, b)
-}
-func (m *LiveLocationMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_LiveLocationMessage.Marshal(b, m, deterministic)
-}
-func (dst *LiveLocationMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_LiveLocationMessage.Merge(dst, src)
-}
-func (m *LiveLocationMessage) XXX_Size() int {
-	return xxx_messageInfo_LiveLocationMessage.Size(m)
-}
-func (m *LiveLocationMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_LiveLocationMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_LiveLocationMessage proto.InternalMessageInfo
-
-func (m *LiveLocationMessage) GetDegreesLatitude() float64 {
-	if m != nil && m.DegreesLatitude != nil {
-		return *m.DegreesLatitude
-	}
-	return 0
-}
-
-func (m *LiveLocationMessage) GetDegreesLongitude() float64 {
-	if m != nil && m.DegreesLongitude != nil {
-		return *m.DegreesLongitude
-	}
-	return 0
-}
-
-func (m *LiveLocationMessage) GetAccuracyInMeters() uint32 {
-	if m != nil && m.AccuracyInMeters != nil {
-		return *m.AccuracyInMeters
-	}
-	return 0
-}
-
-func (m *LiveLocationMessage) GetSpeedInMps() float32 {
-	if m != nil && m.SpeedInMps != nil {
-		return *m.SpeedInMps
-	}
-	return 0
-}
-
-func (m *LiveLocationMessage) GetDegreesClockwiseFromMagneticNorth() uint32 {
-	if m != nil && m.DegreesClockwiseFromMagneticNorth != nil {
-		return *m.DegreesClockwiseFromMagneticNorth
-	}
-	return 0
-}
-
-func (m *LiveLocationMessage) GetCaption() string {
-	if m != nil && m.Caption != nil {
-		return *m.Caption
-	}
-	return ""
-}
-
-func (m *LiveLocationMessage) GetSequenceNumber() int64 {
-	if m != nil && m.SequenceNumber != nil {
-		return *m.SequenceNumber
-	}
-	return 0
-}
-
-func (m *LiveLocationMessage) GetJpegThumbnail() []byte {
-	if m != nil {
-		return m.JpegThumbnail
-	}
-	return nil
-}
-
-func (m *LiveLocationMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type StickerMessage struct {
-	Url                  *string      `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
-	FileSha256           []byte       `protobuf:"bytes,2,opt,name=fileSha256" json:"fileSha256,omitempty"`
-	FileEncSha256        []byte       `protobuf:"bytes,3,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"`
-	MediaKey             []byte       `protobuf:"bytes,4,opt,name=mediaKey" json:"mediaKey,omitempty"`
-	Mimetype             *string      `protobuf:"bytes,5,opt,name=mimetype" json:"mimetype,omitempty"`
-	Height               *uint32      `protobuf:"varint,6,opt,name=height" json:"height,omitempty"`
-	Width                *uint32      `protobuf:"varint,7,opt,name=width" json:"width,omitempty"`
-	DirectPath           *string      `protobuf:"bytes,8,opt,name=directPath" json:"directPath,omitempty"`
-	FileLength           *uint64      `protobuf:"varint,9,opt,name=fileLength" json:"fileLength,omitempty"`
-	PngThumbnail         []byte       `protobuf:"bytes,16,opt,name=pngThumbnail" json:"pngThumbnail,omitempty"`
-	ContextInfo          *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
-	XXX_unrecognized     []byte       `json:"-"`
-	XXX_sizecache        int32        `json:"-"`
-}
-
-func (m *StickerMessage) Reset()         { *m = StickerMessage{} }
-func (m *StickerMessage) String() string { return proto.CompactTextString(m) }
-func (*StickerMessage) ProtoMessage()    {}
-func (*StickerMessage) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{24}
-}
-func (m *StickerMessage) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_StickerMessage.Unmarshal(m, b)
-}
-func (m *StickerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_StickerMessage.Marshal(b, m, deterministic)
-}
-func (dst *StickerMessage) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_StickerMessage.Merge(dst, src)
-}
-func (m *StickerMessage) XXX_Size() int {
-	return xxx_messageInfo_StickerMessage.Size(m)
-}
-func (m *StickerMessage) XXX_DiscardUnknown() {
-	xxx_messageInfo_StickerMessage.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_StickerMessage proto.InternalMessageInfo
-
-func (m *StickerMessage) GetUrl() string {
-	if m != nil && m.Url != nil {
-		return *m.Url
-	}
-	return ""
-}
-
-func (m *StickerMessage) GetFileSha256() []byte {
-	if m != nil {
-		return m.FileSha256
-	}
-	return nil
-}
-
-func (m *StickerMessage) GetFileEncSha256() []byte {
-	if m != nil {
-		return m.FileEncSha256
-	}
-	return nil
-}
-
-func (m *StickerMessage) GetMediaKey() []byte {
-	if m != nil {
-		return m.MediaKey
-	}
-	return nil
-}
-
-func (m *StickerMessage) GetMimetype() string {
-	if m != nil && m.Mimetype != nil {
-		return *m.Mimetype
-	}
-	return ""
-}
-
-func (m *StickerMessage) GetHeight() uint32 {
-	if m != nil && m.Height != nil {
-		return *m.Height
-	}
-	return 0
-}
-
-func (m *StickerMessage) GetWidth() uint32 {
-	if m != nil && m.Width != nil {
-		return *m.Width
-	}
-	return 0
-}
-
-func (m *StickerMessage) GetDirectPath() string {
-	if m != nil && m.DirectPath != nil {
-		return *m.DirectPath
-	}
-	return ""
-}
-
-func (m *StickerMessage) GetFileLength() uint64 {
-	if m != nil && m.FileLength != nil {
-		return *m.FileLength
-	}
-	return 0
-}
-
-func (m *StickerMessage) GetPngThumbnail() []byte {
-	if m != nil {
-		return m.PngThumbnail
-	}
-	return nil
-}
-
-func (m *StickerMessage) GetContextInfo() *ContextInfo {
-	if m != nil {
-		return m.ContextInfo
-	}
-	return nil
-}
-
-type Message struct {
-	Conversation                               *string                       `protobuf:"bytes,1,opt,name=conversation" json:"conversation,omitempty"`
-	SenderKeyDistributionMessage               *SenderKeyDistributionMessage `protobuf:"bytes,2,opt,name=senderKeyDistributionMessage" json:"senderKeyDistributionMessage,omitempty"`
-	ImageMessage                               *ImageMessage                 `protobuf:"bytes,3,opt,name=imageMessage" json:"imageMessage,omitempty"`
-	ContactMessage                             *ContactMessage               `protobuf:"bytes,4,opt,name=contactMessage" json:"contactMessage,omitempty"`
-	LocationMessage                            *LocationMessage              `protobuf:"bytes,5,opt,name=locationMessage" json:"locationMessage,omitempty"`
-	ExtendedTextMessage                        *ExtendedTextMessage          `protobuf:"bytes,6,opt,name=extendedTextMessage" json:"extendedTextMessage,omitempty"`
-	DocumentMessage                            *DocumentMessage              `protobuf:"bytes,7,opt,name=documentMessage" json:"documentMessage,omitempty"`
-	AudioMessage                               *AudioMessage                 `protobuf:"bytes,8,opt,name=audioMessage" json:"audioMessage,omitempty"`
-	VideoMessage                               *VideoMessage                 `protobuf:"bytes,9,opt,name=videoMessage" json:"videoMessage,omitempty"`
-	Call                                       *Call                         `protobuf:"bytes,10,opt,name=call" json:"call,omitempty"`
-	Chat                                       *Chat                         `protobuf:"bytes,11,opt,name=chat" json:"chat,omitempty"`
-	ProtocolMessage                            *ProtocolMessage              `protobuf:"bytes,12,opt,name=protocolMessage" json:"protocolMessage,omitempty"`
-	ContactsArrayMessage                       *ContactsArrayMessage         `protobuf:"bytes,13,opt,name=contactsArrayMessage" json:"contactsArrayMessage,omitempty"`
-	HighlyStructuredMessage                    *HighlyStructuredMessage      `protobuf:"bytes,14,opt,name=highlyStructuredMessage" json:"highlyStructuredMessage,omitempty"`
-	FastRatchetKeySenderKeyDistributionMessage *SenderKeyDistributionMessage `protobuf:"bytes,15,opt,name=fastRatchetKeySenderKeyDistributionMessage" json:"fastRatchetKeySenderKeyDistributionMessage,omitempty"`
-	SendPaymentMessage                         *SendPaymentMessage           `protobuf:"bytes,16,opt,name=sendPaymentMessage" json:"sendPaymentMessage,omitempty"`
-	RequestPaymentMessage                      *RequestPaymentMessage        `protobuf:"bytes,17,opt,name=requestPaymentMessage" json:"requestPaymentMessage,omitempty"`
-	LiveLocationMessage                        *LiveLocationMessage          `protobuf:"bytes,18,opt,name=liveLocationMessage" json:"liveLocationMessage,omitempty"`
-	StickerMessage                             *StickerMessage               `protobuf:"bytes,20,opt,name=stickerMessage" json:"stickerMessage,omitempty"`
-	XXX_NoUnkeyedLiteral                       struct{}                      `json:"-"`
-	XXX_unrecognized                           []byte                        `json:"-"`
-	XXX_sizecache                              int32                         `json:"-"`
-}
-
-func (m *Message) Reset()         { *m = Message{} }
-func (m *Message) String() string { return proto.CompactTextString(m) }
-func (*Message) ProtoMessage()    {}
-func (*Message) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{25}
-}
-func (m *Message) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Message.Unmarshal(m, b)
-}
-func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Message.Marshal(b, m, deterministic)
-}
-func (dst *Message) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Message.Merge(dst, src)
-}
-func (m *Message) XXX_Size() int {
-	return xxx_messageInfo_Message.Size(m)
-}
-func (m *Message) XXX_DiscardUnknown() {
-	xxx_messageInfo_Message.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Message proto.InternalMessageInfo
-
-func (m *Message) GetConversation() string {
-	if m != nil && m.Conversation != nil {
-		return *m.Conversation
-	}
-	return ""
-}
-
-func (m *Message) GetSenderKeyDistributionMessage() *SenderKeyDistributionMessage {
-	if m != nil {
-		return m.SenderKeyDistributionMessage
-	}
-	return nil
-}
-
-func (m *Message) GetImageMessage() *ImageMessage {
-	if m != nil {
-		return m.ImageMessage
-	}
-	return nil
-}
-
-func (m *Message) GetContactMessage() *ContactMessage {
-	if m != nil {
-		return m.ContactMessage
-	}
-	return nil
-}
-
-func (m *Message) GetLocationMessage() *LocationMessage {
-	if m != nil {
-		return m.LocationMessage
-	}
-	return nil
-}
-
-func (m *Message) GetExtendedTextMessage() *ExtendedTextMessage {
-	if m != nil {
-		return m.ExtendedTextMessage
-	}
-	return nil
-}
-
-func (m *Message) GetDocumentMessage() *DocumentMessage {
-	if m != nil {
-		return m.DocumentMessage
-	}
-	return nil
-}
-
-func (m *Message) GetAudioMessage() *AudioMessage {
-	if m != nil {
-		return m.AudioMessage
-	}
-	return nil
-}
-
-func (m *Message) GetVideoMessage() *VideoMessage {
-	if m != nil {
-		return m.VideoMessage
-	}
-	return nil
-}
-
-func (m *Message) GetCall() *Call {
-	if m != nil {
-		return m.Call
-	}
-	return nil
-}
-
-func (m *Message) GetChat() *Chat {
-	if m != nil {
-		return m.Chat
-	}
-	return nil
-}
-
-func (m *Message) GetProtocolMessage() *ProtocolMessage {
-	if m != nil {
-		return m.ProtocolMessage
-	}
-	return nil
-}
-
-func (m *Message) GetContactsArrayMessage() *ContactsArrayMessage {
-	if m != nil {
-		return m.ContactsArrayMessage
-	}
-	return nil
-}
-
-func (m *Message) GetHighlyStructuredMessage() *HighlyStructuredMessage {
-	if m != nil {
-		return m.HighlyStructuredMessage
-	}
-	return nil
-}
-
-func (m *Message) GetFastRatchetKeySenderKeyDistributionMessage() *SenderKeyDistributionMessage {
-	if m != nil {
-		return m.FastRatchetKeySenderKeyDistributionMessage
-	}
-	return nil
-}
-
-func (m *Message) GetSendPaymentMessage() *SendPaymentMessage {
-	if m != nil {
-		return m.SendPaymentMessage
-	}
-	return nil
-}
-
-func (m *Message) GetRequestPaymentMessage() *RequestPaymentMessage {
-	if m != nil {
-		return m.RequestPaymentMessage
-	}
-	return nil
-}
-
-func (m *Message) GetLiveLocationMessage() *LiveLocationMessage {
-	if m != nil {
-		return m.LiveLocationMessage
-	}
-	return nil
-}
-
-func (m *Message) GetStickerMessage() *StickerMessage {
-	if m != nil {
-		return m.StickerMessage
-	}
-	return nil
-}
-
-type ContextInfo struct {
-	StanzaId               *string    `protobuf:"bytes,1,opt,name=stanzaId" json:"stanzaId,omitempty"`
-	Participant            *string    `protobuf:"bytes,2,opt,name=participant" json:"participant,omitempty"`
-	QuotedMessage          []*Message `protobuf:"bytes,3,rep,name=quotedMessage" json:"quotedMessage,omitempty"`
-	RemoteJid              *string    `protobuf:"bytes,4,opt,name=remoteJid" json:"remoteJid,omitempty"`
-	MentionedJid           []string   `protobuf:"bytes,15,rep,name=mentionedJid" json:"mentionedJid,omitempty"`
-	ConversionSource       *string    `protobuf:"bytes,18,opt,name=conversionSource" json:"conversionSource,omitempty"`
-	ConversionData         []byte     `protobuf:"bytes,19,opt,name=conversionData" json:"conversionData,omitempty"`
-	ConversionDelaySeconds *uint32    `protobuf:"varint,20,opt,name=conversionDelaySeconds" json:"conversionDelaySeconds,omitempty"`
-	IsForwarded            *bool      `protobuf:"varint,22,opt,name=isForwarded" json:"isForwarded,omitempty"`
-	XXX_NoUnkeyedLiteral   struct{}   `json:"-"`
-	XXX_unrecognized       []byte     `json:"-"`
-	XXX_sizecache          int32      `json:"-"`
-}
-
-func (m *ContextInfo) Reset()         { *m = ContextInfo{} }
-func (m *ContextInfo) String() string { return proto.CompactTextString(m) }
-func (*ContextInfo) ProtoMessage()    {}
-func (*ContextInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{26}
-}
-func (m *ContextInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ContextInfo.Unmarshal(m, b)
-}
-func (m *ContextInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ContextInfo.Marshal(b, m, deterministic)
-}
-func (dst *ContextInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ContextInfo.Merge(dst, src)
-}
-func (m *ContextInfo) XXX_Size() int {
-	return xxx_messageInfo_ContextInfo.Size(m)
-}
-func (m *ContextInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_ContextInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ContextInfo proto.InternalMessageInfo
-
-func (m *ContextInfo) GetStanzaId() string {
-	if m != nil && m.StanzaId != nil {
-		return *m.StanzaId
-	}
-	return ""
-}
-
-func (m *ContextInfo) GetParticipant() string {
-	if m != nil && m.Participant != nil {
-		return *m.Participant
-	}
-	return ""
-}
-
-func (m *ContextInfo) GetQuotedMessage() []*Message {
-	if m != nil {
-		return m.QuotedMessage
-	}
-	return nil
-}
-
-func (m *ContextInfo) GetRemoteJid() string {
-	if m != nil && m.RemoteJid != nil {
-		return *m.RemoteJid
-	}
-	return ""
-}
-
-func (m *ContextInfo) GetMentionedJid() []string {
-	if m != nil {
-		return m.MentionedJid
-	}
-	return nil
-}
-
-func (m *ContextInfo) GetConversionSource() string {
-	if m != nil && m.ConversionSource != nil {
-		return *m.ConversionSource
-	}
-	return ""
-}
-
-func (m *ContextInfo) GetConversionData() []byte {
-	if m != nil {
-		return m.ConversionData
-	}
-	return nil
-}
-
-func (m *ContextInfo) GetConversionDelaySeconds() uint32 {
-	if m != nil && m.ConversionDelaySeconds != nil {
-		return *m.ConversionDelaySeconds
-	}
-	return 0
-}
-
-func (m *ContextInfo) GetIsForwarded() bool {
-	if m != nil && m.IsForwarded != nil {
-		return *m.IsForwarded
-	}
-	return false
-}
-
-type InteractiveAnnotation struct {
-	PolygonVertices []*Point `protobuf:"bytes,1,rep,name=polygonVertices" json:"polygonVertices,omitempty"`
-	// Types that are valid to be assigned to Action:
-	//	*InteractiveAnnotation_Location
-	Action               isInteractiveAnnotation_Action `protobuf_oneof:"action"`
-	XXX_NoUnkeyedLiteral struct{}                       `json:"-"`
-	XXX_unrecognized     []byte                         `json:"-"`
-	XXX_sizecache        int32                          `json:"-"`
-}
-
-func (m *InteractiveAnnotation) Reset()         { *m = InteractiveAnnotation{} }
-func (m *InteractiveAnnotation) String() string { return proto.CompactTextString(m) }
-func (*InteractiveAnnotation) ProtoMessage()    {}
-func (*InteractiveAnnotation) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{27}
-}
-func (m *InteractiveAnnotation) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_InteractiveAnnotation.Unmarshal(m, b)
-}
-func (m *InteractiveAnnotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_InteractiveAnnotation.Marshal(b, m, deterministic)
-}
-func (dst *InteractiveAnnotation) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_InteractiveAnnotation.Merge(dst, src)
-}
-func (m *InteractiveAnnotation) XXX_Size() int {
-	return xxx_messageInfo_InteractiveAnnotation.Size(m)
-}
-func (m *InteractiveAnnotation) XXX_DiscardUnknown() {
-	xxx_messageInfo_InteractiveAnnotation.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_InteractiveAnnotation proto.InternalMessageInfo
-
-type isInteractiveAnnotation_Action interface {
-	isInteractiveAnnotation_Action()
-}
-
-type InteractiveAnnotation_Location struct {
-	Location *Location `protobuf:"bytes,2,opt,name=location,oneof"`
-}
-
-func (*InteractiveAnnotation_Location) isInteractiveAnnotation_Action() {}
-
-func (m *InteractiveAnnotation) GetAction() isInteractiveAnnotation_Action {
-	if m != nil {
-		return m.Action
-	}
-	return nil
-}
-
-func (m *InteractiveAnnotation) GetPolygonVertices() []*Point {
-	if m != nil {
-		return m.PolygonVertices
-	}
-	return nil
-}
-
-func (m *InteractiveAnnotation) GetLocation() *Location {
-	if x, ok := m.GetAction().(*InteractiveAnnotation_Location); ok {
-		return x.Location
-	}
-	return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*InteractiveAnnotation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
-	return _InteractiveAnnotation_OneofMarshaler, _InteractiveAnnotation_OneofUnmarshaler, _InteractiveAnnotation_OneofSizer, []interface{}{
-		(*InteractiveAnnotation_Location)(nil),
-	}
-}
-
-func _InteractiveAnnotation_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
-	m := msg.(*InteractiveAnnotation)
-	// action
-	switch x := m.Action.(type) {
-	case *InteractiveAnnotation_Location:
-		b.EncodeVarint(2<<3 | proto.WireBytes)
-		if err := b.EncodeMessage(x.Location); err != nil {
-			return err
-		}
-	case nil:
-	default:
-		return fmt.Errorf("InteractiveAnnotation.Action has unexpected type %T", x)
-	}
-	return nil
-}
-
-func _InteractiveAnnotation_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
-	m := msg.(*InteractiveAnnotation)
-	switch tag {
-	case 2: // action.location
-		if wire != proto.WireBytes {
-			return true, proto.ErrInternalBadWireType
-		}
-		msg := new(Location)
-		err := b.DecodeMessage(msg)
-		m.Action = &InteractiveAnnotation_Location{msg}
-		return true, err
-	default:
-		return false, nil
-	}
-}
-
-func _InteractiveAnnotation_OneofSizer(msg proto.Message) (n int) {
-	m := msg.(*InteractiveAnnotation)
-	// action
-	switch x := m.Action.(type) {
-	case *InteractiveAnnotation_Location:
-		s := proto.Size(x.Location)
-		n += 1 // tag and wire
-		n += proto.SizeVarint(uint64(s))
-		n += s
-	case nil:
-	default:
-		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
-	}
-	return n
-}
-
-type Point struct {
-	X                    *float64 `protobuf:"fixed64,3,opt,name=x" json:"x,omitempty"`
-	Y                    *float64 `protobuf:"fixed64,4,opt,name=y" json:"y,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *Point) Reset()         { *m = Point{} }
-func (m *Point) String() string { return proto.CompactTextString(m) }
-func (*Point) ProtoMessage()    {}
-func (*Point) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{28}
-}
-func (m *Point) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Point.Unmarshal(m, b)
-}
-func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Point.Marshal(b, m, deterministic)
-}
-func (dst *Point) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Point.Merge(dst, src)
-}
-func (m *Point) XXX_Size() int {
-	return xxx_messageInfo_Point.Size(m)
-}
-func (m *Point) XXX_DiscardUnknown() {
-	xxx_messageInfo_Point.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Point proto.InternalMessageInfo
-
-func (m *Point) GetX() float64 {
-	if m != nil && m.X != nil {
-		return *m.X
-	}
-	return 0
-}
-
-func (m *Point) GetY() float64 {
-	if m != nil && m.Y != nil {
-		return *m.Y
-	}
-	return 0
-}
-
-type Location struct {
-	DegreesLatitude      *float64 `protobuf:"fixed64,1,opt,name=degreesLatitude" json:"degreesLatitude,omitempty"`
-	DegreesLongitude     *float64 `protobuf:"fixed64,2,opt,name=degreesLongitude" json:"degreesLongitude,omitempty"`
-	Name                 *string  `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *Location) Reset()         { *m = Location{} }
-func (m *Location) String() string { return proto.CompactTextString(m) }
-func (*Location) ProtoMessage()    {}
-func (*Location) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{29}
-}
-func (m *Location) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Location.Unmarshal(m, b)
-}
-func (m *Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Location.Marshal(b, m, deterministic)
-}
-func (dst *Location) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Location.Merge(dst, src)
-}
-func (m *Location) XXX_Size() int {
-	return xxx_messageInfo_Location.Size(m)
-}
-func (m *Location) XXX_DiscardUnknown() {
-	xxx_messageInfo_Location.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Location proto.InternalMessageInfo
-
-func (m *Location) GetDegreesLatitude() float64 {
-	if m != nil && m.DegreesLatitude != nil {
-		return *m.DegreesLatitude
-	}
-	return 0
-}
-
-func (m *Location) GetDegreesLongitude() float64 {
-	if m != nil && m.DegreesLongitude != nil {
-		return *m.DegreesLongitude
-	}
-	return 0
-}
-
-func (m *Location) GetName() string {
-	if m != nil && m.Name != nil {
-		return *m.Name
-	}
-	return ""
-}
-
-type WebMessageInfo struct {
-	Key                   *MessageKey              `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
-	Message               *Message                 `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
-	MessageTimestamp      *uint64                  `protobuf:"varint,3,opt,name=messageTimestamp" json:"messageTimestamp,omitempty"`
-	Status                *WebMessageInfo_STATUS   `protobuf:"varint,4,opt,name=status,enum=proto.WebMessageInfo_STATUS,def=1" json:"status,omitempty"`
-	Participant           *string                  `protobuf:"bytes,5,opt,name=participant" json:"participant,omitempty"`
-	Ignore                *bool                    `protobuf:"varint,16,opt,name=ignore" json:"ignore,omitempty"`
-	Starred               *bool                    `protobuf:"varint,17,opt,name=starred" json:"starred,omitempty"`
-	Broadcast             *bool                    `protobuf:"varint,18,opt,name=broadcast" json:"broadcast,omitempty"`
-	PushName              *string                  `protobuf:"bytes,19,opt,name=pushName" json:"pushName,omitempty"`
-	MediaCiphertextSha256 []byte                   `protobuf:"bytes,20,opt,name=mediaCiphertextSha256" json:"mediaCiphertextSha256,omitempty"`
-	Multicast             *bool                    `protobuf:"varint,21,opt,name=multicast" json:"multicast,omitempty"`
-	UrlText               *bool                    `protobuf:"varint,22,opt,name=urlText" json:"urlText,omitempty"`
-	UrlNumber             *bool                    `protobuf:"varint,23,opt,name=urlNumber" json:"urlNumber,omitempty"`
-	MessageStubType       *WebMessageInfo_STUBTYPE `protobuf:"varint,24,opt,name=messageStubType,enum=proto.WebMessageInfo_STUBTYPE" json:"messageStubType,omitempty"`
-	ClearMedia            *bool                    `protobuf:"varint,25,opt,name=clearMedia" json:"clearMedia,omitempty"`
-	MessageStubParameters []string                 `protobuf:"bytes,26,rep,name=messageStubParameters" json:"messageStubParameters,omitempty"`
-	Duration              *uint32                  `protobuf:"varint,27,opt,name=duration" json:"duration,omitempty"`
-	Labels                []string                 `protobuf:"bytes,28,rep,name=labels" json:"labels,omitempty"`
-	XXX_NoUnkeyedLiteral  struct{}                 `json:"-"`
-	XXX_unrecognized      []byte                   `json:"-"`
-	XXX_sizecache         int32                    `json:"-"`
-}
-
-func (m *WebMessageInfo) Reset()         { *m = WebMessageInfo{} }
-func (m *WebMessageInfo) String() string { return proto.CompactTextString(m) }
-func (*WebMessageInfo) ProtoMessage()    {}
-func (*WebMessageInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{30}
-}
-func (m *WebMessageInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_WebMessageInfo.Unmarshal(m, b)
-}
-func (m *WebMessageInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_WebMessageInfo.Marshal(b, m, deterministic)
-}
-func (dst *WebMessageInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_WebMessageInfo.Merge(dst, src)
-}
-func (m *WebMessageInfo) XXX_Size() int {
-	return xxx_messageInfo_WebMessageInfo.Size(m)
-}
-func (m *WebMessageInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_WebMessageInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_WebMessageInfo proto.InternalMessageInfo
-
-const Default_WebMessageInfo_Status WebMessageInfo_STATUS = WebMessageInfo_PENDING
-
-func (m *WebMessageInfo) GetKey() *MessageKey {
-	if m != nil {
-		return m.Key
-	}
-	return nil
-}
-
-func (m *WebMessageInfo) GetMessage() *Message {
-	if m != nil {
-		return m.Message
-	}
-	return nil
-}
-
-func (m *WebMessageInfo) GetMessageTimestamp() uint64 {
-	if m != nil && m.MessageTimestamp != nil {
-		return *m.MessageTimestamp
-	}
-	return 0
-}
-
-func (m *WebMessageInfo) GetStatus() WebMessageInfo_STATUS {
-	if m != nil && m.Status != nil {
-		return *m.Status
-	}
-	return Default_WebMessageInfo_Status
-}
-
-func (m *WebMessageInfo) GetParticipant() string {
-	if m != nil && m.Participant != nil {
-		return *m.Participant
-	}
-	return ""
-}
-
-func (m *WebMessageInfo) GetIgnore() bool {
-	if m != nil && m.Ignore != nil {
-		return *m.Ignore
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetStarred() bool {
-	if m != nil && m.Starred != nil {
-		return *m.Starred
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetBroadcast() bool {
-	if m != nil && m.Broadcast != nil {
-		return *m.Broadcast
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetPushName() string {
-	if m != nil && m.PushName != nil {
-		return *m.PushName
-	}
-	return ""
-}
-
-func (m *WebMessageInfo) GetMediaCiphertextSha256() []byte {
-	if m != nil {
-		return m.MediaCiphertextSha256
-	}
-	return nil
-}
-
-func (m *WebMessageInfo) GetMulticast() bool {
-	if m != nil && m.Multicast != nil {
-		return *m.Multicast
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetUrlText() bool {
-	if m != nil && m.UrlText != nil {
-		return *m.UrlText
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetUrlNumber() bool {
-	if m != nil && m.UrlNumber != nil {
-		return *m.UrlNumber
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetMessageStubType() WebMessageInfo_STUBTYPE {
-	if m != nil && m.MessageStubType != nil {
-		return *m.MessageStubType
-	}
-	return WebMessageInfo_UNKNOWN
-}
-
-func (m *WebMessageInfo) GetClearMedia() bool {
-	if m != nil && m.ClearMedia != nil {
-		return *m.ClearMedia
-	}
-	return false
-}
-
-func (m *WebMessageInfo) GetMessageStubParameters() []string {
-	if m != nil {
-		return m.MessageStubParameters
-	}
-	return nil
-}
-
-func (m *WebMessageInfo) GetDuration() uint32 {
-	if m != nil && m.Duration != nil {
-		return *m.Duration
-	}
-	return 0
-}
-
-func (m *WebMessageInfo) GetLabels() []string {
-	if m != nil {
-		return m.Labels
-	}
-	return nil
-}
-
-type WebNotificationsInfo struct {
-	Timestamp            *uint64    `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"`
-	UnreadChats          *uint32    `protobuf:"varint,3,opt,name=unreadChats" json:"unreadChats,omitempty"`
-	NotifyMessageCount   *uint32    `protobuf:"varint,4,opt,name=notifyMessageCount" json:"notifyMessageCount,omitempty"`
-	NotifyMessages       []*Message `protobuf:"bytes,5,rep,name=notifyMessages" json:"notifyMessages,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
-	XXX_unrecognized     []byte     `json:"-"`
-	XXX_sizecache        int32      `json:"-"`
-}
-
-func (m *WebNotificationsInfo) Reset()         { *m = WebNotificationsInfo{} }
-func (m *WebNotificationsInfo) String() string { return proto.CompactTextString(m) }
-func (*WebNotificationsInfo) ProtoMessage()    {}
-func (*WebNotificationsInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{31}
-}
-func (m *WebNotificationsInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_WebNotificationsInfo.Unmarshal(m, b)
-}
-func (m *WebNotificationsInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_WebNotificationsInfo.Marshal(b, m, deterministic)
-}
-func (dst *WebNotificationsInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_WebNotificationsInfo.Merge(dst, src)
-}
-func (m *WebNotificationsInfo) XXX_Size() int {
-	return xxx_messageInfo_WebNotificationsInfo.Size(m)
-}
-func (m *WebNotificationsInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_WebNotificationsInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_WebNotificationsInfo proto.InternalMessageInfo
-
-func (m *WebNotificationsInfo) GetTimestamp() uint64 {
-	if m != nil && m.Timestamp != nil {
-		return *m.Timestamp
-	}
-	return 0
-}
-
-func (m *WebNotificationsInfo) GetUnreadChats() uint32 {
-	if m != nil && m.UnreadChats != nil {
-		return *m.UnreadChats
-	}
-	return 0
-}
-
-func (m *WebNotificationsInfo) GetNotifyMessageCount() uint32 {
-	if m != nil && m.NotifyMessageCount != nil {
-		return *m.NotifyMessageCount
-	}
-	return 0
-}
-
-func (m *WebNotificationsInfo) GetNotifyMessages() []*Message {
-	if m != nil {
-		return m.NotifyMessages
-	}
-	return nil
-}
-
-type NotificationMessageInfo struct {
-	Key                  *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
-	Message              *Message    `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
-	MessageTimestamp     *uint64     `protobuf:"varint,3,opt,name=messageTimestamp" json:"messageTimestamp,omitempty"`
-	Participant          *string     `protobuf:"bytes,4,opt,name=participant" json:"participant,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
-	XXX_unrecognized     []byte      `json:"-"`
-	XXX_sizecache        int32       `json:"-"`
-}
-
-func (m *NotificationMessageInfo) Reset()         { *m = NotificationMessageInfo{} }
-func (m *NotificationMessageInfo) String() string { return proto.CompactTextString(m) }
-func (*NotificationMessageInfo) ProtoMessage()    {}
-func (*NotificationMessageInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{32}
-}
-func (m *NotificationMessageInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_NotificationMessageInfo.Unmarshal(m, b)
-}
-func (m *NotificationMessageInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_NotificationMessageInfo.Marshal(b, m, deterministic)
-}
-func (dst *NotificationMessageInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_NotificationMessageInfo.Merge(dst, src)
-}
-func (m *NotificationMessageInfo) XXX_Size() int {
-	return xxx_messageInfo_NotificationMessageInfo.Size(m)
-}
-func (m *NotificationMessageInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_NotificationMessageInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_NotificationMessageInfo proto.InternalMessageInfo
-
-func (m *NotificationMessageInfo) GetKey() *MessageKey {
-	if m != nil {
-		return m.Key
-	}
-	return nil
-}
-
-func (m *NotificationMessageInfo) GetMessage() *Message {
-	if m != nil {
-		return m.Message
-	}
-	return nil
-}
-
-func (m *NotificationMessageInfo) GetMessageTimestamp() uint64 {
-	if m != nil && m.MessageTimestamp != nil {
-		return *m.MessageTimestamp
-	}
-	return 0
-}
-
-func (m *NotificationMessageInfo) GetParticipant() string {
-	if m != nil && m.Participant != nil {
-		return *m.Participant
-	}
-	return ""
-}
-
-type TabletNotificationsInfo struct {
-	Timestamp            *uint64    `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"`
-	UnreadChats          *uint32    `protobuf:"varint,3,opt,name=unreadChats" json:"unreadChats,omitempty"`
-	NotifyMessageCount   *uint32    `protobuf:"varint,4,opt,name=notifyMessageCount" json:"notifyMessageCount,omitempty"`
-	NotifyMessage        []*Message `protobuf:"bytes,5,rep,name=notifyMessage" json:"notifyMessage,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
-	XXX_unrecognized     []byte     `json:"-"`
-	XXX_sizecache        int32      `json:"-"`
-}
-
-func (m *TabletNotificationsInfo) Reset()         { *m = TabletNotificationsInfo{} }
-func (m *TabletNotificationsInfo) String() string { return proto.CompactTextString(m) }
-func (*TabletNotificationsInfo) ProtoMessage()    {}
-func (*TabletNotificationsInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{33}
-}
-func (m *TabletNotificationsInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_TabletNotificationsInfo.Unmarshal(m, b)
-}
-func (m *TabletNotificationsInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_TabletNotificationsInfo.Marshal(b, m, deterministic)
-}
-func (dst *TabletNotificationsInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_TabletNotificationsInfo.Merge(dst, src)
-}
-func (m *TabletNotificationsInfo) XXX_Size() int {
-	return xxx_messageInfo_TabletNotificationsInfo.Size(m)
-}
-func (m *TabletNotificationsInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_TabletNotificationsInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_TabletNotificationsInfo proto.InternalMessageInfo
-
-func (m *TabletNotificationsInfo) GetTimestamp() uint64 {
-	if m != nil && m.Timestamp != nil {
-		return *m.Timestamp
-	}
-	return 0
-}
-
-func (m *TabletNotificationsInfo) GetUnreadChats() uint32 {
-	if m != nil && m.UnreadChats != nil {
-		return *m.UnreadChats
-	}
-	return 0
-}
-
-func (m *TabletNotificationsInfo) GetNotifyMessageCount() uint32 {
-	if m != nil && m.NotifyMessageCount != nil {
-		return *m.NotifyMessageCount
-	}
-	return 0
-}
-
-func (m *TabletNotificationsInfo) GetNotifyMessage() []*Message {
-	if m != nil {
-		return m.NotifyMessage
-	}
-	return nil
-}
-
-type WebFeatures struct {
-	LabelsDisplay          *WebFeatures_FLAG `protobuf:"varint,1,opt,name=labelsDisplay,enum=proto.WebFeatures_FLAG" json:"labelsDisplay,omitempty"`
-	VoipIndividualOutgoing *WebFeatures_FLAG `protobuf:"varint,2,opt,name=voipIndividualOutgoing,enum=proto.WebFeatures_FLAG" json:"voipIndividualOutgoing,omitempty"`
-	GroupsV3               *WebFeatures_FLAG `protobuf:"varint,3,opt,name=groupsV3,enum=proto.WebFeatures_FLAG" json:"groupsV3,omitempty"`
-	GroupsV3Create         *WebFeatures_FLAG `protobuf:"varint,4,opt,name=groupsV3Create,enum=proto.WebFeatures_FLAG" json:"groupsV3Create,omitempty"`
-	ChangeNumberV2         *WebFeatures_FLAG `protobuf:"varint,5,opt,name=changeNumberV2,enum=proto.WebFeatures_FLAG" json:"changeNumberV2,omitempty"`
-	QueryStatusV3Thumbnail *WebFeatures_FLAG `protobuf:"varint,6,opt,name=queryStatusV3Thumbnail,enum=proto.WebFeatures_FLAG" json:"queryStatusV3Thumbnail,omitempty"`
-	LiveLocations          *WebFeatures_FLAG `protobuf:"varint,7,opt,name=liveLocations,enum=proto.WebFeatures_FLAG" json:"liveLocations,omitempty"`
-	QueryVname             *WebFeatures_FLAG `protobuf:"varint,8,opt,name=queryVname,enum=proto.WebFeatures_FLAG" json:"queryVname,omitempty"`
-	VoipIndividualIncoming *WebFeatures_FLAG `protobuf:"varint,9,opt,name=voipIndividualIncoming,enum=proto.WebFeatures_FLAG" json:"voipIndividualIncoming,omitempty"`
-	QuickRepliesQuery      *WebFeatures_FLAG `protobuf:"varint,10,opt,name=quickRepliesQuery,enum=proto.WebFeatures_FLAG" json:"quickRepliesQuery,omitempty"`
-	XXX_NoUnkeyedLiteral   struct{}          `json:"-"`
-	XXX_unrecognized       []byte            `json:"-"`
-	XXX_sizecache          int32             `json:"-"`
-}
-
-func (m *WebFeatures) Reset()         { *m = WebFeatures{} }
-func (m *WebFeatures) String() string { return proto.CompactTextString(m) }
-func (*WebFeatures) ProtoMessage()    {}
-func (*WebFeatures) Descriptor() ([]byte, []int) {
-	return fileDescriptor_def_131d1935231ace52, []int{34}
-}
-func (m *WebFeatures) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_WebFeatures.Unmarshal(m, b)
-}
-func (m *WebFeatures) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_WebFeatures.Marshal(b, m, deterministic)
-}
-func (dst *WebFeatures) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_WebFeatures.Merge(dst, src)
-}
-func (m *WebFeatures) XXX_Size() int {
-	return xxx_messageInfo_WebFeatures.Size(m)
-}
-func (m *WebFeatures) XXX_DiscardUnknown() {
-	xxx_messageInfo_WebFeatures.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_WebFeatures proto.InternalMessageInfo
-
-func (m *WebFeatures) GetLabelsDisplay() WebFeatures_FLAG {
-	if m != nil && m.LabelsDisplay != nil {
-		return *m.LabelsDisplay
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetVoipIndividualOutgoing() WebFeatures_FLAG {
-	if m != nil && m.VoipIndividualOutgoing != nil {
-		return *m.VoipIndividualOutgoing
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetGroupsV3() WebFeatures_FLAG {
-	if m != nil && m.GroupsV3 != nil {
-		return *m.GroupsV3
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetGroupsV3Create() WebFeatures_FLAG {
-	if m != nil && m.GroupsV3Create != nil {
-		return *m.GroupsV3Create
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetChangeNumberV2() WebFeatures_FLAG {
-	if m != nil && m.ChangeNumberV2 != nil {
-		return *m.ChangeNumberV2
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetQueryStatusV3Thumbnail() WebFeatures_FLAG {
-	if m != nil && m.QueryStatusV3Thumbnail != nil {
-		return *m.QueryStatusV3Thumbnail
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetLiveLocations() WebFeatures_FLAG {
-	if m != nil && m.LiveLocations != nil {
-		return *m.LiveLocations
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetQueryVname() WebFeatures_FLAG {
-	if m != nil && m.QueryVname != nil {
-		return *m.QueryVname
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetVoipIndividualIncoming() WebFeatures_FLAG {
-	if m != nil && m.VoipIndividualIncoming != nil {
-		return *m.VoipIndividualIncoming
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func (m *WebFeatures) GetQuickRepliesQuery() WebFeatures_FLAG {
-	if m != nil && m.QuickRepliesQuery != nil {
-		return *m.QuickRepliesQuery
-	}
-	return WebFeatures_NOT_IMPLEMENTED
-}
-
-func init() {
-	proto.RegisterType((*FingerprintData)(nil), "proto.FingerprintData")
-	proto.RegisterType((*CombinedFingerprint)(nil), "proto.CombinedFingerprint")
-	proto.RegisterType((*MessageKey)(nil), "proto.MessageKey")
-	proto.RegisterType((*SenderKeyDistributionMessage)(nil), "proto.SenderKeyDistributionMessage")
-	proto.RegisterType((*ImageMessage)(nil), "proto.ImageMessage")
-	proto.RegisterType((*ContactMessage)(nil), "proto.ContactMessage")
-	proto.RegisterType((*LocationMessage)(nil), "proto.LocationMessage")
-	proto.RegisterType((*ExtendedTextMessage)(nil), "proto.ExtendedTextMessage")
-	proto.RegisterType((*DocumentMessage)(nil), "proto.DocumentMessage")
-	proto.RegisterType((*AudioMessage)(nil), "proto.AudioMessage")
-	proto.RegisterType((*VideoMessage)(nil), "proto.VideoMessage")
-	proto.RegisterType((*Call)(nil), "proto.Call")
-	proto.RegisterType((*Chat)(nil), "proto.Chat")
-	proto.RegisterType((*ProtocolMessage)(nil), "proto.ProtocolMessage")
-	proto.RegisterType((*ContactsArrayMessage)(nil), "proto.ContactsArrayMessage")
-	proto.RegisterType((*HSMCurrency)(nil), "proto.HSMCurrency")
-	proto.RegisterType((*HSMDateTimeComponent)(nil), "proto.HSMDateTimeComponent")
-	proto.RegisterType((*HSMDateTimeUnixEpoch)(nil), "proto.HSMDateTimeUnixEpoch")
-	proto.RegisterType((*HSMDateTime)(nil), "proto.HSMDateTime")
-	proto.RegisterType((*HSMLocalizableParameter)(nil), "proto.HSMLocalizableParameter")
-	proto.RegisterType((*HighlyStructuredMessage)(nil), "proto.HighlyStructuredMessage")
-	proto.RegisterType((*SendPaymentMessage)(nil), "proto.SendPaymentMessage")
-	proto.RegisterType((*RequestPaymentMessage)(nil), "proto.RequestPaymentMessage")
-	proto.RegisterType((*LiveLocationMessage)(nil), "proto.LiveLocationMessage")
-	proto.RegisterType((*StickerMessage)(nil), "proto.StickerMessage")
-	proto.RegisterType((*Message)(nil), "proto.Message")
-	proto.RegisterType((*ContextInfo)(nil), "proto.ContextInfo")
-	proto.RegisterType((*InteractiveAnnotation)(nil), "proto.InteractiveAnnotation")
-	proto.RegisterType((*Point)(nil), "proto.Point")
-	proto.RegisterType((*Location)(nil), "proto.Location")
-	proto.RegisterType((*WebMessageInfo)(nil), "proto.WebMessageInfo")
-	proto.RegisterType((*WebNotificationsInfo)(nil), "proto.WebNotificationsInfo")
-	proto.RegisterType((*NotificationMessageInfo)(nil), "proto.NotificationMessageInfo")
-	proto.RegisterType((*TabletNotificationsInfo)(nil), "proto.TabletNotificationsInfo")
-	proto.RegisterType((*WebFeatures)(nil), "proto.WebFeatures")
-	proto.RegisterEnum("proto.ExtendedTextMessage_FONTTYPE", ExtendedTextMessage_FONTTYPE_name, ExtendedTextMessage_FONTTYPE_value)
-	proto.RegisterEnum("proto.VideoMessage_ATTRIBUTION", VideoMessage_ATTRIBUTION_name, VideoMessage_ATTRIBUTION_value)
-	proto.RegisterEnum("proto.ProtocolMessage_TYPE", ProtocolMessage_TYPE_name, ProtocolMessage_TYPE_value)
-	proto.RegisterEnum("proto.HSMDateTimeComponent_DAYOFWEEKTYPE", HSMDateTimeComponent_DAYOFWEEKTYPE_name, HSMDateTimeComponent_DAYOFWEEKTYPE_value)
-	proto.RegisterEnum("proto.HSMDateTimeComponent_CALENDARTYPE", HSMDateTimeComponent_CALENDARTYPE_name, HSMDateTimeComponent_CALENDARTYPE_value)
-	proto.RegisterEnum("proto.WebMessageInfo_STATUS", WebMessageInfo_STATUS_name, WebMessageInfo_STATUS_value)
-	proto.RegisterEnum("proto.WebMessageInfo_STUBTYPE", WebMessageInfo_STUBTYPE_name, WebMessageInfo_STUBTYPE_value)
-	proto.RegisterEnum("proto.WebFeatures_FLAG", WebFeatures_FLAG_name, WebFeatures_FLAG_value)
-}
-
-func init() { proto.RegisterFile("def.proto", fileDescriptor_def_131d1935231ace52) }
-
-var fileDescriptor_def_131d1935231ace52 = []byte{
-	// 3724 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x3a, 0x4d, 0x6f, 0xe3, 0x48,
-	0x76, 0xad, 0x0f, 0xdb, 0xd2, 0x93, 0x2c, 0xd1, 0x65, 0xbb, 0xad, 0xe9, 0xf6, 0xce, 0x78, 0xd9,
-	0x9b, 0x59, 0xef, 0x04, 0xeb, 0xf4, 0x78, 0x3a, 0x33, 0xc1, 0x06, 0x83, 0x84, 0x96, 0x68, 0x9b,
-	0xdd, 0x32, 0xa9, 0x2d, 0x51, 0xf6, 0xf8, 0x24, 0x94, 0xc9, 0xb2, 0xc4, 0x34, 0x45, 0x6a, 0xc8,
-	0x92, 0xa7, 0xb5, 0x01, 0x72, 0xd9, 0x4b, 0x10, 0x20, 0xf7, 0x5c, 0x83, 0x20, 0xd7, 0x5c, 0x02,
-	0x04, 0x9b, 0x00, 0x49, 0x7e, 0x42, 0xfe, 0x46, 0x0e, 0xb9, 0xe4, 0x96, 0x4b, 0x90, 0xa0, 0x8a,
-	0xa4, 0x44, 0x4a, 0xb2, 0xbb, 0xa7, 0x93, 0xe9, 0xe4, 0x64, 0xd5, 0xfb, 0xaa, 0x57, 0xef, 0xd5,
-	0x7b, 0xf5, 0xde, 0xa3, 0xa1, 0x6c, 0xd3, 0xdb, 0xa3, 0x71, 0xe0, 0x33, 0x1f, 0xad, 0x89, 0x3f,
-	0xb2, 0x01, 0xf5, 0x53, 0xc7, 0x1b, 0xd0, 0x60, 0x1c, 0x38, 0x1e, 0x6b, 0x11, 0x46, 0xd0, 0x3e,
-	0x94, 0xc7, 0x93, 0x1b, 0xd7, 0xb1, 0x5e, 0xd1, 0x69, 0x23, 0x77, 0x90, 0x3b, 0x2c, 0xe3, 0x39,
-	0x00, 0x7d, 0x0c, 0xe0, 0xd8, 0xd4, 0x63, 0xce, 0xad, 0x43, 0x83, 0x46, 0x5e, 0xa0, 0x53, 0x10,
-	0xf9, 0xef, 0x73, 0xb0, 0xdd, 0xf4, 0x47, 0x37, 0x8e, 0x47, 0xed, 0x94, 0x64, 0xd4, 0x80, 0x8d,
-	0x3b, 0x1a, 0x84, 0x8e, 0xef, 0x09, 0x99, 0x9b, 0x38, 0x59, 0xa2, 0x13, 0x90, 0x5c, 0xdf, 0x22,
-	0x6e, 0x8a, 0x5a, 0xc8, 0xad, 0x1c, 0x3f, 0x8e, 0x74, 0x3d, 0x5a, 0xd0, 0x10, 0x2f, 0xd1, 0xa3,
-	0x16, 0x6c, 0x05, 0x74, 0xe4, 0x33, 0x9a, 0x16, 0x52, 0x78, 0x50, 0xc8, 0x32, 0x83, 0xcc, 0x00,
-	0x2e, 0x68, 0x18, 0x92, 0x01, 0xe5, 0x27, 0xdd, 0x87, 0x72, 0x44, 0xf2, 0xd2, 0xb1, 0x13, 0x3b,
-	0xcc, 0x00, 0xe8, 0x31, 0xac, 0xdf, 0x06, 0xfe, 0xe8, 0x82, 0x0a, 0x5d, 0x4b, 0x38, 0x5e, 0xa1,
-	0x1a, 0xe4, 0x1d, 0x5b, 0x6c, 0x5d, 0xc6, 0x79, 0xc7, 0x46, 0x07, 0x50, 0x19, 0x93, 0x80, 0x39,
-	0x96, 0x33, 0x26, 0x1e, 0x6b, 0x14, 0x05, 0x22, 0x0d, 0x92, 0xff, 0x2c, 0x07, 0xfb, 0x5d, 0xea,
-	0xd9, 0x34, 0x78, 0x45, 0xa7, 0x2d, 0x27, 0x64, 0x81, 0x73, 0x33, 0x61, 0x8e, 0xef, 0xc5, 0xba,
-	0x70, 0xd3, 0x0d, 0x02, 0x7f, 0x32, 0xd6, 0x12, 0x35, 0x92, 0x25, 0xea, 0xc0, 0x33, 0xf2, 0xc6,
-	0x77, 0x7d, 0xe6, 0x3e, 0x24, 0x40, 0x68, 0x58, 0xc5, 0xef, 0x42, 0x2a, 0xff, 0x4d, 0x11, 0xaa,
-	0xda, 0x88, 0x0c, 0x68, 0xb2, 0xb9, 0x04, 0x85, 0x49, 0xe0, 0xc6, 0x1b, 0xf3, 0x9f, 0xe8, 0x09,
-	0x94, 0x46, 0xce, 0x88, 0xb2, 0xe9, 0x98, 0xc6, 0xfe, 0x9f, 0xad, 0xb9, 0xaa, 0x16, 0x19, 0x73,
-	0x81, 0xb1, 0x09, 0x92, 0x25, 0xbf, 0x37, 0xb7, 0x8e, 0x4b, 0xbb, 0x43, 0x72, 0xfc, 0xbb, 0x5f,
-	0x0a, 0x33, 0x54, 0x71, 0x0a, 0x92, 0xe0, 0xdb, 0xd4, 0x1b, 0xb0, 0x61, 0x63, 0xed, 0x20, 0x77,
-	0x58, 0xc4, 0x29, 0x08, 0xb7, 0xf7, 0x90, 0x3a, 0x83, 0x21, 0x6b, 0xac, 0x8b, 0xeb, 0x13, 0xaf,
-	0xd0, 0x0e, 0xac, 0x7d, 0xe7, 0xd8, 0x6c, 0xd8, 0xd8, 0x10, 0xe0, 0x68, 0x21, 0x74, 0xa4, 0xb6,
-	0x43, 0xf8, 0x15, 0x2e, 0x89, 0xbd, 0x66, 0x6b, 0xf4, 0x13, 0xd8, 0xe4, 0x72, 0x55, 0xcf, 0x8a,
-	0x95, 0x29, 0x0b, 0x82, 0x2c, 0x10, 0x99, 0xf0, 0xd8, 0xf1, 0x18, 0x0d, 0x88, 0xc5, 0x9c, 0x3b,
-	0xaa, 0x78, 0x9e, 0xcf, 0x08, 0x3f, 0x48, 0xd8, 0x80, 0x83, 0xc2, 0x61, 0xe5, 0x78, 0x3f, 0xbe,
-	0x56, 0xda, 0x2a, 0x22, 0x7c, 0x0f, 0x2f, 0x3f, 0xa5, 0xed, 0x04, 0xd4, 0x62, 0x1d, 0xc2, 0x86,
-	0x8d, 0x4a, 0x14, 0x3d, 0x73, 0x08, 0xd7, 0xed, 0x8f, 0xc6, 0x74, 0x60, 0x0e, 0x27, 0xa3, 0x1b,
-	0x8f, 0x38, 0x6e, 0x43, 0x8a, 0x74, 0xcb, 0x00, 0xd1, 0x0b, 0xa8, 0x58, 0xbe, 0xc7, 0xe8, 0x1b,
-	0xa6, 0x79, 0xb7, 0x7e, 0x63, 0x4b, 0xdc, 0x73, 0x14, 0x2b, 0xd4, 0x9c, 0x63, 0x70, 0x9a, 0x0c,
-	0x7d, 0x06, 0xd2, 0xad, 0x13, 0x84, 0xac, 0x6b, 0x11, 0xaf, 0xeb, 0xd8, 0xd4, 0x22, 0x41, 0x03,
-	0x09, 0xf1, 0x4b, 0x70, 0x74, 0x08, 0xf5, 0x19, 0x2c, 0x76, 0xc9, 0xb6, 0xb0, 0xef, 0x22, 0x58,
-	0xfe, 0x13, 0xa8, 0xf1, 0x1d, 0x89, 0xc5, 0x92, 0x1b, 0x73, 0x00, 0x15, 0xdb, 0x09, 0xc7, 0x2e,
-	0x99, 0xea, 0x64, 0x44, 0xe3, 0x9b, 0x93, 0x06, 0x71, 0x9f, 0xdd, 0x59, 0x24, 0xb0, 0xc5, 0xe9,
-	0xca, 0x38, 0x5a, 0xbc, 0xdf, 0xa9, 0xe4, 0x5f, 0xe7, 0xa1, 0xde, 0xf6, 0x2d, 0x92, 0x0e, 0x98,
-	0x43, 0xa8, 0xdb, 0x74, 0x10, 0x50, 0x1a, 0xb6, 0x09, 0x73, 0xd8, 0xc4, 0x8e, 0xb4, 0xc8, 0xe1,
-	0x45, 0x30, 0xb7, 0x49, 0x02, 0xf2, 0xbd, 0x41, 0x44, 0x9a, 0x17, 0xa4, 0x4b, 0x70, 0x84, 0xa0,
-	0xe8, 0xf1, 0x03, 0x45, 0x17, 0x5b, 0xfc, 0xe6, 0xf7, 0x9d, 0xd8, 0x76, 0x40, 0xc3, 0x30, 0x8e,
-	0xec, 0x64, 0x99, 0xc4, 0xcd, 0xda, 0x3c, 0x6e, 0x7e, 0x40, 0xdf, 0xca, 0xff, 0x51, 0x80, 0x6d,
-	0xf5, 0x0d, 0xe3, 0x91, 0x6d, 0x9b, 0xf4, 0xcd, 0xcc, 0x17, 0x08, 0x8a, 0x9c, 0x26, 0x76, 0x82,
-	0xf8, 0xcd, 0xfd, 0x33, 0x22, 0xcc, 0x1a, 0x46, 0x94, 0x71, 0x08, 0xa7, 0x41, 0x48, 0x86, 0xaa,
-	0x45, 0x3c, 0xdf, 0x73, 0x2c, 0xe2, 0xf6, 0x02, 0x37, 0x3e, 0x5a, 0x06, 0x26, 0xbc, 0x4c, 0x43,
-	0x2b, 0x70, 0xa2, 0x68, 0x5f, 0x8b, 0xbd, 0x3c, 0x07, 0x71, 0x2f, 0x33, 0x87, 0xb9, 0x54, 0x04,
-	0x6c, 0x19, 0x47, 0x0b, 0x1e, 0x99, 0x5c, 0x0b, 0x25, 0x18, 0xdc, 0x88, 0x90, 0xdd, 0xc0, 0xb3,
-	0x35, 0xfa, 0x14, 0x6a, 0x37, 0xc4, 0x7a, 0xcd, 0xb3, 0x9b, 0x67, 0x0b, 0x8a, 0x92, 0xa0, 0x58,
-	0x80, 0xa2, 0xaf, 0xa0, 0x78, 0xeb, 0x7b, 0x4c, 0x04, 0x6e, 0xed, 0xf8, 0x59, 0x6c, 0x9c, 0x15,
-	0xe7, 0x3f, 0x3a, 0x35, 0x74, 0xd3, 0xbc, 0xee, 0xa8, 0x58, 0x30, 0xfc, 0xa0, 0x2e, 0xb8, 0x83,
-	0x52, 0xb2, 0x1b, 0xaa, 0x01, 0x74, 0x15, 0xbd, 0xdb, 0xef, 0xaa, 0x58, 0x3b, 0x95, 0x1e, 0xa1,
-	0x32, 0xac, 0x45, 0x3f, 0x73, 0x68, 0x1b, 0xea, 0xba, 0x81, 0xb5, 0xa6, 0xa2, 0xf7, 0xb1, 0x7a,
-	0xd6, 0x6b, 0x2b, 0x58, 0xca, 0xa3, 0x2d, 0xd8, 0x3c, 0xc1, 0xd7, 0x7a, 0x4b, 0xd1, 0xfb, 0x57,
-	0x58, 0x33, 0x55, 0xa9, 0x80, 0x76, 0x61, 0xeb, 0x44, 0x3d, 0x51, 0xba, 0xba, 0xda, 0x53, 0x67,
-	0x94, 0x45, 0x24, 0x41, 0xd5, 0xe8, 0x5e, 0x29, 0xed, 0x56, 0xff, 0x5c, 0x55, 0x2e, 0xaf, 0xa5,
-	0x35, 0xf9, 0xcf, 0x0b, 0x50, 0x6f, 0xf9, 0xd6, 0x64, 0x44, 0x3d, 0xf6, 0x7e, 0x49, 0x7b, 0xe6,
-	0xa8, 0x42, 0xda, 0x51, 0xff, 0xd3, 0x84, 0xcd, 0xcb, 0x08, 0x32, 0xa0, 0x4d, 0x7f, 0xe2, 0x25,
-	0x39, 0x7b, 0x0e, 0xc8, 0x24, 0xe8, 0x8d, 0x85, 0x04, 0xfd, 0x04, 0x4a, 0x5c, 0x8e, 0xc8, 0x1e,
-	0xa5, 0x48, 0xd7, 0x64, 0xfd, 0x8e, 0xc9, 0x3b, 0x9b, 0x66, 0xe1, 0x43, 0xa6, 0x59, 0xf9, 0xdf,
-	0xf2, 0x50, 0x55, 0x26, 0xb6, 0xe3, 0xbf, 0x9f, 0x33, 0xb2, 0x66, 0x2f, 0xbc, 0xc5, 0xec, 0xc5,
-	0x25, 0xb3, 0x37, 0x60, 0x23, 0xa4, 0x96, 0xef, 0xd9, 0xa1, 0xf0, 0xc9, 0x26, 0x4e, 0x96, 0x5c,
-	0x8f, 0x31, 0x8b, 0x5c, 0x51, 0xc2, 0xfc, 0xe7, 0x83, 0x4e, 0x58, 0x32, 0x74, 0xe9, 0xed, 0x86,
-	0x2e, 0x2f, 0x19, 0xfa, 0xbd, 0x5f, 0xaa, 0x90, 0x05, 0x94, 0x8c, 0x1c, 0x6f, 0xb0, 0xf0, 0x52,
-	0x2d, 0xc2, 0xe5, 0xdf, 0xac, 0x41, 0xf5, 0xd2, 0xb1, 0xe9, 0xff, 0x3b, 0x73, 0xa7, 0x8d, 0xbb,
-	0xbe, 0x60, 0xdc, 0x54, 0x99, 0xb4, 0x91, 0x2d, 0x93, 0x0e, 0xa0, 0x32, 0x70, 0x6e, 0x3b, 0x2e,
-	0x99, 0xf2, 0x9c, 0x27, 0x8c, 0x5e, 0xc2, 0x69, 0x50, 0xaa, 0x10, 0x2a, 0xaf, 0x2e, 0x84, 0x20,
-	0x5d, 0x08, 0x2d, 0xb9, 0xb1, 0xf2, 0xfd, 0x8a, 0x9d, 0xea, 0xff, 0x5a, 0xb1, 0xb3, 0xf9, 0xa1,
-	0x8b, 0x9d, 0x77, 0xbd, 0x42, 0xe8, 0x0c, 0x6a, 0x03, 0xe7, 0x56, 0x61, 0xb3, 0x62, 0x58, 0xd4,
-	0x3a, 0xb5, 0xe3, 0x4f, 0xe2, 0x4d, 0xd2, 0xd7, 0xeb, 0x48, 0x31, 0x4d, 0xac, 0x9d, 0xf4, 0x4c,
-	0xcd, 0xd0, 0xf1, 0x02, 0x9b, 0xfc, 0x73, 0xa8, 0xa4, 0xd0, 0xa8, 0x04, 0x45, 0xdd, 0xd0, 0xd5,
-	0x28, 0xff, 0x9f, 0x69, 0x9d, 0xf3, 0x6b, 0x29, 0xc7, 0x7f, 0x9a, 0xaa, 0x6e, 0x60, 0x29, 0x2f,
-	0x1f, 0x40, 0xb1, 0x49, 0x5c, 0x37, 0xba, 0x0d, 0xae, 0x9b, 0xb4, 0x5b, 0x55, 0x9c, 0x2c, 0xe5,
-	0xdf, 0x83, 0x62, 0x73, 0x48, 0xd8, 0x3b, 0x94, 0x54, 0x51, 0xdb, 0x91, 0x4f, 0xda, 0x0e, 0xf9,
-	0x8f, 0xa1, 0xde, 0xe1, 0xca, 0x5b, 0xbe, 0x9b, 0x04, 0xc6, 0x33, 0x28, 0xbc, 0x8e, 0xb7, 0xa8,
-	0x1c, 0x6f, 0xc5, 0x67, 0x9b, 0xf7, 0x3b, 0x98, 0x63, 0xd1, 0xef, 0x40, 0x71, 0x16, 0x27, 0xb5,
-	0xe3, 0xa7, 0x31, 0xd5, 0x82, 0xa8, 0xa3, 0xe8, 0x49, 0xe5, 0x84, 0x32, 0x82, 0xa2, 0x78, 0xf2,
-	0x00, 0xd6, 0xb1, 0x7a, 0x69, 0xbc, 0x52, 0xa5, 0x47, 0xf2, 0x5f, 0xe6, 0x60, 0x27, 0x2e, 0x0a,
-	0x43, 0x25, 0x08, 0xc8, 0xf4, 0xdd, 0x4b, 0xc3, 0xcf, 0xa1, 0x64, 0xc5, 0x9c, 0x8d, 0xbc, 0xb8,
-	0x7b, 0xbb, 0x29, 0x57, 0xcf, 0xab, 0x4c, 0x3c, 0x23, 0x7b, 0xcf, 0x34, 0xfd, 0x4b, 0xa8, 0x9c,
-	0x77, 0x2f, 0x9a, 0x93, 0x20, 0xa0, 0x9e, 0x35, 0x15, 0x25, 0x4f, 0xfc, 0xbb, 0xe9, 0xdb, 0x89,
-	0x6a, 0x19, 0x18, 0xbf, 0xcf, 0x64, 0xc4, 0x5f, 0xaf, 0xcf, 0x9f, 0x3f, 0x7f, 0x2e, 0x2c, 0x54,
-	0xc0, 0x29, 0x88, 0xfc, 0x9b, 0x02, 0xec, 0x9c, 0x77, 0x2f, 0x5a, 0x84, 0x51, 0xd3, 0x19, 0xd1,
-	0xa6, 0x3f, 0x1a, 0xfb, 0x1e, 0xf5, 0x18, 0x3a, 0x83, 0xb2, 0x4d, 0xa6, 0xc6, 0xed, 0x15, 0xa5,
-	0xaf, 0x85, 0xe4, 0xda, 0xf1, 0xcf, 0x62, 0xfd, 0x56, 0xd1, 0x1f, 0xb5, 0x94, 0x6b, 0xe3, 0xf4,
-	0x4a, 0x55, 0x5f, 0x09, 0x3b, 0xcf, 0x79, 0x79, 0x39, 0x37, 0xa5, 0x24, 0x6a, 0xbb, 0x37, 0xb1,
-	0xf8, 0xcd, 0xe3, 0x7e, 0xe4, 0x7b, 0x6c, 0x28, 0x92, 0xd7, 0x26, 0x8e, 0x16, 0x22, 0xf6, 0x38,
-	0xdb, 0x85, 0x40, 0x15, 0x05, 0x2a, 0x05, 0xe1, 0x92, 0x86, 0xfe, 0x24, 0x88, 0x93, 0x96, 0xf8,
-	0xcd, 0x33, 0xcb, 0xc8, 0xf1, 0x26, 0x8c, 0x26, 0x2d, 0x56, 0xb4, 0x42, 0x2d, 0x28, 0x59, 0xc4,
-	0xa5, 0x9e, 0x4d, 0x02, 0x91, 0xae, 0x6a, 0xc7, 0x87, 0x0f, 0x69, 0xdf, 0x54, 0xda, 0xaa, 0xde,
-	0x52, 0xb0, 0x50, 0x7e, 0xc6, 0x29, 0xbf, 0x86, 0xcd, 0xcc, 0xb9, 0xf8, 0x8d, 0xb9, 0x30, 0xf4,
-	0x96, 0xc2, 0xa3, 0xa2, 0x02, 0x1b, 0x66, 0x4f, 0xed, 0xf2, 0x45, 0x1e, 0x6d, 0x42, 0xf9, 0x4a,
-	0x6d, 0xe9, 0xd1, 0xb2, 0x80, 0xaa, 0x50, 0x32, 0xcf, 0x7b, 0x58, 0xac, 0x8a, 0x9c, 0xeb, 0x14,
-	0x6b, 0xfc, 0xf7, 0x1a, 0xc7, 0x74, 0x15, 0xb3, 0x87, 0xf9, 0x6a, 0x9d, 0x63, 0xba, 0x3d, 0x21,
-	0x6f, 0x43, 0x3e, 0x82, 0x6a, 0x5a, 0x0d, 0x2e, 0xf2, 0x0c, 0xab, 0x67, 0x06, 0xd6, 0x14, 0x5d,
-	0xca, 0xa1, 0x3a, 0x54, 0xba, 0x46, 0x5b, 0xc1, 0xfd, 0x73, 0xed, 0x25, 0xd6, 0xa4, 0xbc, 0xfc,
-	0x22, 0xe3, 0xb9, 0x9e, 0xe7, 0xbc, 0x51, 0xc7, 0xbe, 0x25, 0x8a, 0x18, 0xe6, 0x8c, 0x68, 0xc8,
-	0xc8, 0x68, 0x2c, 0x3c, 0x57, 0xc0, 0x73, 0x80, 0xfc, 0x17, 0x39, 0x71, 0x89, 0x12, 0x36, 0xf4,
-	0xfb, 0x50, 0xb6, 0x12, 0x33, 0xc4, 0x71, 0xf6, 0xf4, 0x01, 0x4b, 0x9d, 0x3f, 0xc2, 0x73, 0x7a,
-	0xce, 0x3c, 0x49, 0xf6, 0x8d, 0xe7, 0x1f, 0x2b, 0x98, 0x67, 0xaa, 0x71, 0xe6, 0x19, 0xfd, 0x49,
-	0x1d, 0x36, 0x6d, 0xc2, 0x28, 0x57, 0xcd, 0xf0, 0xa8, 0x7f, 0x2b, 0xff, 0x75, 0x0e, 0xf6, 0xce,
-	0xbb, 0x17, 0xbc, 0x33, 0x72, 0x9d, 0x5f, 0x91, 0x1b, 0x97, 0x76, 0x48, 0x40, 0x46, 0x94, 0xd1,
-	0x80, 0xe7, 0x1b, 0x9b, 0xde, 0x92, 0x89, 0x9b, 0xf4, 0x05, 0xc9, 0x12, 0x3d, 0x87, 0x52, 0x72,
-	0xe3, 0x63, 0x15, 0xd0, 0x5c, 0x85, 0x24, 0x56, 0xce, 0x1f, 0xe1, 0x19, 0x15, 0xe7, 0xb0, 0x63,
-	0xd5, 0xe2, 0x79, 0x0b, 0x5a, 0x56, 0x9a, 0x73, 0x24, 0x54, 0x27, 0x55, 0x80, 0x31, 0x57, 0x25,
-	0xd2, 0xf3, 0xbf, 0xb8, 0x9e, 0xce, 0x60, 0xe8, 0x4e, 0xbb, 0x2c, 0x98, 0x58, 0x6c, 0x12, 0x50,
-	0x3b, 0xc9, 0x16, 0xfb, 0x50, 0xe6, 0x4d, 0x56, 0x38, 0x26, 0x56, 0x12, 0x90, 0x73, 0x00, 0xcf,
-	0x25, 0xd4, 0xa5, 0xbc, 0xea, 0x15, 0xb9, 0x24, 0x6e, 0x63, 0x52, 0x20, 0x7e, 0x9f, 0xc5, 0x4e,
-	0x61, 0xa3, 0x70, 0x50, 0x38, 0x2c, 0xe3, 0x78, 0x25, 0xde, 0x74, 0xe2, 0xba, 0xfc, 0x35, 0x6d,
-	0x0f, 0xe2, 0xe6, 0x26, 0x05, 0xc9, 0xe0, 0xad, 0xb8, 0xb3, 0x49, 0x41, 0x50, 0x1b, 0xb6, 0xdc,
-	0x05, 0xbb, 0x86, 0x8d, 0x75, 0x91, 0xac, 0x3e, 0x9e, 0x1f, 0x7e, 0x95, 0xe9, 0xf1, 0x32, 0xa3,
-	0x7c, 0x0a, 0xa8, 0x4b, 0x3d, 0xbb, 0x43, 0xa6, 0xe9, 0x0a, 0xfe, 0x39, 0x54, 0x3c, 0x9f, 0xd1,
-	0xf4, 0x04, 0xa7, 0x72, 0x5c, 0xcb, 0x26, 0x6d, 0x9c, 0x26, 0x91, 0xff, 0x31, 0x07, 0xbb, 0x98,
-	0x7e, 0x3b, 0xa1, 0x21, 0x5b, 0x92, 0xb5, 0x9d, 0xce, 0x63, 0x5a, 0xe8, 0xbf, 0x38, 0xfe, 0xfc,
-	0xab, 0xd8, 0xa2, 0xab, 0x50, 0x2b, 0x32, 0x5d, 0x31, 0x9d, 0xe9, 0xb8, 0xed, 0x83, 0x68, 0xab,
-	0xd3, 0xc0, 0x1f, 0xc5, 0x7d, 0x43, 0x1a, 0xb4, 0xa8, 0x7f, 0xf1, 0xed, 0xfa, 0xff, 0x55, 0x01,
-	0xb6, 0xdb, 0xce, 0x1d, 0xfd, 0x30, 0xcd, 0xfc, 0x67, 0x20, 0x11, 0xcb, 0x9a, 0x04, 0xc4, 0x9a,
-	0x6a, 0xde, 0x05, 0xf7, 0x4d, 0x18, 0x27, 0xd0, 0x25, 0x38, 0xb7, 0x46, 0x38, 0xa6, 0xd4, 0xd6,
-	0xbc, 0x8b, 0x71, 0xd4, 0xe7, 0xe7, 0x71, 0x0a, 0x82, 0xda, 0xf0, 0xe3, 0x58, 0x7e, 0xd3, 0xf5,
-	0xad, 0xd7, 0xdf, 0x39, 0x21, 0xe5, 0x36, 0xb8, 0x20, 0x03, 0x8f, 0x32, 0xc7, 0xd2, 0xfd, 0x20,
-	0x6e, 0x90, 0x36, 0xf1, 0xdb, 0x09, 0xd3, 0xb5, 0xe1, 0x7a, 0xb6, 0x36, 0xfc, 0x14, 0x6a, 0x21,
-	0x37, 0xb1, 0x67, 0x51, 0x7d, 0x32, 0xba, 0xa1, 0x51, 0x36, 0x2e, 0xe0, 0x05, 0xe8, 0x0f, 0xda,
-	0xdd, 0xfc, 0x6b, 0x1e, 0x6a, 0x5d, 0xe6, 0x58, 0xaf, 0x69, 0x70, 0x7f, 0xc1, 0x9d, 0x2d, 0xaa,
-	0xf3, 0x4b, 0x45, 0xf5, 0x52, 0x51, 0x5a, 0x58, 0x55, 0x94, 0xa6, 0x0b, 0xe8, 0xe2, 0x72, 0x8b,
-	0x38, 0x2b, 0xe9, 0xd7, 0x16, 0x4a, 0xfa, 0xef, 0x37, 0x29, 0xcc, 0x16, 0xa9, 0xa5, 0xa5, 0x22,
-	0x35, 0xdb, 0x00, 0x94, 0x97, 0x1a, 0x00, 0x19, 0xaa, 0x63, 0x6f, 0xc9, 0xd6, 0x19, 0xd8, 0x7b,
-	0x9a, 0xfa, 0x6f, 0x01, 0x36, 0x12, 0x1b, 0xf3, 0xf2, 0xc4, 0xf7, 0xee, 0x68, 0x10, 0x8a, 0xd8,
-	0x98, 0x95, 0x27, 0x29, 0x18, 0x1a, 0xc0, 0x7e, 0xf8, 0xb6, 0x29, 0x70, 0x65, 0x36, 0x2d, 0x79,
-	0x68, 0x0a, 0x8c, 0x1f, 0x14, 0x84, 0xbe, 0x82, 0xaa, 0x93, 0x1a, 0x11, 0xc7, 0x79, 0x7f, 0x3b,
-	0xe9, 0x11, 0x52, 0x28, 0x9c, 0x21, 0x44, 0x5f, 0x43, 0xcd, 0xca, 0x54, 0x71, 0x71, 0x5e, 0xb8,
-	0xa7, 0xc4, 0x5b, 0x20, 0x46, 0x7f, 0x08, 0x75, 0x37, 0x9b, 0x1c, 0x84, 0xef, 0xe7, 0x23, 0xfe,
-	0x85, 0xd4, 0x81, 0x17, 0xc9, 0x51, 0x1b, 0xb6, 0xe9, 0xf2, 0x94, 0x48, 0xdc, 0x93, 0xca, 0xf1,
-	0x93, 0xfb, 0xe7, 0x48, 0x78, 0x15, 0x1b, 0xd7, 0xc7, 0xce, 0x0e, 0x5e, 0xc4, 0xd5, 0x9a, 0xeb,
-	0xb3, 0x30, 0x96, 0xc1, 0x8b, 0xe4, 0xdc, 0x92, 0x24, 0x35, 0x2a, 0x10, 0xd7, 0x6f, 0x6e, 0xc9,
-	0xf4, 0x14, 0x01, 0x67, 0x08, 0x39, 0xe3, 0x5d, 0xaa, 0x2b, 0x11, 0xf7, 0x72, 0xce, 0x98, 0x6e,
-	0x58, 0x70, 0x86, 0x10, 0x7d, 0x02, 0x45, 0xde, 0x5c, 0x88, 0x26, 0xb1, 0x72, 0x5c, 0x49, 0x0c,
-	0x4f, 0x5c, 0x17, 0x0b, 0x84, 0x20, 0x18, 0x12, 0x26, 0xfa, 0xc4, 0x14, 0xc1, 0x90, 0x30, 0x2c,
-	0x10, 0xfc, 0xd4, 0xe3, 0x6c, 0x3b, 0xd0, 0xa8, 0x66, 0x4e, 0xbd, 0xd0, 0x2c, 0xe0, 0x45, 0x72,
-	0x64, 0xc0, 0x8e, 0xb5, 0xa2, 0x3b, 0x10, 0x1d, 0xe2, 0xbc, 0xe8, 0x59, 0xd5, 0x40, 0xe0, 0x95,
-	0x8c, 0xe8, 0x1b, 0xd8, 0x1b, 0xae, 0xae, 0x21, 0x1a, 0x35, 0x21, 0x73, 0xf6, 0x2c, 0xaf, 0xa6,
-	0xc2, 0xf7, 0xb1, 0xa3, 0x5f, 0xe7, 0xe0, 0xb3, 0x5b, 0x12, 0x32, 0x2c, 0xa6, 0xa3, 0xec, 0x15,
-	0x9d, 0x3e, 0xf8, 0xa1, 0xa5, 0xfe, 0xee, 0x21, 0xf6, 0x3d, 0xc4, 0x22, 0x0d, 0x50, 0xb8, 0x54,
-	0x22, 0x88, 0x4c, 0x53, 0x39, 0xfe, 0x28, 0xb5, 0x59, 0x96, 0x00, 0xaf, 0x60, 0x42, 0x18, 0x76,
-	0x83, 0x55, 0x45, 0x42, 0x9c, 0x94, 0x92, 0x46, 0x7f, 0x65, 0x21, 0x81, 0x57, 0xb3, 0xf2, 0xa8,
-	0x72, 0x97, 0x1f, 0x6e, 0xd1, 0x6e, 0xcf, 0xa3, 0x6a, 0xc5, 0xd3, 0x8e, 0x57, 0xb1, 0xf1, 0x24,
-	0x11, 0x66, 0x1e, 0x98, 0xc6, 0x4e, 0x26, 0x49, 0x64, 0x5f, 0x1f, 0xbc, 0x40, 0x2c, 0xff, 0x67,
-	0x1e, 0x2a, 0xa9, 0x94, 0xca, 0x5f, 0x8a, 0x90, 0x11, 0xef, 0x57, 0x64, 0xf6, 0xf5, 0x6c, 0xb6,
-	0x5e, 0xfc, 0x36, 0x97, 0x5f, 0xfa, 0x36, 0x87, 0x5e, 0xc0, 0xe6, 0xb7, 0x13, 0x9f, 0xcd, 0xef,
-	0x53, 0x41, 0x94, 0x79, 0x8b, 0x85, 0x4c, 0x96, 0x28, 0xfb, 0xe5, 0xb0, 0xb8, 0xf8, 0xe5, 0x50,
-	0x86, 0x2a, 0xb7, 0x9e, 0xe3, 0x7b, 0xd4, 0xe6, 0x04, 0x75, 0x51, 0x9c, 0x66, 0x60, 0xbc, 0x3c,
-	0x89, 0x73, 0xbb, 0xe3, 0x7b, 0x5d, 0x7f, 0x12, 0x58, 0x91, 0x3d, 0xcb, 0x78, 0x09, 0xce, 0xcb,
-	0x82, 0x39, 0xac, 0x45, 0x18, 0x11, 0xe3, 0x8b, 0x2a, 0x5e, 0x80, 0xa2, 0x2f, 0xe1, 0x71, 0x0a,
-	0x42, 0x5d, 0x32, 0xed, 0xc6, 0x93, 0xab, 0x1d, 0xf1, 0x20, 0xde, 0x83, 0xe5, 0x56, 0x72, 0xc2,
-	0x53, 0x3f, 0xf8, 0x8e, 0x04, 0x36, 0xb5, 0x1b, 0x8f, 0xa3, 0x91, 0x54, 0x0a, 0xf4, 0xb2, 0x58,
-	0x92, 0xa4, 0xad, 0x97, 0xc5, 0xd2, 0x96, 0x84, 0xe4, 0x3f, 0xcd, 0xc1, 0xee, 0xca, 0x31, 0x11,
-	0xfa, 0x12, 0xea, 0x63, 0xdf, 0x9d, 0x0e, 0x7c, 0xef, 0x92, 0x72, 0x0b, 0xd3, 0xb0, 0x91, 0x13,
-	0xd6, 0xac, 0x26, 0x89, 0xc3, 0x77, 0x3c, 0x86, 0x17, 0x89, 0xd0, 0xcf, 0xa1, 0x94, 0xe4, 0xf1,
-	0xf8, 0x0d, 0xab, 0x2f, 0xe4, 0x7b, 0xde, 0x5f, 0x24, 0x24, 0x27, 0x25, 0x58, 0xe7, 0x5b, 0xfb,
-	0x9e, 0xfc, 0x0c, 0xd6, 0x84, 0x48, 0x54, 0x85, 0xdc, 0x1b, 0xf1, 0x4a, 0xe5, 0x70, 0xee, 0x0d,
-	0x5f, 0x45, 0x05, 0x45, 0x0e, 0xe7, 0xa6, 0x32, 0x83, 0x52, 0x22, 0xe6, 0xc3, 0x7d, 0x37, 0x92,
-	0xff, 0xa5, 0x0e, 0xb5, 0x2b, 0x7a, 0x13, 0x5f, 0x18, 0x71, 0x51, 0x67, 0xe3, 0x99, 0xfc, 0x03,
-	0xe3, 0x99, 0x43, 0xd8, 0x18, 0x3d, 0xd8, 0x12, 0x24, 0x68, 0xae, 0x61, 0xfc, 0xd3, 0x9c, 0x35,
-	0xb0, 0x05, 0x51, 0xbd, 0x2c, 0xc1, 0xd1, 0xd7, 0xb0, 0x1e, 0x32, 0xc2, 0x26, 0x51, 0x71, 0x5b,
-	0x9b, 0x65, 0x81, 0xac, 0x86, 0x47, 0x5d, 0x53, 0x31, 0x7b, 0xdd, 0x5f, 0x6c, 0x74, 0x54, 0xbd,
-	0xa5, 0xe9, 0x67, 0x38, 0x66, 0x5a, 0x0c, 0xa3, 0xb5, 0xe5, 0x30, 0x7a, 0x0c, 0xeb, 0xce, 0xc0,
-	0xf3, 0x83, 0x28, 0x69, 0x95, 0x70, 0xbc, 0x12, 0xd3, 0x53, 0x46, 0x82, 0x80, 0xda, 0x22, 0xff,
-	0x94, 0x70, 0xb2, 0xe4, 0x21, 0x74, 0x13, 0xf8, 0xc4, 0xb6, 0x48, 0xc8, 0xc4, 0xcd, 0x2f, 0xe1,
-	0x39, 0x80, 0x07, 0xf5, 0x78, 0x12, 0x0e, 0x45, 0xe3, 0xb7, 0x1d, 0x05, 0x75, 0xb2, 0x46, 0x2f,
-	0x60, 0x57, 0x94, 0x89, 0x4d, 0x67, 0x3c, 0xa4, 0x01, 0xcf, 0x03, 0x71, 0x91, 0xb9, 0x23, 0xa2,
-	0x62, 0x35, 0x92, 0xef, 0x37, 0x9a, 0xb8, 0xcc, 0x11, 0xfb, 0xed, 0x46, 0xfb, 0xcd, 0x00, 0x5c,
-	0xcf, 0x49, 0xe0, 0x8a, 0xcf, 0x65, 0xd1, 0xf5, 0x4f, 0x96, 0x9c, 0x6f, 0x12, 0xb8, 0x71, 0x39,
-	0xbe, 0x17, 0xf1, 0xcd, 0x00, 0xe8, 0x1c, 0xea, 0xb1, 0xb1, 0xbb, 0x6c, 0x72, 0x63, 0xf2, 0x6a,
-	0xb5, 0x21, 0x2c, 0xfc, 0xf1, 0x7d, 0x16, 0xee, 0x9d, 0x88, 0xb1, 0xc9, 0x22, 0x1b, 0x2f, 0x43,
-	0x2d, 0x97, 0x92, 0xe0, 0x82, 0x6b, 0xdf, 0xf8, 0x48, 0x6c, 0x94, 0x82, 0x44, 0xa7, 0x9e, 0xb1,
-	0xcc, 0x1a, 0xce, 0xb0, 0xf1, 0x44, 0x64, 0x97, 0xd5, 0x48, 0x6e, 0x47, 0x7b, 0x12, 0x44, 0xa1,
-	0xf5, 0x54, 0x24, 0x81, 0xd9, 0x9a, 0xfb, 0xcc, 0x25, 0x37, 0xd4, 0x0d, 0x1b, 0xfb, 0x51, 0xf7,
-	0x1c, 0xad, 0xe4, 0x6f, 0x60, 0x3d, 0xba, 0x08, 0xa8, 0x0c, 0x6b, 0x2a, 0xc6, 0x06, 0x96, 0x1e,
-	0xa1, 0x0a, 0x24, 0xb7, 0x42, 0xca, 0x89, 0xaf, 0x5f, 0x2a, 0xbe, 0x54, 0x71, 0x5f, 0x69, 0xbe,
-	0x92, 0xf2, 0x48, 0x82, 0x6a, 0x4b, 0x6d, 0x6b, 0x97, 0x2a, 0xbe, 0x16, 0x90, 0x02, 0x2a, 0x41,
-	0x11, 0xab, 0x4a, 0x2b, 0x1a, 0xe7, 0x74, 0xda, 0xca, 0xb5, 0xda, 0x92, 0xd6, 0xe4, 0x7f, 0x28,
-	0x43, 0x29, 0xb1, 0x00, 0x97, 0xd8, 0xd3, 0x5f, 0xe9, 0xc6, 0x95, 0x2e, 0x3d, 0x4a, 0x0d, 0x17,
-	0x85, 0xf4, 0xa6, 0xd6, 0x39, 0x57, 0xb1, 0xa9, 0x7e, 0x63, 0x4a, 0x79, 0x54, 0x87, 0xca, 0x69,
-	0xcf, 0xec, 0x61, 0xb5, 0x83, 0x0d, 0xe3, 0x54, 0x2a, 0xa0, 0xa7, 0xb0, 0xa7, 0x1b, 0x7a, 0xff,
-	0x52, 0xc5, 0xda, 0xa9, 0xa6, 0xb6, 0xfa, 0x26, 0x56, 0xf4, 0xae, 0x66, 0x6a, 0x86, 0x2e, 0x15,
-	0xd1, 0x47, 0xb0, 0xdb, 0xd3, 0x57, 0xa1, 0xd6, 0xd0, 0x1e, 0x6c, 0xaf, 0x42, 0xac, 0xa3, 0x06,
-	0xec, 0xcc, 0x10, 0x6d, 0xe3, 0xaa, 0x9f, 0xe8, 0xb5, 0x81, 0xb6, 0x60, 0x73, 0x86, 0x39, 0xd7,
-	0xce, 0xce, 0xa5, 0x12, 0xda, 0x87, 0xc6, 0x0c, 0xa4, 0xe9, 0x9a, 0xa9, 0x29, 0xed, 0x19, 0x43,
-	0x39, 0x23, 0x2a, 0xc1, 0xb6, 0x8d, 0x2b, 0x09, 0xb8, 0x62, 0x4b, 0x18, 0x21, 0xb2, 0x82, 0x9e,
-	0xc1, 0x27, 0x2b, 0x14, 0xeb, 0x2b, 0xfa, 0x75, 0xdf, 0x34, 0xfa, 0x62, 0xc4, 0x5c, 0x7d, 0x0b,
-	0x91, 0x90, 0xb4, 0x79, 0x1f, 0x11, 0xc7, 0x72, 0x2a, 0xae, 0x49, 0x0d, 0xfd, 0x14, 0x9e, 0x3d,
-	0x44, 0x94, 0x1c, 0xa6, 0x8e, 0x3e, 0x05, 0x79, 0x15, 0x61, 0x4c, 0x90, 0x08, 0x94, 0xee, 0xa3,
-	0xe3, 0xa6, 0x4c, 0xc9, 0xdb, 0xba, 0x4f, 0x3b, 0x7e, 0xc0, 0x44, 0x18, 0xba, 0x4f, 0xbb, 0x84,
-	0x28, 0x91, 0xb6, 0xcd, 0x6f, 0xdd, 0x19, 0x36, 0x7a, 0x9d, 0x7e, 0x13, 0xab, 0x8a, 0xa9, 0x4a,
-	0x3b, 0xdc, 0xf8, 0x31, 0xe4, 0x5c, 0xd1, 0xcf, 0xd4, 0x7e, 0xb7, 0x77, 0xf2, 0x52, 0x6d, 0x9a,
-	0xd2, 0x2e, 0xda, 0x85, 0xad, 0x0c, 0x46, 0x6b, 0x1a, 0xba, 0xf4, 0x98, 0xfb, 0x32, 0x0b, 0xd6,
-	0x2f, 0x35, 0x53, 0xed, 0xb7, 0x35, 0xfd, 0x95, 0xb4, 0xb7, 0x84, 0x6d, 0xa9, 0xdd, 0x26, 0xd6,
-	0x3a, 0xe2, 0xd2, 0x34, 0xb8, 0x3f, 0x33, 0x58, 0xac, 0x76, 0x4d, 0xac, 0x35, 0x4d, 0xe9, 0xa3,
-	0x25, 0x94, 0xa2, 0xeb, 0x46, 0x4f, 0x6f, 0xaa, 0xd2, 0x93, 0x39, 0xaa, 0xa3, 0x60, 0x53, 0x6b,
-	0x6a, 0x1d, 0x45, 0x37, 0xfb, 0x4a, 0xab, 0x25, 0x3d, 0x9d, 0x6f, 0x97, 0x46, 0x61, 0xf5, 0xc2,
-	0xb8, 0x54, 0xa5, 0x7d, 0xf4, 0x23, 0xf8, 0x68, 0x19, 0xdb, 0xc1, 0xc6, 0x85, 0x61, 0xaa, 0xd2,
-	0x8f, 0x56, 0x33, 0xb7, 0x54, 0x81, 0xfd, 0x78, 0x35, 0x36, 0x3a, 0xac, 0xf4, 0x09, 0x8f, 0xa7,
-	0x65, 0x6c, 0x5b, 0x55, 0x2e, 0x55, 0xe9, 0x80, 0xfb, 0x6c, 0x19, 0x19, 0x9f, 0x4b, 0xef, 0x5d,
-	0x9c, 0xa8, 0x58, 0xfa, 0x31, 0xda, 0x01, 0xe9, 0x04, 0x1b, 0x4a, 0xab, 0xa9, 0x74, 0xcd, 0xc4,
-	0x1d, 0x72, 0xf4, 0xd1, 0x3b, 0x81, 0xf2, 0x33, 0x3e, 0xcb, 0x12, 0xc6, 0x67, 0xfb, 0x89, 0xf0,
-	0x9b, 0xaa, 0xab, 0x58, 0x6b, 0xf6, 0x75, 0xc3, 0xd4, 0x4e, 0xb5, 0xa6, 0x22, 0x8c, 0xfc, 0x5b,
-	0x1c, 0xa3, 0x1e, 0xab, 0x7d, 0xad, 0xa5, 0xea, 0xa6, 0x66, 0x5e, 0xc7, 0x1b, 0xb7, 0xa4, 0x4f,
-	0xb9, 0x70, 0x8e, 0x51, 0xf5, 0x26, 0xbe, 0xee, 0x98, 0x6a, 0x4b, 0xfa, 0x29, 0x77, 0x72, 0x53,
-	0x69, 0xb7, 0xfb, 0x17, 0x5a, 0xb7, 0xab, 0xb6, 0xfa, 0x97, 0x86, 0xd6, 0x54, 0xa5, 0xc3, 0x25,
-	0xb0, 0xd6, 0x52, 0x0d, 0xe9, 0x67, 0xdc, 0x26, 0x9a, 0xde, 0xd2, 0x2e, 0xb5, 0x56, 0x4f, 0x69,
-	0x2f, 0x9c, 0xe8, 0xb3, 0xf9, 0xe5, 0x6a, 0xa9, 0x6d, 0xd5, 0x54, 0xa5, 0xdf, 0x96, 0xff, 0x29,
-	0x07, 0x3b, 0x57, 0xf4, 0x46, 0xf7, 0x99, 0x73, 0xeb, 0x44, 0xf5, 0x44, 0x28, 0xde, 0xf5, 0xcc,
-	0x08, 0x39, 0x1a, 0xa5, 0xcd, 0x01, 0xfc, 0xed, 0x9c, 0x78, 0x01, 0x25, 0x36, 0xef, 0xb0, 0x92,
-	0x11, 0x54, 0x1a, 0x84, 0x8e, 0x00, 0x79, 0x5c, 0x68, 0xd2, 0xed, 0x44, 0x1f, 0xd4, 0xa3, 0x89,
-	0xfe, 0x0a, 0x0c, 0xfa, 0x12, 0x6a, 0x19, 0x68, 0xd8, 0x58, 0x5b, 0x59, 0xb3, 0x2e, 0x50, 0xc9,
-	0x7f, 0x97, 0x83, 0xbd, 0xb4, 0xf6, 0x2b, 0x6b, 0x93, 0xdc, 0x07, 0xaf, 0x4d, 0xde, 0xfe, 0xff,
-	0x73, 0xff, 0x9c, 0x83, 0x3d, 0x93, 0xdc, 0xb8, 0x94, 0xfd, 0xdf, 0x1b, 0xff, 0x05, 0x6c, 0x66,
-	0xa0, 0xf7, 0xd8, 0x3e, 0x4b, 0x24, 0xff, 0xfb, 0x1a, 0x54, 0xae, 0xe8, 0xcd, 0x29, 0x25, 0xbc,
-	0xf9, 0x0c, 0xd1, 0xd7, 0xb0, 0x19, 0x3d, 0xb6, 0xad, 0xe8, 0xcb, 0x58, 0xfc, 0xcd, 0x68, 0x6f,
-	0x5e, 0x34, 0x24, 0xa4, 0x47, 0xa7, 0x6d, 0xe5, 0x0c, 0x67, 0xa9, 0x91, 0x01, 0x8f, 0xef, 0x7c,
-	0x67, 0xac, 0x79, 0xb6, 0x73, 0xe7, 0xd8, 0x13, 0xe2, 0x1a, 0x13, 0x36, 0xf0, 0x1d, 0x6f, 0x10,
-	0x7f, 0xd5, 0xbb, 0x57, 0xce, 0x3d, 0x6c, 0xe8, 0x0b, 0x28, 0x89, 0xff, 0x38, 0x0c, 0x2f, 0xbf,
-	0x10, 0x46, 0x7a, 0x40, 0xc4, 0x8c, 0x10, 0xfd, 0x01, 0xd4, 0x92, 0xdf, 0xcd, 0x80, 0x12, 0x46,
-	0xe3, 0xe2, 0xf2, 0x5e, 0xd6, 0x05, 0x72, 0x2e, 0xc0, 0x1a, 0x12, 0x6f, 0x10, 0x8f, 0x35, 0x2f,
-	0x8f, 0x45, 0x65, 0xf9, 0x90, 0x80, 0x2c, 0x39, 0xb7, 0xc3, 0xb7, 0x13, 0x1a, 0x4c, 0xbb, 0xa2,
-	0x4c, 0xbd, 0xfc, 0x62, 0x3e, 0xa4, 0x5b, 0x7f, 0x8b, 0x1d, 0x56, 0xb3, 0x09, 0xbf, 0xa4, 0x3a,
-	0xd6, 0x30, 0xfe, 0x1a, 0xf6, 0x80, 0x5f, 0xd2, 0xd4, 0xe8, 0x2b, 0x00, 0x21, 0xf8, 0xd2, 0x4b,
-	0xfe, 0xb3, 0xe5, 0x01, 0xde, 0x14, 0xe9, 0xb2, 0x43, 0x35, 0xcf, 0xf2, 0x47, 0xdc, 0xa1, 0xe5,
-	0xef, 0xe5, 0xd0, 0x84, 0x0d, 0xa9, 0xb0, 0xf5, 0xed, 0xc4, 0xb1, 0x5e, 0x63, 0x3a, 0x76, 0x1d,
-	0x1a, 0xfe, 0x92, 0x6f, 0x25, 0x46, 0x42, 0x0f, 0xc8, 0x5a, 0xe6, 0x90, 0x7f, 0x01, 0x45, 0x8e,
-	0x8a, 0xfe, 0xa7, 0xc9, 0xec, 0x6b, 0x17, 0x9d, 0xb6, 0x7a, 0xa1, 0xea, 0x3c, 0xdd, 0x3e, 0xe2,
-	0x75, 0x59, 0x1a, 0x90, 0x43, 0x55, 0x28, 0x19, 0xe2, 0x75, 0x54, 0xda, 0x52, 0xfe, 0xbf, 0x03,
-	0x00, 0x00, 0xff, 0xff, 0x11, 0x17, 0x9b, 0xf6, 0x8b, 0x2c, 0x00, 0x00,
-}

+ 0 - 417
vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.proto

@@ -1,417 +0,0 @@
-syntax = "proto2";
-package proto;
-
-message FingerprintData {
-    optional string publicKey = 1;
-    optional string identifier = 2;
-}
-
-message CombinedFingerprint {
-    optional uint32 version = 1;
-    optional FingerprintData localFingerprint = 2;
-    optional FingerprintData remoteFingerprint = 3;
-}
-
-message MessageKey {
-    optional string remoteJid = 1;
-    optional bool fromMe = 2;
-    optional string id = 3;
-    optional string participant = 4;
-}
-
-message SenderKeyDistributionMessage {
-    optional string groupId = 1;
-    optional bytes axolotlSenderKeyDistributionMessage = 2;
-}
-
-message ImageMessage {
-    optional string url = 1;
-    optional string mimetype = 2;
-    optional string caption = 3;
-    optional bytes fileSha256 = 4;
-    optional uint64 fileLength = 5;
-    optional uint32 height = 6;
-    optional uint32 width = 7;
-    optional bytes mediaKey = 8;
-    optional bytes fileEncSha256 = 9;
-    repeated InteractiveAnnotation interactiveAnnotations = 10;
-    optional string directPath = 11;
-    optional bytes jpegThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-    optional bytes firstScanSidecar = 18;
-    optional uint32 firstScanLength = 19;
-}
-
-message ContactMessage {
-    optional string displayName = 1;
-    optional string vcard = 16;
-    optional ContextInfo contextInfo = 17;
-}
-
-message LocationMessage {
-    optional double degreesLatitude = 1;
-    optional double degreesLongitude = 2;
-    optional string name = 3;
-    optional string address = 4;
-    optional string url = 5;
-    optional bytes jpegThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-}
-
-message ExtendedTextMessage {
-    optional string text = 1;
-    optional string matchedText = 2;
-    optional string canonicalUrl = 4;
-    optional string description = 5;
-    optional string title = 6;
-    optional fixed32 textArgb = 7;
-    optional fixed32 backgroundArgb = 8;
-    enum FONTTYPE {
-        SANS_SERIF = 0;
-        SERIF = 1;
-        NORICAN_REGULAR = 2;
-        BRYNDAN_WRITE = 3;
-        BEBASNEUE_REGULAR = 4;
-        OSWALD_HEAVY = 5;
-    }
-    optional FONTTYPE font = 9;
-    optional bytes jpegThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-}
-
-message DocumentMessage {
-    optional string url = 1;
-    optional string mimetype = 2;
-    optional string title = 3;
-    optional bytes fileSha256 = 4;
-    optional uint64 fileLength = 5;
-    optional uint32 pageCount = 6;
-    optional bytes mediaKey = 7;
-    optional string fileName = 8;
-    optional bytes fileEncSha256 = 9;
-    optional string directPath = 10;
-    optional bytes jpegThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-}
-
-message AudioMessage {
-    optional string url = 1;
-    optional string mimetype = 2;
-    optional bytes fileSha256 = 3;
-    optional uint64 fileLength = 4;
-    optional uint32 seconds = 5;
-    optional bool ptt = 6;
-    optional bytes mediaKey = 7;
-    optional bytes fileEncSha256 = 8;
-    optional string directPath = 9;
-    optional ContextInfo contextInfo = 17;
-    optional bytes streamingSidecar = 18;
-}
-
-message VideoMessage {
-    optional string url = 1;
-    optional string mimetype = 2;
-    optional bytes fileSha256 = 3;
-    optional uint64 fileLength = 4;
-    optional uint32 seconds = 5;
-    optional bytes mediaKey = 6;
-    optional string caption = 7;
-    optional bool gifPlayback = 8;
-    optional uint32 height = 9;
-    optional uint32 width = 10;
-    optional bytes fileEncSha256 = 11;
-    repeated InteractiveAnnotation interactiveAnnotations = 12;
-    optional string directPath = 13;
-    optional bytes jpegThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-    optional bytes streamingSidecar = 18;
-    enum ATTRIBUTION {
-        NONE = 0;
-        GIPHY = 1;
-        TENOR = 2;
-    }
-    optional ATTRIBUTION gifAttribution = 19;
-}
-
-message Call {
-    optional bytes callKey = 1;
-}
-
-message Chat {
-    optional string displayName = 1;
-    optional string id = 2;
-}
-
-message ProtocolMessage {
-    optional MessageKey key = 1;
-    enum TYPE {
-        REVOKE = 0;
-    }
-    optional TYPE type = 2;
-}
-
-message ContactsArrayMessage {
-    optional string displayName = 1;
-    repeated ContactMessage contacts = 2;
-    optional ContextInfo contextInfo = 17;
-}
-
-message HSMCurrency {
-    optional string currencyCode = 1;
-    optional int64 amount1000 = 2;
-}
-
-message HSMDateTimeComponent {
-    enum DAYOFWEEKTYPE {
-        MONDAY = 1;
-        TUESDAY = 2;
-        WEDNESDAY = 3;
-        THURSDAY = 4;
-        FRIDAY = 5;
-        SATURDAY = 6;
-        SUNDAY = 7;
-    }
-    optional DAYOFWEEKTYPE dayOfWeek = 1;
-    optional uint32 year = 2;
-    optional uint32 month = 3;
-    optional uint32 dayOfMonth = 4;
-    optional uint32 hour = 5;
-    optional uint32 minute = 6;
-    enum CALENDARTYPE {
-        GREGORIAN = 1;
-        SOLAR_HIJRI = 2;
-    }
-    optional CALENDARTYPE calendar = 7;
-}
-
-message HSMDateTimeUnixEpoch {
-    optional int64 timestamp = 1;
-}
-
-message HSMDateTime {
-    oneof datetimeOneof {
-        HSMDateTimeComponent component = 1;
-        HSMDateTimeUnixEpoch unixEpoch = 2;
-    }
-}
-
-message HSMLocalizableParameter {
-    optional string default = 1;
-    oneof paramOneof {
-        HSMCurrency currency = 2;
-        HSMDateTime dateTime = 3;
-    }
-}
-
-message HighlyStructuredMessage {
-    optional string namespace = 1;
-    optional string elementName = 2;
-    repeated string params = 3;
-    optional string fallbackLg = 4;
-    optional string fallbackLc = 5;
-    repeated HSMLocalizableParameter localizableParams = 6;
-}
-
-message SendPaymentMessage {
-    optional Message noteMessage = 2;
-}
-
-message RequestPaymentMessage {
-    optional string currencyCodeIso4217 = 1;
-    optional uint64 amount1000 = 2;
-    optional string requestFrom = 3;
-    optional Message noteMessage = 4;
-}
-
-message LiveLocationMessage {
-    optional double degreesLatitude = 1;
-    optional double degreesLongitude = 2;
-    optional uint32 accuracyInMeters = 3;
-    optional float speedInMps = 4;
-    optional uint32 degreesClockwiseFromMagneticNorth = 5;
-    optional string caption = 6;
-    optional int64 sequenceNumber = 7;
-    optional bytes jpegThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-}
-
-message StickerMessage {
-    optional string url = 1;
-    optional bytes fileSha256 = 2;
-    optional bytes fileEncSha256 = 3;
-    optional bytes mediaKey = 4;
-    optional string mimetype = 5;
-    optional uint32 height = 6;
-    optional uint32 width = 7;
-    optional string directPath = 8;
-    optional uint64 fileLength = 9;
-    optional bytes pngThumbnail = 16;
-    optional ContextInfo contextInfo = 17;
-}
-
-message Message {
-    optional string conversation = 1;
-    optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2;
-    optional ImageMessage imageMessage = 3;
-    optional ContactMessage contactMessage = 4;
-    optional LocationMessage locationMessage = 5;
-    optional ExtendedTextMessage extendedTextMessage = 6;
-    optional DocumentMessage documentMessage = 7;
-    optional AudioMessage audioMessage = 8;
-    optional VideoMessage videoMessage = 9;
-    optional Call call = 10;
-    optional Chat chat = 11;
-    optional ProtocolMessage protocolMessage = 12;
-    optional ContactsArrayMessage contactsArrayMessage = 13;
-    optional HighlyStructuredMessage highlyStructuredMessage = 14;
-    optional SenderKeyDistributionMessage fastRatchetKeySenderKeyDistributionMessage = 15;
-    optional SendPaymentMessage sendPaymentMessage = 16;
-    optional RequestPaymentMessage requestPaymentMessage = 17;
-    optional LiveLocationMessage liveLocationMessage = 18;
-    optional StickerMessage stickerMessage = 20;
-}
-
-message ContextInfo {
-    optional string stanzaId = 1;
-    optional string participant = 2;
-    repeated Message quotedMessage = 3;
-    optional string remoteJid = 4;
-    repeated string mentionedJid = 15;
-    optional string conversionSource = 18;
-    optional bytes conversionData = 19;
-    optional uint32 conversionDelaySeconds = 20;
-    optional bool isForwarded = 22;
-    reserved 16, 17;
-}
-
-message InteractiveAnnotation {
-    repeated Point polygonVertices = 1;
-    oneof action {
-        Location location = 2;
-    }
-}
-
-message Point {
-    optional double x = 3;
-    optional double y = 4;
-}
-
-message Location {
-    optional double degreesLatitude = 1;
-    optional double degreesLongitude = 2;
-    optional string name = 3;
-}
-
-message WebMessageInfo {
-    required MessageKey key = 1;
-    optional Message message = 2;
-    optional uint64 messageTimestamp = 3;
-    enum STATUS {
-        ERROR = 0;
-        PENDING = 1;
-        SERVER_ACK = 2;
-        DELIVERY_ACK = 3;
-        READ = 4;
-        PLAYED = 5;
-    }
-    optional STATUS status = 4 [default=PENDING];
-    optional string participant = 5;
-    optional bool ignore = 16;
-    optional bool starred = 17;
-    optional bool broadcast = 18;
-    optional string pushName = 19;
-    optional bytes mediaCiphertextSha256 = 20;
-    optional bool multicast = 21;
-    optional bool urlText = 22;
-    optional bool urlNumber = 23;
-    enum STUBTYPE {
-        UNKNOWN = 0;
-        REVOKE = 1;
-        CIPHERTEXT = 2;
-        FUTUREPROOF = 3;
-        NON_VERIFIED_TRANSITION = 4;
-        UNVERIFIED_TRANSITION = 5;
-        VERIFIED_TRANSITION = 6;
-        VERIFIED_LOW_UNKNOWN = 7;
-        VERIFIED_HIGH = 8;
-        VERIFIED_INITIAL_UNKNOWN = 9;
-        VERIFIED_INITIAL_LOW = 10;
-        VERIFIED_INITIAL_HIGH = 11;
-        VERIFIED_TRANSITION_ANY_TO_NONE = 12;
-        VERIFIED_TRANSITION_ANY_TO_HIGH = 13;
-        VERIFIED_TRANSITION_HIGH_TO_LOW = 14;
-        VERIFIED_TRANSITION_HIGH_TO_UNKNOWN = 15;
-        VERIFIED_TRANSITION_UNKNOWN_TO_LOW = 16;
-        VERIFIED_TRANSITION_LOW_TO_UNKNOWN = 17;
-        VERIFIED_TRANSITION_NONE_TO_LOW = 18;
-        VERIFIED_TRANSITION_NONE_TO_UNKNOWN = 19;
-        GROUP_CREATE = 20;
-        GROUP_CHANGE_SUBJECT = 21;
-        GROUP_CHANGE_ICON = 22;
-        GROUP_CHANGE_INVITE_LINK = 23;
-        GROUP_CHANGE_DESCRIPTION = 24;
-        GROUP_CHANGE_RESTRICT = 25;
-        GROUP_CHANGE_ANNOUNCE = 26;
-        GROUP_PARTICIPANT_ADD = 27;
-        GROUP_PARTICIPANT_REMOVE = 28;
-        GROUP_PARTICIPANT_PROMOTE = 29;
-        GROUP_PARTICIPANT_DEMOTE = 30;
-        GROUP_PARTICIPANT_INVITE = 31;
-        GROUP_PARTICIPANT_LEAVE = 32;
-        GROUP_PARTICIPANT_CHANGE_NUMBER = 33;
-        BROADCAST_CREATE = 34;
-        BROADCAST_ADD = 35;
-        BROADCAST_REMOVE = 36;
-        GENERIC_NOTIFICATION = 37;
-        E2E_IDENTITY_CHANGED = 38;
-        E2E_ENCRYPTED = 39;
-        CALL_MISSED_VOICE = 40;
-        CALL_MISSED_VIDEO = 41;
-        INDIVIDUAL_CHANGE_NUMBER = 42;
-        GROUP_DELETE = 43;
-    }
-    optional STUBTYPE messageStubType = 24;
-    optional bool clearMedia = 25;
-    repeated string messageStubParameters = 26;
-    optional uint32 duration = 27;
-    repeated string labels = 28;
-}
-
-message WebNotificationsInfo {
-    optional uint64 timestamp = 2;
-    optional uint32 unreadChats = 3;
-    optional uint32 notifyMessageCount = 4;
-    repeated Message notifyMessages = 5;
-}
-
-message NotificationMessageInfo {
-    optional MessageKey key = 1;
-    optional Message message = 2;
-    optional uint64 messageTimestamp = 3;
-    optional string participant = 4;
-}
-
-message TabletNotificationsInfo {
-    optional uint64 timestamp = 2;
-    optional uint32 unreadChats = 3;
-    optional uint32 notifyMessageCount = 4;
-    repeated Message notifyMessage = 5;
-}
-
-message WebFeatures {
-    enum FLAG {
-        NOT_IMPLEMENTED = 0;
-        IMPLEMENTED = 1;
-        OPTIONAL = 2;
-    }
-    optional FLAG labelsDisplay = 1;
-    optional FLAG voipIndividualOutgoing = 2;
-    optional FLAG groupsV3 = 3;
-    optional FLAG groupsV3Create = 4;
-    optional FLAG changeNumberV2 = 5;
-    optional FLAG queryStatusV3Thumbnail = 6;
-    optional FLAG liveLocations = 7;
-    optional FLAG queryVname = 8;
-    optional FLAG voipIndividualIncoming = 9;
-    optional FLAG quickRepliesQuery = 10;
-}

+ 0 - 78
vendor/github.com/Rhymen/go-whatsapp/binary/token/token.go

@@ -1,78 +0,0 @@
-package token
-
-import "fmt"
-
-var SingleByteTokens = [...]string{"", "", "", "200", "400", "404", "500", "501", "502", "action", "add",
-	"after", "archive", "author", "available", "battery", "before", "body",
-	"broadcast", "chat", "clear", "code", "composing", "contacts", "count",
-	"create", "debug", "delete", "demote", "duplicate", "encoding", "error",
-	"false", "filehash", "from", "g.us", "group", "groups_v2", "height", "id",
-	"image", "in", "index", "invis", "item", "jid", "kind", "last", "leave",
-	"live", "log", "media", "message", "mimetype", "missing", "modify", "name",
-	"notification", "notify", "out", "owner", "participant", "paused",
-	"picture", "played", "presence", "preview", "promote", "query", "raw",
-	"read", "receipt", "received", "recipient", "recording", "relay",
-	"remove", "response", "resume", "retry", "s.whatsapp.net", "seconds",
-	"set", "size", "status", "subject", "subscribe", "t", "text", "to", "true",
-	"type", "unarchive", "unavailable", "url", "user", "value", "web", "width",
-	"mute", "read_only", "admin", "creator", "short", "update", "powersave",
-	"checksum", "epoch", "block", "previous", "409", "replaced", "reason",
-	"spam", "modify_tag", "message_info", "delivery", "emoji", "title",
-	"description", "canonical-url", "matched-text", "star", "unstar",
-	"media_key", "filename", "identity", "unread", "page", "page_count",
-	"search", "media_message", "security", "call_log", "profile", "ciphertext",
-	"invite", "gif", "vcard", "frequent", "privacy", "blacklist", "whitelist",
-	"verify", "location", "document", "elapsed", "revoke_invite", "expiration",
-	"unsubscribe", "disable", "vname", "old_jid", "new_jid", "announcement",
-	"locked", "prop", "label", "color", "call", "offer", "call-id"}
-
-var doubleByteTokens = [...]string{}
-
-func GetSingleToken(i int) (string, error) {
-	if i < 3 || i >= len(SingleByteTokens) {
-		return "", fmt.Errorf("index out of single byte token bounds %d", i)
-	}
-
-	return SingleByteTokens[i], nil
-}
-
-func GetDoubleToken(index1 int, index2 int) (string, error) {
-	n := 256*index1 + index2
-	if n < 0 || n >= len(doubleByteTokens) {
-		return "", fmt.Errorf("index out of double byte token bounds %d", n)
-	}
-
-	return doubleByteTokens[n], nil
-}
-
-func IndexOfSingleToken(token string) int {
-	for i, t := range SingleByteTokens {
-		if t == token {
-			return i
-		}
-	}
-
-	return -1
-}
-
-const (
-	LIST_EMPTY   = 0
-	STREAM_END   = 2
-	DICTIONARY_0 = 236
-	DICTIONARY_1 = 237
-	DICTIONARY_2 = 238
-	DICTIONARY_3 = 239
-	LIST_8       = 248
-	LIST_16      = 249
-	JID_PAIR     = 250
-	HEX_8        = 251
-	BINARY_8     = 252
-	BINARY_20    = 253
-	BINARY_32    = 254
-	NIBBLE_8     = 255
-)
-
-const (
-	PACKED_MAX      = 254
-	SINGLE_BYTE_MAX = 256
-)

+ 0 - 389
vendor/github.com/Rhymen/go-whatsapp/conn.go

@@ -1,389 +0,0 @@
-//Package whatsapp provides a developer API to interact with the WhatsAppWeb-Servers.
-package whatsapp
-
-import (
-	"crypto/hmac"
-	"crypto/sha256"
-	"encoding/json"
-	"fmt"
-	"math/rand"
-	"net/http"
-	"os"
-	"strconv"
-	"strings"
-	"sync"
-	"time"
-
-	"github.com/Rhymen/go-whatsapp/binary"
-	"github.com/Rhymen/go-whatsapp/crypto/cbc"
-	"github.com/gorilla/websocket"
-)
-
-type metric byte
-
-const (
-	debugLog metric = iota + 1
-	queryResume
-	queryReceipt
-	queryMedia
-	queryChat
-	queryContacts
-	queryMessages
-	presence
-	presenceSubscribe
-	group
-	read
-	chat
-	received
-	pic
-	status
-	message
-	queryActions
-	block
-	queryGroup
-	queryPreview
-	queryEmoji
-	queryMessageInfo
-	spam
-	querySearch
-	queryIdentity
-	queryUrl
-	profile
-	contact
-	queryVcard
-	queryStatus
-	queryStatusUpdate
-	privacyStatus
-	queryLiveLocations
-	liveLocation
-	queryVname
-	queryLabels
-	call
-	queryCall
-	queryQuickReplies
-)
-
-type flag byte
-
-const (
-	ignore flag = 1 << (7 - iota)
-	ackRequest
-	available
-	notAvailable
-	expires
-	skipOffline
-)
-
-/*
-Conn is created by NewConn. Interacting with the initialized Conn is the main way of interacting with our package.
-It holds all necessary information to make the package work internally.
-*/
-type Conn struct {
-	wsConn         *websocket.Conn
-	wsConnOK       bool
-	wsConnMutex    sync.RWMutex
-	session        *Session
-	listener       map[string]chan string
-	listenerMutex  sync.RWMutex
-	writeChan      chan wsMsg
-	handler        []Handler
-	msgCount       int
-	msgTimeout     time.Duration
-	Info           *Info
-	Store          *Store
-	ServerLastSeen time.Time
-
-	longClientName  string
-	shortClientName string
-}
-
-type wsMsg struct {
-	messageType int
-	data        []byte
-}
-
-/*
-Creates a new connection with a given timeout. The websocket connection to the WhatsAppWeb servers get´s established.
-The goroutine for handling incoming messages is started
-*/
-func NewConn(timeout time.Duration) (*Conn, error) {
-	wac := &Conn{
-		wsConn:        nil, // will be set in connect()
-		wsConnMutex:   sync.RWMutex{},
-		listener:      make(map[string]chan string),
-		listenerMutex: sync.RWMutex{},
-		writeChan:     make(chan wsMsg),
-		handler:       make([]Handler, 0),
-		msgCount:      0,
-		msgTimeout:    timeout,
-		Store:         newStore(),
-
-		longClientName:  "github.com/rhymen/go-whatsapp",
-		shortClientName: "go-whatsapp",
-	}
-
-	if err := wac.connect(); err != nil {
-		return nil, err
-	}
-
-	go wac.readPump()
-	go wac.writePump()
-	go wac.keepAlive(20000, 90000)
-
-	return wac, nil
-}
-
-func (wac *Conn) isConnected() bool {
-	wac.wsConnMutex.RLock()
-	defer wac.wsConnMutex.RUnlock()
-	if wac.wsConn == nil {
-		return false
-	}
-	if wac.wsConnOK {
-		return true
-	}
-
-	// just send a keepalive to test the connection
-	wac.sendKeepAlive()
-
-	// this method is expected to be called by loops. So we can just return false
-	return false
-}
-
-// connect should be guarded with wsConnMutex
-func (wac *Conn) connect() error {
-	dialer := &websocket.Dialer{
-		ReadBufferSize:   25 * 1024 * 1024,
-		WriteBufferSize:  10 * 1024 * 1024,
-		HandshakeTimeout: wac.msgTimeout,
-	}
-
-	headers := http.Header{"Origin": []string{"https://web.whatsapp.com"}}
-	wsConn, _, err := dialer.Dial("wss://w3.web.whatsapp.com/ws", headers)
-	if err != nil {
-		return fmt.Errorf("couldn't dial whatsapp web websocket: %v", err)
-	}
-
-	wsConn.SetCloseHandler(func(code int, text string) error {
-		fmt.Fprintf(os.Stderr, "websocket connection closed(%d, %s)\n", code, text)
-
-		// from default CloseHandler
-		message := websocket.FormatCloseMessage(code, "")
-		wsConn.WriteControl(websocket.CloseMessage, message, time.Now().Add(time.Second))
-
-		// our close handling
-		if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway) {
-			fmt.Println("Trigger reconnect")
-			go wac.reconnect()
-		}
-		return nil
-	})
-
-	wac.wsConn = wsConn
-	wac.wsConnOK = true
-	return nil
-}
-
-// reconnect should be run as go routine
-func (wac *Conn) reconnect() {
-	wac.wsConnMutex.Lock()
-	wac.wsConn.Close()
-	wac.wsConn = nil
-	wac.wsConnOK = false
-	wac.wsConnMutex.Unlock()
-
-	// wait up to 60 seconds and then reconnect. As writePump should send immediately, it might
-	// reconnect as well. So we check its existance before reconnecting
-	for !wac.isConnected() {
-		time.Sleep(time.Duration(rand.Intn(60)) * time.Second)
-
-		wac.wsConnMutex.Lock()
-		if wac.wsConn == nil {
-			if err := wac.connect(); err != nil {
-				fmt.Fprintf(os.Stderr, "could not reconnect to websocket: %v\n", err)
-			}
-		}
-		wac.wsConnMutex.Unlock()
-	}
-}
-
-func (wac *Conn) write(data []interface{}) (<-chan string, error) {
-	d, err := json.Marshal(data)
-	if err != nil {
-		return nil, err
-	}
-
-	ts := time.Now().Unix()
-	messageTag := fmt.Sprintf("%d.--%d", ts, wac.msgCount)
-	msg := fmt.Sprintf("%s,%s", messageTag, d)
-
-	ch := make(chan string, 1)
-
-	wac.listenerMutex.Lock()
-	wac.listener[messageTag] = ch
-	wac.listenerMutex.Unlock()
-
-	wac.writeChan <- wsMsg{websocket.TextMessage, []byte(msg)}
-
-	wac.msgCount++
-	return ch, nil
-}
-
-func (wac *Conn) writeBinary(node binary.Node, metric metric, flag flag, tag string) (<-chan string, error) {
-	if len(tag) < 2 {
-		return nil, fmt.Errorf("no tag specified or to short")
-	}
-	b, err := binary.Marshal(node)
-	if err != nil {
-		return nil, err
-	}
-
-	cipher, err := cbc.Encrypt(wac.session.EncKey, nil, b)
-	if err != nil {
-		return nil, err
-	}
-
-	h := hmac.New(sha256.New, wac.session.MacKey)
-	h.Write(cipher)
-	hash := h.Sum(nil)
-
-	data := []byte(tag + ",")
-	data = append(data, byte(metric), byte(flag))
-	data = append(data, hash[:32]...)
-	data = append(data, cipher...)
-
-	ch := make(chan string, 1)
-
-	wac.listenerMutex.Lock()
-	wac.listener[tag] = ch
-	wac.listenerMutex.Unlock()
-
-	msg := wsMsg{websocket.BinaryMessage, data}
-	wac.writeChan <- msg
-
-	wac.msgCount++
-	return ch, nil
-}
-
-func (wac *Conn) readPump() {
-	defer wac.wsConn.Close()
-
-	for {
-		msgType, msg, err := wac.wsConn.ReadMessage()
-		if err != nil {
-			wac.wsConnOK = false
-			if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {
-				wac.handle(fmt.Errorf("unexpected websocket close: %v", err))
-			}
-			// sleep for a second and retry reading the next message
-			time.Sleep(time.Second)
-			continue
-		}
-		wac.wsConnOK = true
-
-		data := strings.SplitN(string(msg), ",", 2)
-
-		//Kepp-Alive Timestmap
-		if data[0][0] == '!' {
-			msecs, err := strconv.ParseInt(data[0][1:], 10, 64)
-			if err != nil {
-				fmt.Fprintf(os.Stderr, "Error converting time string to uint: %v\n", err)
-				continue
-			}
-			wac.ServerLastSeen = time.Unix(msecs/1000, (msecs%1000)*int64(time.Millisecond))
-			continue
-		}
-
-		wac.listenerMutex.RLock()
-		listener, hasListener := wac.listener[data[0]]
-		wac.listenerMutex.RUnlock()
-
-		if hasListener && len(data[1]) > 0 {
-			listener <- data[1]
-
-			wac.listenerMutex.Lock()
-			delete(wac.listener, data[0])
-			wac.listenerMutex.Unlock()
-		} else if msgType == 2 && wac.session != nil && wac.session.EncKey != nil {
-			message, err := wac.decryptBinaryMessage([]byte(data[1]))
-			if err != nil {
-				wac.handle(fmt.Errorf("error decoding binary: %v", err))
-				continue
-			}
-
-			wac.dispatch(message)
-		} else {
-			if len(data[1]) > 0 {
-				wac.handle(string(data[1]))
-			}
-		}
-
-	}
-}
-
-func (wac *Conn) writePump() {
-	for msg := range wac.writeChan {
-		for !wac.isConnected() {
-			// reconnect to send the message ASAP
-			wac.wsConnMutex.Lock()
-			if wac.wsConn == nil {
-				if err := wac.connect(); err != nil {
-					fmt.Fprintf(os.Stderr, "could not reconnect to websocket: %v\n", err)
-				}
-			}
-			wac.wsConnMutex.Unlock()
-			if !wac.isConnected() {
-				// reconnecting failed. Sleep for a while and try again afterwards
-				time.Sleep(time.Duration(rand.Intn(5)) * time.Second)
-			}
-		}
-		if err := wac.wsConn.WriteMessage(msg.messageType, msg.data); err != nil {
-			fmt.Fprintf(os.Stderr, "error writing to socket: %v\n", err)
-			wac.wsConnOK = false
-			// add message to channel again to no loose it
-			go func() {
-				wac.writeChan <- msg
-			}()
-		}
-	}
-}
-
-func (wac *Conn) sendKeepAlive() {
-	// whatever issues might be there allow sending this message
-	wac.wsConnOK = true
-	wac.writeChan <- wsMsg{
-		messageType: websocket.TextMessage,
-		data:        []byte("?,,"),
-	}
-}
-
-func (wac *Conn) keepAlive(minIntervalMs int, maxIntervalMs int) {
-	for {
-		wac.sendKeepAlive()
-		interval := rand.Intn(maxIntervalMs-minIntervalMs) + minIntervalMs
-		<-time.After(time.Duration(interval) * time.Millisecond)
-	}
-}
-
-func (wac *Conn) decryptBinaryMessage(msg []byte) (*binary.Node, error) {
-	//message validation
-	h2 := hmac.New(sha256.New, wac.session.MacKey)
-	h2.Write([]byte(msg[32:]))
-	if !hmac.Equal(h2.Sum(nil), msg[:32]) {
-		return nil, fmt.Errorf("message received with invalid hmac")
-	}
-
-	// message decrypt
-	d, err := cbc.Decrypt(wac.session.EncKey, nil, msg[32:])
-	if err != nil {
-		return nil, fmt.Errorf("error decrypting message with AES: %v", err)
-	}
-
-	// message unmarshal
-	message, err := binary.Unmarshal(d)
-	if err != nil {
-		return nil, fmt.Errorf("error decoding binary: %v", err)
-	}
-
-	return message, nil
-}

+ 0 - 255
vendor/github.com/Rhymen/go-whatsapp/contact.go

@@ -1,255 +0,0 @@
-package whatsapp
-
-import (
-	"fmt"
-	"github.com/Rhymen/go-whatsapp/binary"
-	"strconv"
-	"time"
-)
-
-type Presence string
-
-const (
-	PresenceAvailable   = "available"
-	PresenceUnavailable = "unavailable"
-	PresenceComposing   = "composing"
-)
-
-//TODO: filename? WhatsApp uses Store.Contacts for these functions
-//TODO: functions probably shouldn't return a string, maybe build a struct / return json
-//TODO: check for further queries
-func (wac *Conn) GetProfilePicThumb(jid string) (<-chan string, error) {
-	data := []interface{}{"query", "ProfilePicThumb", jid}
-	return wac.write(data)
-}
-
-func (wac *Conn) GetStatus(jid string) (<-chan string, error) {
-	data := []interface{}{"query", "Status", jid}
-	return wac.write(data)
-}
-
-func (wac *Conn) GetGroupMetaData(jid string) (<-chan string, error) {
-	data := []interface{}{"query", "GroupMetadata", jid}
-	return wac.write(data)
-}
-
-func (wac *Conn) SubscribePresence(jid string) (<-chan string, error) {
-	data := []interface{}{"action", "presence", "subscribe", jid}
-	return wac.write(data)
-}
-
-func (wac *Conn) CreateGroup(subject string, participants []string) (<-chan string, error) {
-	return wac.setGroup("create", "", subject, participants)
-}
-
-func (wac *Conn) UpdateGroupSubject(subject string, jid string) (<-chan string, error) {
-	return wac.setGroup("subject", jid, subject, nil)
-}
-
-func (wac *Conn) SetAdmin(jid string, participants []string) (<-chan string, error) {
-	return wac.setGroup("promote", jid, "", participants)
-}
-
-func (wac *Conn) RemoveAdmin(jid string, participants []string) (<-chan string, error) {
-	return wac.setGroup("demote", jid, "", participants)
-}
-
-func (wac *Conn) AddMember(jid string, participants []string) (<-chan string, error) {
-	return wac.setGroup("add", jid, "", participants)
-}
-
-func (wac *Conn) RemoveMember(jid string, participants []string) (<-chan string, error) {
-	return wac.setGroup("remove", jid, "", participants)
-}
-
-func (wac *Conn) LeaveGroup(jid string) (<-chan string, error) {
-	return wac.setGroup("leave", jid, "", nil)
-}
-
-func (wac *Conn) Search(search string, count, page int) (*binary.Node, error) {
-	return wac.query("search", "", "", "", "", search, count, page)
-}
-
-func (wac *Conn) LoadMessages(jid, messageId string, count int) (*binary.Node, error) {
-	return wac.query("message", jid, "", "before", "true", "", count, 0)
-}
-
-func (wac *Conn) LoadMessagesBefore(jid, messageId string, count int) (*binary.Node, error) {
-	return wac.query("message", jid, messageId, "before", "true", "", count, 0)
-}
-
-func (wac *Conn) LoadMessagesAfter(jid, messageId string, count int) (*binary.Node, error) {
-	return wac.query("message", jid, messageId, "after", "true", "", count, 0)
-}
-
-func (wac *Conn) Presence(jid string, presence Presence) (<-chan string, error) {
-	ts := time.Now().Unix()
-	tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount)
-
-	n := binary.Node{
-		Description: "action",
-		Attributes: map[string]string{
-			"type":  "set",
-			"epoch": strconv.Itoa(wac.msgCount),
-		},
-		Content: []interface{}{binary.Node{
-			Description: "presence",
-			Attributes: map[string]string{
-				"type": string(presence),
-			},
-		}},
-	}
-
-	return wac.writeBinary(n, group, ignore, tag)
-}
-
-func (wac *Conn) Exist(jid string) (<-chan string, error) {
-	data := []interface{}{"query", "exist", jid}
-	return wac.write(data)
-}
-
-func (wac *Conn) Emoji() (*binary.Node, error) {
-	return wac.query("emoji", "", "", "", "", "", 0, 0)
-}
-
-func (wac *Conn) Contacts() (*binary.Node, error) {
-	return wac.query("contacts", "", "", "", "", "", 0, 0)
-}
-
-func (wac *Conn) Chats() (*binary.Node, error) {
-	return wac.query("chat", "", "", "", "", "", 0, 0)
-}
-
-func (wac *Conn) Read(jid, id string) (<-chan string, error) {
-	ts := time.Now().Unix()
-	tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount)
-
-	n := binary.Node{
-		Description: "action",
-		Attributes: map[string]string{
-			"type":  "set",
-			"epoch": strconv.Itoa(wac.msgCount),
-		},
-		Content: []interface{}{binary.Node{
-			Description: "read",
-			Attributes: map[string]string{
-				"count": "1",
-				"index": id,
-				"jid":   jid,
-				"owner": "false",
-			},
-		}},
-	}
-
-	return wac.writeBinary(n, group, ignore, tag)
-}
-
-func (wac *Conn) query(t, jid, messageId, kind, owner, search string, count, page int) (*binary.Node, error) {
-	ts := time.Now().Unix()
-	tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount)
-
-	n := binary.Node{
-		Description: "query",
-		Attributes: map[string]string{
-			"type":  t,
-			"epoch": strconv.Itoa(wac.msgCount),
-		},
-	}
-
-	if jid != "" {
-		n.Attributes["jid"] = jid
-	}
-
-	if messageId != "" {
-		n.Attributes["index"] = messageId
-	}
-
-	if kind != "" {
-		n.Attributes["kind"] = kind
-	}
-
-	if owner != "" {
-		n.Attributes["owner"] = owner
-	}
-
-	if search != "" {
-		n.Attributes["search"] = search
-	}
-
-	if count != 0 {
-		n.Attributes["count"] = strconv.Itoa(count)
-	}
-
-	if page != 0 {
-		n.Attributes["page"] = strconv.Itoa(page)
-	}
-
-	ch, err := wac.writeBinary(n, group, ignore, tag)
-	if err != nil {
-		return nil, err
-	}
-
-	msg, err := wac.decryptBinaryMessage([]byte(<-ch))
-	if err != nil {
-		return nil, err
-	}
-
-	//TODO: use parseProtoMessage
-	return msg, nil
-}
-
-func (wac *Conn) setGroup(t, jid, subject string, participants []string) (<-chan string, error) {
-	ts := time.Now().Unix()
-	tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount)
-
-	//TODO: get proto or improve encoder to handle []interface{}
-
-	p := buildParticipantNodes(participants)
-
-	g := binary.Node{
-		Description: "group",
-		Attributes: map[string]string{
-			"author": wac.session.Wid,
-			"id":     tag,
-			"type":   t,
-		},
-		Content: p,
-	}
-
-	if jid != "" {
-		g.Attributes["jid"] = jid
-	}
-
-	if subject != "" {
-		g.Attributes["subject"] = subject
-	}
-
-	n := binary.Node{
-		Description: "action",
-		Attributes: map[string]string{
-			"type":  "set",
-			"epoch": strconv.Itoa(wac.msgCount),
-		},
-		Content: []interface{}{g},
-	}
-
-	return wac.writeBinary(n, group, ignore, tag)
-}
-
-func buildParticipantNodes(participants []string) []binary.Node {
-	l := len(participants)
-	if participants == nil || l == 0 {
-		return nil
-	}
-
-	p := make([]binary.Node, len(participants))
-	for i, participant := range participants {
-		p[i] = binary.Node{
-			Description: "participant",
-			Attributes: map[string]string{
-				"jid": participant,
-			},
-		}
-	}
-	return p
-}

+ 0 - 101
vendor/github.com/Rhymen/go-whatsapp/crypto/cbc/cbc.go

@@ -1,101 +0,0 @@
-/*
-CBC describes a block cipher mode. In cryptography, a block cipher mode of operation is an algorithm that uses a
-block cipher to provide an information service such as confidentiality or authenticity. A block cipher by itself
-is only suitable for the secure cryptographic transformation (encryption or decryption) of one fixed-length group of
-bits called a block. A mode of operation describes how to repeatedly apply a cipher's single-block operation to
-securely transform amounts of data larger than a block.
-
-This package simplifies the usage of AES-256-CBC.
-*/
-package cbc
-
-/*
-Some code is provided by the GitHub user locked (github.com/locked):
-https://gist.github.com/locked/b066aa1ddeb2b28e855e
-Thanks!
-*/
-import (
-	"bytes"
-	"crypto/aes"
-	"crypto/cipher"
-	"crypto/rand"
-	"fmt"
-	"io"
-)
-
-/*
-Decrypt is a function that decrypts a given cipher text with a provided key and initialization vector(iv).
-*/
-func Decrypt(key, iv, ciphertext []byte) ([]byte, error) {
-	block, err := aes.NewCipher(key)
-
-	if err != nil {
-		return nil, err
-	}
-
-	if len(ciphertext) < aes.BlockSize {
-		return nil, fmt.Errorf("ciphertext is shorter then block size: %d / %d", len(ciphertext), aes.BlockSize)
-	}
-
-	if iv == nil {
-		iv = ciphertext[:aes.BlockSize]
-		ciphertext = ciphertext[aes.BlockSize:]
-	}
-
-	cbc := cipher.NewCBCDecrypter(block, iv)
-	cbc.CryptBlocks(ciphertext, ciphertext)
-
-	return unpad(ciphertext)
-}
-
-/*
-Encrypt is a function that encrypts plaintext with a given key and an optional initialization vector(iv).
-*/
-func Encrypt(key, iv, plaintext []byte) ([]byte, error) {
-	plaintext = pad(plaintext, aes.BlockSize)
-
-	if len(plaintext)%aes.BlockSize != 0 {
-		return nil, fmt.Errorf("plaintext is not a multiple of the block size: %d / %d", len(plaintext), aes.BlockSize)
-	}
-
-	block, err := aes.NewCipher(key)
-	if err != nil {
-		return nil, err
-	}
-
-	var ciphertext []byte
-	if iv == nil {
-		ciphertext = make([]byte, aes.BlockSize+len(plaintext))
-		iv := ciphertext[:aes.BlockSize]
-		if _, err := io.ReadFull(rand.Reader, iv); err != nil {
-			return nil, err
-		}
-
-		cbc := cipher.NewCBCEncrypter(block, iv)
-		cbc.CryptBlocks(ciphertext[aes.BlockSize:], plaintext)
-	} else {
-		ciphertext = make([]byte, len(plaintext))
-
-		cbc := cipher.NewCBCEncrypter(block, iv)
-		cbc.CryptBlocks(ciphertext, plaintext)
-	}
-
-	return ciphertext, nil
-}
-
-func pad(ciphertext []byte, blockSize int) []byte {
-	padding := blockSize - len(ciphertext)%blockSize
-	padtext := bytes.Repeat([]byte{byte(padding)}, padding)
-	return append(ciphertext, padtext...)
-}
-
-func unpad(src []byte) ([]byte, error) {
-	length := len(src)
-	padLen := int(src[length-1])
-
-	if padLen > length {
-		return nil, fmt.Errorf("padding is greater then the length: %d / %d", padLen, length)
-	}
-
-	return src[:(length - padLen)], nil
-}

+ 0 - 44
vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go

@@ -1,44 +0,0 @@
-/*
-In cryptography, Curve25519 is an elliptic curve offering 128 bits of security and designed for use with the elliptic
-curve Diffie–Hellman (ECDH) key agreement scheme. It is one of the fastest ECC curves and is not covered by any known
-patents. The reference implementation is public domain software. The original Curve25519 paper defined it
-as a Diffie–Hellman (DH) function.
-*/
-package curve25519
-
-import (
-	"crypto/rand"
-	"golang.org/x/crypto/curve25519"
-	"io"
-)
-
-/*
-GenerateKey generates a public private key pair using Curve25519.
-*/
-func GenerateKey() (privateKey *[32]byte, publicKey *[32]byte, err error) {
-	var pub, priv [32]byte
-
-	_, err = io.ReadFull(rand.Reader, priv[:])
-	if err != nil {
-		return nil, nil, err
-	}
-
-	priv[0] &= 248
-	priv[31] &= 127
-	priv[31] |= 64
-
-	curve25519.ScalarBaseMult(&pub, &priv)
-
-	return &priv, &pub, nil
-}
-
-/*
-GenerateSharedSecret generates the shared secret with a given public private key pair.
-*/
-func GenerateSharedSecret(priv, pub [32]byte) []byte {
-	var secret [32]byte
-
-	curve25519.ScalarMult(&secret, &priv, &pub)
-
-	return secret[:]
-}

+ 0 - 52
vendor/github.com/Rhymen/go-whatsapp/crypto/hkdf/hkdf.go

@@ -1,52 +0,0 @@
-/*
-HKDF is a simple key derivation function (KDF) based on
-a hash-based message authentication code (HMAC). It was initially proposed by its authors as a building block in
-various protocols and applications, as well as to discourage the proliferation of multiple KDF mechanisms.
-The main approach HKDF follows is the "extract-then-expand" paradigm, where the KDF logically consists of two modules:
-the first stage takes the input keying material and "extracts" from it a fixed-length pseudorandom key, and then the
-second stage "expands" this key into several additional pseudorandom keys (the output of the KDF).
-*/
-package hkdf
-
-import (
-	"crypto/hmac"
-	"crypto/sha256"
-	"fmt"
-	"golang.org/x/crypto/hkdf"
-	"io"
-)
-
-/*
-Expand expands a given key with the HKDF algorithm.
-*/
-func Expand(key []byte, length int, info string) ([]byte, error) {
-	if info == "" {
-		keyBlock := hmac.New(sha256.New, key)
-		var out, last []byte
-
-		var blockIndex byte = 1
-		for i := 0; len(out) < length; i++ {
-			keyBlock.Reset()
-			//keyBlock.Write(append(append(last, []byte(info)...), blockIndex))
-			keyBlock.Write(last)
-			keyBlock.Write([]byte(info))
-			keyBlock.Write([]byte{blockIndex})
-			last = keyBlock.Sum(nil)
-			blockIndex += 1
-			out = append(out, last...)
-		}
-		return out[:length], nil
-	} else {
-		h := hkdf.New(sha256.New, key, nil, []byte(info))
-		out := make([]byte, length)
-		n, err := io.ReadAtLeast(h, out, length)
-		if err != nil {
-			return nil, err
-		}
-		if n != length {
-			return nil, fmt.Errorf("new key to short")
-		}
-
-		return out[:length], nil
-	}
-}

+ 0 - 169
vendor/github.com/Rhymen/go-whatsapp/handler.go

@@ -1,169 +0,0 @@
-package whatsapp
-
-import (
-	"fmt"
-	"github.com/Rhymen/go-whatsapp/binary"
-	"github.com/Rhymen/go-whatsapp/binary/proto"
-	"os"
-)
-
-/*
-The Handler interface is the minimal interface that needs to be implemented
-to be accepted as a valid handler for our dispatching system.
-The minimal handler is used to dispatch error messages. These errors occur on unexpected behavior by the websocket
-connection or if we are unable to handle or interpret an incoming message. Error produced by user actions are not
-dispatched through this handler. They are returned as an error on the specific function call.
-*/
-type Handler interface {
-	HandleError(err error)
-}
-
-/*
-The TextMessageHandler interface needs to be implemented to receive text messages dispatched by the dispatcher.
-*/
-type TextMessageHandler interface {
-	Handler
-	HandleTextMessage(message TextMessage)
-}
-
-/*
-The ImageMessageHandler interface needs to be implemented to receive image messages dispatched by the dispatcher.
-*/
-type ImageMessageHandler interface {
-	Handler
-	HandleImageMessage(message ImageMessage)
-}
-
-/*
-The VideoMessageHandler interface needs to be implemented to receive video messages dispatched by the dispatcher.
-*/
-type VideoMessageHandler interface {
-	Handler
-	HandleVideoMessage(message VideoMessage)
-}
-
-/*
-The AudioMessageHandler interface needs to be implemented to receive audio messages dispatched by the dispatcher.
-*/
-type AudioMessageHandler interface {
-	Handler
-	HandleAudioMessage(message AudioMessage)
-}
-
-/*
-The DocumentMessageHandler interface needs to be implemented to receive document messages dispatched by the dispatcher.
-*/
-type DocumentMessageHandler interface {
-	Handler
-	HandleDocumentMessage(message DocumentMessage)
-}
-
-/*
-The JsonMessageHandler interface needs to be implemented to receive json messages dispatched by the dispatcher.
-These json messages contain status updates of every kind sent by WhatsAppWeb servers. WhatsAppWeb uses these messages
-to built a Store, which is used to save these "secondary" information. These messages may contain
-presence (available, last see) information, or just the battery status of your phone.
-*/
-type JsonMessageHandler interface {
-	Handler
-	HandleJsonMessage(message string)
-}
-
-/**
-The RawMessageHandler interface needs to be implemented to receive raw messages dispatched by the dispatcher.
-Raw messages are the raw protobuf structs instead of the easy-to-use structs in TextMessageHandler, ImageMessageHandler, etc..
-*/
-type RawMessageHandler interface {
-	Handler
-	HandleRawMessage(message *proto.WebMessageInfo)
-}
-
-/*
-AddHandler adds an handler to the list of handler that receive dispatched messages.
-The provided handler must at least implement the Handler interface. Additionally implemented
-handlers(TextMessageHandler, ImageMessageHandler) are optional. At runtime it is checked if they are implemented
-and they are called if so and needed.
-*/
-func (wac *Conn) AddHandler(handler Handler) {
-	wac.handler = append(wac.handler, handler)
-}
-
-func (wac *Conn) handle(message interface{}) {
-	switch m := message.(type) {
-	case error:
-		for _, h := range wac.handler {
-			go h.HandleError(m)
-		}
-	case string:
-		for _, h := range wac.handler {
-			if x, ok := h.(JsonMessageHandler); ok {
-				go x.HandleJsonMessage(m)
-			}
-		}
-	case TextMessage:
-		for _, h := range wac.handler {
-			if x, ok := h.(TextMessageHandler); ok {
-				go x.HandleTextMessage(m)
-			}
-		}
-	case ImageMessage:
-		for _, h := range wac.handler {
-			if x, ok := h.(ImageMessageHandler); ok {
-				go x.HandleImageMessage(m)
-			}
-		}
-	case VideoMessage:
-		for _, h := range wac.handler {
-			if x, ok := h.(VideoMessageHandler); ok {
-				go x.HandleVideoMessage(m)
-			}
-		}
-	case AudioMessage:
-		for _, h := range wac.handler {
-			if x, ok := h.(AudioMessageHandler); ok {
-				go x.HandleAudioMessage(m)
-			}
-		}
-	case DocumentMessage:
-		for _, h := range wac.handler {
-			if x, ok := h.(DocumentMessageHandler); ok {
-				go x.HandleDocumentMessage(m)
-			}
-		}
-	case *proto.WebMessageInfo:
-		for _, h := range wac.handler {
-			if x, ok := h.(RawMessageHandler); ok {
-				go x.HandleRawMessage(m)
-			}
-		}
-	}
-
-}
-
-func (wac *Conn) dispatch(msg interface{}) {
-	if msg == nil {
-		return
-	}
-
-	switch message := msg.(type) {
-	case *binary.Node:
-		if message.Description == "action" {
-			if con, ok := message.Content.([]interface{}); ok {
-				for a := range con {
-					if v, ok := con[a].(*proto.WebMessageInfo); ok {
-						wac.handle(v)
-						wac.handle(parseProtoMessage(v))
-					}
-				}
-			}
-		} else if message.Description == "response" && message.Attributes["type"] == "contacts" {
-			wac.updateContacts(message.Content)
-		}
-	case error:
-		wac.handle(message)
-	case string:
-		wac.handle(message)
-	default:
-		fmt.Fprintf(os.Stderr, "unknown type in dipatcher chan: %T", msg)
-	}
-}

+ 0 - 199
vendor/github.com/Rhymen/go-whatsapp/media.go

@@ -1,199 +0,0 @@
-package whatsapp
-
-import (
-	"bytes"
-	"crypto/hmac"
-	"crypto/rand"
-	"crypto/sha256"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"github.com/Rhymen/go-whatsapp/crypto/cbc"
-	"github.com/Rhymen/go-whatsapp/crypto/hkdf"
-	"io"
-	"io/ioutil"
-	"mime/multipart"
-	"net/http"
-	"os"
-	"strings"
-	"time"
-)
-
-func Download(url string, mediaKey []byte, appInfo MediaType, fileLength int) ([]byte, error) {
-	if url == "" {
-		return nil, fmt.Errorf("no url present")
-	}
-	file, mac, err := downloadMedia(url)
-	if err != nil {
-		return nil, err
-	}
-	iv, cipherKey, macKey, _, err := getMediaKeys(mediaKey, appInfo)
-	if err != nil {
-		return nil, err
-	}
-	if err = validateMedia(iv, file, macKey, mac); err != nil {
-		return nil, err
-	}
-	data, err := cbc.Decrypt(cipherKey, iv, file)
-	if err != nil {
-		return nil, err
-	}
-	if len(data) != fileLength {
-		return nil, fmt.Errorf("file length does not match")
-	}
-	return data, nil
-}
-
-func validateMedia(iv []byte, file []byte, macKey []byte, mac []byte) error {
-	h := hmac.New(sha256.New, macKey)
-	n, err := h.Write(append(iv, file...))
-	if err != nil {
-		return err
-	}
-	if n < 10 {
-		return fmt.Errorf("hash to short")
-	}
-	if !hmac.Equal(h.Sum(nil)[:10], mac) {
-		return fmt.Errorf("invalid media hmac")
-	}
-	return nil
-}
-
-func getMediaKeys(mediaKey []byte, appInfo MediaType) (iv, cipherKey, macKey, refKey []byte, err error) {
-	mediaKeyExpanded, err := hkdf.Expand(mediaKey, 112, string(appInfo))
-	if err != nil {
-		return nil, nil, nil, nil, err
-	}
-	return mediaKeyExpanded[:16], mediaKeyExpanded[16:48], mediaKeyExpanded[48:80], mediaKeyExpanded[80:], nil
-}
-
-func downloadMedia(url string) (file []byte, mac []byte, err error) {
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, nil, err
-	}
-	if resp.StatusCode != 200 {
-		return nil, nil, fmt.Errorf("download failed")
-	}
-	defer resp.Body.Close()
-	if resp.ContentLength <= 10 {
-		return nil, nil, fmt.Errorf("file to short")
-	}
-	data, err := ioutil.ReadAll(resp.Body)
-	n := len(data)
-	if err != nil {
-		return nil, nil, err
-	}
-	return data[:n-10], data[n-10 : n], nil
-}
-
-func (wac *Conn) Upload(reader io.Reader, appInfo MediaType) (url string, mediaKey []byte, fileEncSha256 []byte, fileSha256 []byte, fileLength uint64, err error) {
-	data, err := ioutil.ReadAll(reader)
-	if err != nil {
-		return "", nil, nil, nil, 0, err
-	}
-
-	mediaKey = make([]byte, 32)
-	rand.Read(mediaKey)
-
-	iv, cipherKey, macKey, _, err := getMediaKeys(mediaKey, appInfo)
-	if err != nil {
-		return "", nil, nil, nil, 0, err
-	}
-
-	enc, err := cbc.Encrypt(cipherKey, iv, data)
-	if err != nil {
-		return "", nil, nil, nil, 0, err
-	}
-
-	fileLength = uint64(len(data))
-
-	h := hmac.New(sha256.New, macKey)
-	h.Write(append(iv, enc...))
-	mac := h.Sum(nil)[:10]
-
-	sha := sha256.New()
-	sha.Write(data)
-	fileSha256 = sha.Sum(nil)
-
-	sha.Reset()
-	sha.Write(append(enc, mac...))
-	fileEncSha256 = sha.Sum(nil)
-
-	var filetype string
-	switch appInfo {
-	case MediaImage:
-		filetype = "image"
-	case MediaAudio:
-		filetype = "audio"
-	case MediaDocument:
-		filetype = "document"
-	case MediaVideo:
-		filetype = "video"
-	}
-
-	uploadReq := []interface{}{"action", "encr_upload", filetype, base64.StdEncoding.EncodeToString(fileEncSha256)}
-	ch, err := wac.write(uploadReq)
-	if err != nil {
-		return "", nil, nil, nil, 0, err
-	}
-
-	var resp map[string]interface{}
-	select {
-	case r := <-ch:
-		if err = json.Unmarshal([]byte(r), &resp); err != nil {
-			return "", nil, nil, nil, 0, fmt.Errorf("error decoding upload response: %v\n", err)
-		}
-	case <-time.After(wac.msgTimeout):
-		return "", nil, nil, nil, 0, fmt.Errorf("restore session init timed out")
-	}
-
-	if int(resp["status"].(float64)) != 200 {
-		return "", nil, nil, nil, 0, fmt.Errorf("upload responsed with %d", resp["status"])
-	}
-
-	var b bytes.Buffer
-	w := multipart.NewWriter(&b)
-	hashWriter, err := w.CreateFormField("hash")
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "%v\n", err)
-	}
-	io.Copy(hashWriter, strings.NewReader(base64.StdEncoding.EncodeToString(fileEncSha256)))
-
-	fileWriter, err := w.CreateFormFile("file", "blob")
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "%v\n", err)
-	}
-	io.Copy(fileWriter, bytes.NewReader(append(enc, mac...)))
-	err = w.Close()
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "%v\n", err)
-	}
-
-	req, err := http.NewRequest("POST", resp["url"].(string), &b)
-	if err != nil {
-		return "", nil, nil, nil, 0, err
-	}
-
-	req.Header.Set("Content-Type", w.FormDataContentType())
-	req.Header.Set("Origin", "https://web.whatsapp.com")
-	req.Header.Set("Referer", "https://web.whatsapp.com/")
-
-	req.URL.Query().Set("f", "j")
-
-	client := &http.Client{}
-	// Submit the request
-	res, err := client.Do(req)
-	if err != nil {
-		return "", nil, nil, nil, 0, err
-	}
-
-	if res.StatusCode != http.StatusOK {
-		return "", nil, nil, nil, 0, fmt.Errorf("upload failed with status code %d", res.StatusCode)
-	}
-
-	var jsonRes map[string]string
-	json.NewDecoder(res.Body).Decode(&jsonRes)
-
-	return jsonRes["url"], mediaKey, fileEncSha256, fileSha256, fileLength, nil
-}

+ 0 - 442
vendor/github.com/Rhymen/go-whatsapp/message.go

@@ -1,442 +0,0 @@
-package whatsapp
-
-import (
-	"encoding/hex"
-	"encoding/json"
-	"fmt"
-	"github.com/Rhymen/go-whatsapp/binary"
-	"github.com/Rhymen/go-whatsapp/binary/proto"
-	"io"
-	"math/rand"
-	"strconv"
-	"strings"
-	"time"
-)
-
-type MediaType string
-
-const (
-	MediaImage    MediaType = "WhatsApp Image Keys"
-	MediaVideo    MediaType = "WhatsApp Video Keys"
-	MediaAudio    MediaType = "WhatsApp Audio Keys"
-	MediaDocument MediaType = "WhatsApp Document Keys"
-)
-
-func (wac *Conn) Send(msg interface{}) error {
-	var err error
-	var ch <-chan string
-
-	switch m := msg.(type) {
-	case *proto.WebMessageInfo:
-		ch, err = wac.sendProto(m)
-	case TextMessage:
-		ch, err = wac.sendProto(getTextProto(m))
-	case ImageMessage:
-		m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaImage)
-		if err != nil {
-			return fmt.Errorf("image upload failed: %v", err)
-		}
-		ch, err = wac.sendProto(getImageProto(m))
-	case VideoMessage:
-		m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaVideo)
-		if err != nil {
-			return fmt.Errorf("video upload failed: %v", err)
-		}
-		ch, err = wac.sendProto(getVideoProto(m))
-	case DocumentMessage:
-		m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaDocument)
-		if err != nil {
-			return fmt.Errorf("document upload failed: %v", err)
-		}
-		ch, err = wac.sendProto(getDocumentProto(m))
-	case AudioMessage:
-		m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaAudio)
-		if err != nil {
-			return fmt.Errorf("audio upload failed: %v", err)
-		}
-		ch, err = wac.sendProto(getAudioProto(m))
-	default:
-		return fmt.Errorf("cannot match type %T, use message types declared in the package", msg)
-	}
-
-	if err != nil {
-		return fmt.Errorf("could not send proto: %v", err)
-	}
-
-	select {
-	case response := <-ch:
-		var resp map[string]interface{}
-		if err = json.Unmarshal([]byte(response), &resp); err != nil {
-			return fmt.Errorf("error decoding sending response: %v\n", err)
-		}
-		if int(resp["status"].(float64)) != 200 {
-			return fmt.Errorf("message sending responded with %d", resp["status"])
-		}
-	case <-time.After(wac.msgTimeout):
-		return fmt.Errorf("sending message timed out")
-	}
-
-	return nil
-}
-
-func (wac *Conn) sendProto(p *proto.WebMessageInfo) (<-chan string, error) {
-	n := binary.Node{
-		Description: "action",
-		Attributes: map[string]string{
-			"type":  "relay",
-			"epoch": strconv.Itoa(wac.msgCount),
-		},
-		Content: []interface{}{p},
-	}
-	return wac.writeBinary(n, message, ignore, p.Key.GetId())
-}
-
-func init() {
-	rand.Seed(time.Now().UTC().UnixNano())
-}
-
-/*
-MessageInfo contains general message information. It is part of every of every message type.
-*/
-type MessageInfo struct {
-	Id              string
-	RemoteJid       string
-	SenderJid       string
-	FromMe          bool
-	Timestamp       uint64
-	PushName        string
-	Status          MessageStatus
-	QuotedMessageID string
-
-	Source *proto.WebMessageInfo
-}
-
-type MessageStatus int
-
-const (
-	Error       MessageStatus = 0
-	Pending                   = 1
-	ServerAck                 = 2
-	DeliveryAck               = 3
-	Read                      = 4
-	Played                    = 5
-)
-
-func getMessageInfo(msg *proto.WebMessageInfo) MessageInfo {
-	return MessageInfo{
-		Id:        msg.GetKey().GetId(),
-		RemoteJid: msg.GetKey().GetRemoteJid(),
-		SenderJid: msg.GetKey().GetParticipant(),
-		FromMe:    msg.GetKey().GetFromMe(),
-		Timestamp: msg.GetMessageTimestamp(),
-		Status:    MessageStatus(msg.GetStatus()),
-		PushName:  msg.GetPushName(),
-		Source:    msg,
-	}
-}
-
-func getInfoProto(info *MessageInfo) *proto.WebMessageInfo {
-	if info.Id == "" || len(info.Id) < 2 {
-		b := make([]byte, 10)
-		rand.Read(b)
-		info.Id = strings.ToUpper(hex.EncodeToString(b))
-	}
-	if info.Timestamp == 0 {
-		info.Timestamp = uint64(time.Now().Unix())
-	}
-	info.FromMe = true
-
-	status := proto.WebMessageInfo_STATUS(info.Status)
-
-	return &proto.WebMessageInfo{
-		Key: &proto.MessageKey{
-			FromMe:    &info.FromMe,
-			RemoteJid: &info.RemoteJid,
-			Id:        &info.Id,
-		},
-		MessageTimestamp: &info.Timestamp,
-		Status:           &status,
-	}
-}
-
-/*
-TextMessage represents a text message.
-*/
-type TextMessage struct {
-	Info MessageInfo
-	Text string
-}
-
-func getTextMessage(msg *proto.WebMessageInfo) TextMessage {
-	text := TextMessage{Info: getMessageInfo(msg)}
-	if m := msg.GetMessage().GetExtendedTextMessage(); m != nil {
-		text.Text = m.GetText()
-		text.Info.QuotedMessageID = m.GetContextInfo().GetStanzaId()
-	} else {
-		text.Text = msg.GetMessage().GetConversation()
-	}
-	return text
-}
-
-func getTextProto(msg TextMessage) *proto.WebMessageInfo {
-	p := getInfoProto(&msg.Info)
-	p.Message = &proto.Message{
-		Conversation: &msg.Text,
-	}
-	return p
-}
-
-/*
-ImageMessage represents a image message. Unexported fields are needed for media up/downloading and media validation.
-Provide a io.Reader as Content for message sending.
-*/
-type ImageMessage struct {
-	Info          MessageInfo
-	Caption       string
-	Thumbnail     []byte
-	Type          string
-	Content       io.Reader
-	url           string
-	mediaKey      []byte
-	fileEncSha256 []byte
-	fileSha256    []byte
-	fileLength    uint64
-}
-
-func getImageMessage(msg *proto.WebMessageInfo) ImageMessage {
-	image := msg.GetMessage().GetImageMessage()
-	return ImageMessage{
-		Info:          getMessageInfo(msg),
-		Caption:       image.GetCaption(),
-		Thumbnail:     image.GetJpegThumbnail(),
-		url:           image.GetUrl(),
-		mediaKey:      image.GetMediaKey(),
-		Type:          image.GetMimetype(),
-		fileEncSha256: image.GetFileEncSha256(),
-		fileSha256:    image.GetFileSha256(),
-		fileLength:    image.GetFileLength(),
-	}
-}
-
-func getImageProto(msg ImageMessage) *proto.WebMessageInfo {
-	p := getInfoProto(&msg.Info)
-	p.Message = &proto.Message{
-		ImageMessage: &proto.ImageMessage{
-			Caption:       &msg.Caption,
-			JpegThumbnail: msg.Thumbnail,
-			Url:           &msg.url,
-			MediaKey:      msg.mediaKey,
-			Mimetype:      &msg.Type,
-			FileEncSha256: msg.fileEncSha256,
-			FileSha256:    msg.fileSha256,
-			FileLength:    &msg.fileLength,
-		},
-	}
-	return p
-}
-
-/*
-Download is the function to retrieve media data. The media gets downloaded, validated and returned.
-*/
-func (m *ImageMessage) Download() ([]byte, error) {
-	return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength))
-}
-
-/*
-VideoMessage represents a video message. Unexported fields are needed for media up/downloading and media validation.
-Provide a io.Reader as Content for message sending.
-*/
-type VideoMessage struct {
-	Info          MessageInfo
-	Caption       string
-	Thumbnail     []byte
-	Length        uint32
-	Type          string
-	Content       io.Reader
-	url           string
-	mediaKey      []byte
-	fileEncSha256 []byte
-	fileSha256    []byte
-	fileLength    uint64
-}
-
-func getVideoMessage(msg *proto.WebMessageInfo) VideoMessage {
-	vid := msg.GetMessage().GetVideoMessage()
-	return VideoMessage{
-		Info:          getMessageInfo(msg),
-		Caption:       vid.GetCaption(),
-		Thumbnail:     vid.GetJpegThumbnail(),
-		url:           vid.GetUrl(),
-		mediaKey:      vid.GetMediaKey(),
-		Length:        vid.GetSeconds(),
-		Type:          vid.GetMimetype(),
-		fileEncSha256: vid.GetFileEncSha256(),
-		fileSha256:    vid.GetFileSha256(),
-		fileLength:    vid.GetFileLength(),
-	}
-}
-
-func getVideoProto(msg VideoMessage) *proto.WebMessageInfo {
-	p := getInfoProto(&msg.Info)
-	p.Message = &proto.Message{
-		VideoMessage: &proto.VideoMessage{
-			Caption:       &msg.Caption,
-			JpegThumbnail: msg.Thumbnail,
-			Url:           &msg.url,
-			MediaKey:      msg.mediaKey,
-			Seconds:       &msg.Length,
-			FileEncSha256: msg.fileEncSha256,
-			FileSha256:    msg.fileSha256,
-			FileLength:    &msg.fileLength,
-			Mimetype:      &msg.Type,
-		},
-	}
-	return p
-}
-
-/*
-Download is the function to retrieve media data. The media gets downloaded, validated and returned.
-*/
-func (m *VideoMessage) Download() ([]byte, error) {
-	return Download(m.url, m.mediaKey, MediaVideo, int(m.fileLength))
-}
-
-/*
-AudioMessage represents a audio message. Unexported fields are needed for media up/downloading and media validation.
-Provide a io.Reader as Content for message sending.
-*/
-type AudioMessage struct {
-	Info          MessageInfo
-	Length        uint32
-	Type          string
-	Content       io.Reader
-	url           string
-	mediaKey      []byte
-	fileEncSha256 []byte
-	fileSha256    []byte
-	fileLength    uint64
-}
-
-func getAudioMessage(msg *proto.WebMessageInfo) AudioMessage {
-	aud := msg.GetMessage().GetAudioMessage()
-	return AudioMessage{
-		Info:          getMessageInfo(msg),
-		url:           aud.GetUrl(),
-		mediaKey:      aud.GetMediaKey(),
-		Length:        aud.GetSeconds(),
-		Type:          aud.GetMimetype(),
-		fileEncSha256: aud.GetFileEncSha256(),
-		fileSha256:    aud.GetFileSha256(),
-		fileLength:    aud.GetFileLength(),
-	}
-}
-
-func getAudioProto(msg AudioMessage) *proto.WebMessageInfo {
-	p := getInfoProto(&msg.Info)
-	p.Message = &proto.Message{
-		AudioMessage: &proto.AudioMessage{
-			Url:           &msg.url,
-			MediaKey:      msg.mediaKey,
-			Seconds:       &msg.Length,
-			FileEncSha256: msg.fileEncSha256,
-			FileSha256:    msg.fileSha256,
-			FileLength:    &msg.fileLength,
-			Mimetype:      &msg.Type,
-		},
-	}
-	return p
-}
-
-/*
-Download is the function to retrieve media data. The media gets downloaded, validated and returned.
-*/
-func (m *AudioMessage) Download() ([]byte, error) {
-	return Download(m.url, m.mediaKey, MediaAudio, int(m.fileLength))
-}
-
-/*
-DocumentMessage represents a document message. Unexported fields are needed for media up/downloading and media
-validation. Provide a io.Reader as Content for message sending.
-*/
-type DocumentMessage struct {
-	Info          MessageInfo
-	Title         string
-	PageCount     uint32
-	Type          string
-	Thumbnail     []byte
-	Content       io.Reader
-	url           string
-	mediaKey      []byte
-	fileEncSha256 []byte
-	fileSha256    []byte
-	fileLength    uint64
-}
-
-func getDocumentMessage(msg *proto.WebMessageInfo) DocumentMessage {
-	doc := msg.GetMessage().GetDocumentMessage()
-	return DocumentMessage{
-		Info:          getMessageInfo(msg),
-		Thumbnail:     doc.GetJpegThumbnail(),
-		url:           doc.GetUrl(),
-		mediaKey:      doc.GetMediaKey(),
-		fileEncSha256: doc.GetFileEncSha256(),
-		fileSha256:    doc.GetFileSha256(),
-		fileLength:    doc.GetFileLength(),
-		PageCount:     doc.GetPageCount(),
-		Title:         doc.GetTitle(),
-		Type:          doc.GetMimetype(),
-	}
-}
-
-func getDocumentProto(msg DocumentMessage) *proto.WebMessageInfo {
-	p := getInfoProto(&msg.Info)
-	p.Message = &proto.Message{
-		DocumentMessage: &proto.DocumentMessage{
-			JpegThumbnail: msg.Thumbnail,
-			Url:           &msg.url,
-			MediaKey:      msg.mediaKey,
-			FileEncSha256: msg.fileEncSha256,
-			FileSha256:    msg.fileSha256,
-			FileLength:    &msg.fileLength,
-			PageCount:     &msg.PageCount,
-			Title:         &msg.Title,
-			Mimetype:      &msg.Type,
-		},
-	}
-	return p
-}
-
-/*
-Download is the function to retrieve media data. The media gets downloaded, validated and returned.
-*/
-func (m *DocumentMessage) Download() ([]byte, error) {
-	return Download(m.url, m.mediaKey, MediaDocument, int(m.fileLength))
-}
-
-func parseProtoMessage(msg *proto.WebMessageInfo) interface{} {
-	switch {
-
-	case msg.GetMessage().GetAudioMessage() != nil:
-		return getAudioMessage(msg)
-
-	case msg.GetMessage().GetImageMessage() != nil:
-		return getImageMessage(msg)
-
-	case msg.GetMessage().GetVideoMessage() != nil:
-		return getVideoMessage(msg)
-
-	case msg.GetMessage().GetDocumentMessage() != nil:
-		return getDocumentMessage(msg)
-
-	case msg.GetMessage().GetConversation() != "":
-		return getTextMessage(msg)
-
-	case msg.GetMessage().GetExtendedTextMessage() != nil:
-		return getTextMessage(msg)
-
-	default:
-		//cannot match message
-	}
-
-	return nil
-}

+ 0 - 389
vendor/github.com/Rhymen/go-whatsapp/session.go

@@ -1,389 +0,0 @@
-package whatsapp
-
-import (
-	"crypto/hmac"
-	"crypto/rand"
-	"crypto/sha256"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"time"
-
-	"github.com/Rhymen/go-whatsapp/crypto/cbc"
-	"github.com/Rhymen/go-whatsapp/crypto/curve25519"
-	"github.com/Rhymen/go-whatsapp/crypto/hkdf"
-)
-
-/*
-Session contains session individual information. To be able to resume the connection without scanning the qr code
-every time you should save the Session returned by Login and use RestoreSession the next time you want to login.
-Every successful created connection returns a new Session. The Session(ClientToken, ServerToken) is altered after
-every re-login and should be saved every time.
-*/
-type Session struct {
-	ClientId    string
-	ClientToken string
-	ServerToken string
-	EncKey      []byte
-	MacKey      []byte
-	Wid         string
-}
-
-type Info struct {
-	Battery   int
-	Platform  string
-	Connected bool
-	Pushname  string
-	Wid       string
-	Lc        string
-	Phone     *PhoneInfo
-	Plugged   bool
-	Tos       int
-	Lg        string
-	Is24h     bool
-}
-
-type PhoneInfo struct {
-	Mcc                string
-	Mnc                string
-	OsVersion          string
-	DeviceManufacturer string
-	DeviceModel        string
-	OsBuildNumber      string
-	WaVersion          string
-}
-
-func newInfoFromReq(info map[string]interface{}) *Info {
-	phoneInfo := info["phone"].(map[string]interface{})
-
-	ret := &Info{
-		Battery:   int(info["battery"].(float64)),
-		Platform:  info["platform"].(string),
-		Connected: info["connected"].(bool),
-		Pushname:  info["pushname"].(string),
-		Wid:       info["wid"].(string),
-		Lc:        info["lc"].(string),
-		Phone: &PhoneInfo{
-			phoneInfo["mcc"].(string),
-			phoneInfo["mnc"].(string),
-			phoneInfo["os_version"].(string),
-			phoneInfo["device_manufacturer"].(string),
-			phoneInfo["device_model"].(string),
-			phoneInfo["os_build_number"].(string),
-			phoneInfo["wa_version"].(string),
-		},
-		Plugged: info["plugged"].(bool),
-		Lg:      info["lg"].(string),
-		Tos:     int(info["tos"].(float64)),
-	}
-
-	if is24h, ok := info["is24h"]; ok {
-		ret.Is24h = is24h.(bool)
-	}
-
-	return ret
-}
-
-/*
-SetClientName sets the long and short client names that are sent to WhatsApp when logging in and displayed in the
-WhatsApp Web device list. As the values are only sent when logging in, changing them after logging in is not possible.
-*/
-func (wac *Conn) SetClientName(long, short string) error {
-	if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) {
-		return fmt.Errorf("cannot change client name after logging in")
-	}
-	wac.longClientName, wac.shortClientName = long, short
-	return nil
-}
-
-/*
-Login is the function that creates a new whatsapp session and logs you in. If you do not want to scan the qr code
-every time, you should save the returned session and use RestoreSession the next time. Login takes a writable channel
-as an parameter. This channel is used to push the data represented by the qr code back to the user. The received data
-should be displayed as an qr code in a way you prefer. To print a qr code to console you can use:
-github.com/Baozisoftware/qrcode-terminal-go Example login procedure:
-	wac, err := whatsapp.NewConn(5 * time.Second)
-	if err != nil {
-		panic(err)
-	}
-
-	qr := make(chan string)
-	go func() {
-		terminal := qrcodeTerminal.New()
-		terminal.Get(<-qr).Print()
-	}()
-
-	session, err := wac.Login(qr)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "error during login: %v\n", err)
-	}
-	fmt.Printf("login successful, session: %v\n", session)
-*/
-func (wac *Conn) Login(qrChan chan<- string) (Session, error) {
-	session := Session{}
-
-	if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) {
-		return session, fmt.Errorf("already logged in")
-	}
-
-	clientId := make([]byte, 16)
-	_, err := rand.Read(clientId)
-	if err != nil {
-		return session, fmt.Errorf("error creating random ClientId: %v", err)
-	}
-
-	session.ClientId = base64.StdEncoding.EncodeToString(clientId)
-	//oldVersion=8691
-	login := []interface{}{"admin", "init", []int{0, 3, 225}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true}
-	loginChan, err := wac.write(login)
-	if err != nil {
-		return session, fmt.Errorf("error writing login: %v\n", err)
-	}
-
-	var r string
-	select {
-	case r = <-loginChan:
-	case <-time.After(wac.msgTimeout):
-		return session, fmt.Errorf("login connection timed out")
-	}
-
-	var resp map[string]interface{}
-	if err = json.Unmarshal([]byte(r), &resp); err != nil {
-		return session, fmt.Errorf("error decoding login resp: %v\n", err)
-	}
-
-	ref := resp["ref"].(string)
-
-	priv, pub, err := curve25519.GenerateKey()
-	if err != nil {
-		return session, fmt.Errorf("error generating keys: %v\n", err)
-	}
-
-	//listener for Login response
-	messageTag := "s1"
-	wac.listener[messageTag] = make(chan string, 1)
-
-	qrChan <- fmt.Sprintf("%v,%v,%v", ref, base64.StdEncoding.EncodeToString(pub[:]), session.ClientId)
-
-	var resp2 []interface{}
-	select {
-	case r1 := <-wac.listener[messageTag]:
-		if err := json.Unmarshal([]byte(r1), &resp2); err != nil {
-			return session, fmt.Errorf("error decoding qr code resp: %v", err)
-		}
-	case <-time.After(time.Duration(resp["ttl"].(float64)) * time.Millisecond):
-		return session, fmt.Errorf("qr code scan timed out")
-	}
-
-	info := resp2[1].(map[string]interface{})
-
-	wac.Info = newInfoFromReq(info)
-
-	session.ClientToken = info["clientToken"].(string)
-	session.ServerToken = info["serverToken"].(string)
-	session.Wid = info["wid"].(string)
-	s := info["secret"].(string)
-	decodedSecret, err := base64.StdEncoding.DecodeString(s)
-	if err != nil {
-		return session, fmt.Errorf("error decoding secret: %v", err)
-	}
-
-	var pubKey [32]byte
-	copy(pubKey[:], decodedSecret[:32])
-
-	sharedSecret := curve25519.GenerateSharedSecret(*priv, pubKey)
-
-	hash := sha256.New
-
-	nullKey := make([]byte, 32)
-	h := hmac.New(hash, nullKey)
-	h.Write(sharedSecret)
-
-	sharedSecretExtended, err := hkdf.Expand(h.Sum(nil), 80, "")
-	if err != nil {
-		return session, fmt.Errorf("hkdf error: %v", err)
-	}
-
-	//login validation
-	checkSecret := make([]byte, 112)
-	copy(checkSecret[:32], decodedSecret[:32])
-	copy(checkSecret[32:], decodedSecret[64:])
-	h2 := hmac.New(hash, sharedSecretExtended[32:64])
-	h2.Write(checkSecret)
-	if !hmac.Equal(h2.Sum(nil), decodedSecret[32:64]) {
-		return session, fmt.Errorf("abort login")
-	}
-
-	keysEncrypted := make([]byte, 96)
-	copy(keysEncrypted[:16], sharedSecretExtended[64:])
-	copy(keysEncrypted[16:], decodedSecret[64:])
-
-	keyDecrypted, err := cbc.Decrypt(sharedSecretExtended[:32], nil, keysEncrypted)
-	if err != nil {
-		return session, fmt.Errorf("error decryptAes: %v", err)
-	}
-
-	session.EncKey = keyDecrypted[:32]
-	session.MacKey = keyDecrypted[32:64]
-	wac.session = &session
-
-	return session, nil
-}
-
-/*
-RestoreSession is the function that restores a given session. It will try to reestablish the connection to the
-WhatsAppWeb servers with the provided session. If it succeeds it will return a new session. This new session has to be
-saved because the Client and Server-Token will change after every login. Logging in with old tokens is possible, but not
-suggested. If so, a challenge has to be resolved which is just another possible point of failure.
-*/
-func (wac *Conn) RestoreSession(session Session) (Session, error) {
-	if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) {
-		return Session{}, fmt.Errorf("already logged in")
-	}
-
-	wac.session = &session
-
-	//listener for Conn or challenge; s1 is not allowed to drop
-	wac.listener["s1"] = make(chan string, 1)
-
-	//admin init
-	init := []interface{}{"admin", "init", []int{0, 3, 225}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true}
-	initChan, err := wac.write(init)
-	if err != nil {
-		wac.session = nil
-		return Session{}, fmt.Errorf("error writing admin init: %v\n", err)
-	}
-
-	//admin login with takeover
-	login := []interface{}{"admin", "login", session.ClientToken, session.ServerToken, session.ClientId, "takeover"}
-	loginChan, err := wac.write(login)
-	if err != nil {
-		wac.session = nil
-		return Session{}, fmt.Errorf("error writing admin login: %v\n", err)
-	}
-
-	select {
-	case r := <-initChan:
-		var resp map[string]interface{}
-		if err = json.Unmarshal([]byte(r), &resp); err != nil {
-			wac.session = nil
-			return Session{}, fmt.Errorf("error decoding login connResp: %v\n", err)
-		}
-
-		if int(resp["status"].(float64)) != 200 {
-			wac.session = nil
-			return Session{}, fmt.Errorf("init responded with %d", resp["status"])
-		}
-	case <-time.After(wac.msgTimeout):
-		wac.session = nil
-		return Session{}, fmt.Errorf("restore session init timed out")
-	}
-
-	//wait for s1
-	var connResp []interface{}
-	select {
-	case r1 := <-wac.listener["s1"]:
-		if err := json.Unmarshal([]byte(r1), &connResp); err != nil {
-			wac.session = nil
-			return Session{}, fmt.Errorf("error decoding s1 message: %v\n", err)
-		}
-	case <-time.After(wac.msgTimeout):
-		wac.session = nil
-		return Session{}, fmt.Errorf("restore session connection timed out")
-	}
-
-	//check if challenge is present
-	if len(connResp) == 2 && connResp[0] == "Cmd" && connResp[1].(map[string]interface{})["type"] == "challenge" {
-		wac.listener["s2"] = make(chan string, 1)
-
-		if err := wac.resolveChallenge(connResp[1].(map[string]interface{})["challenge"].(string)); err != nil {
-			wac.session = nil
-			return Session{}, fmt.Errorf("error resolving challenge: %v\n", err)
-		}
-
-		select {
-		case r := <-wac.listener["s2"]:
-			if err := json.Unmarshal([]byte(r), &connResp); err != nil {
-				wac.session = nil
-				return Session{}, fmt.Errorf("error decoding s2 message: %v\n", err)
-			}
-		case <-time.After(wac.msgTimeout):
-			wac.session = nil
-			return Session{}, fmt.Errorf("restore session challenge timed out")
-		}
-	}
-
-	//check for login 200 --> login success
-	select {
-	case r := <-loginChan:
-		var resp map[string]interface{}
-		if err = json.Unmarshal([]byte(r), &resp); err != nil {
-			wac.session = nil
-			return Session{}, fmt.Errorf("error decoding login connResp: %v\n", err)
-		}
-
-		if int(resp["status"].(float64)) != 200 {
-			wac.session = nil
-			return Session{}, fmt.Errorf("admin login responded with %d", resp["status"])
-		}
-	case <-time.After(wac.msgTimeout):
-		wac.session = nil
-		return Session{}, fmt.Errorf("restore session login timed out")
-	}
-
-	info := connResp[1].(map[string]interface{})
-
-	wac.Info = newInfoFromReq(info)
-
-	//set new tokens
-	session.ClientToken = info["clientToken"].(string)
-	session.ServerToken = info["serverToken"].(string)
-	session.Wid = info["wid"].(string)
-
-	return *wac.session, nil
-}
-
-func (wac *Conn) resolveChallenge(challenge string) error {
-	decoded, err := base64.StdEncoding.DecodeString(challenge)
-	if err != nil {
-		return err
-	}
-
-	h2 := hmac.New(sha256.New, wac.session.MacKey)
-	h2.Write([]byte(decoded))
-
-	ch := []interface{}{"admin", "challenge", base64.StdEncoding.EncodeToString(h2.Sum(nil)), wac.session.ServerToken, wac.session.ClientId}
-	challengeChan, err := wac.write(ch)
-	if err != nil {
-		return fmt.Errorf("error writing challenge: %v\n", err)
-	}
-
-	select {
-	case r := <-challengeChan:
-		var resp map[string]interface{}
-		if err := json.Unmarshal([]byte(r), &resp); err != nil {
-			return fmt.Errorf("error decoding login resp: %v\n", err)
-		}
-		if int(resp["status"].(float64)) != 200 {
-			return fmt.Errorf("challenge responded with %d\n", resp["status"])
-		}
-	case <-time.After(wac.msgTimeout):
-		return fmt.Errorf("connection timed out")
-	}
-
-	return nil
-}
-
-/*
-Logout is the function to logout from a WhatsApp session. Logging out means invalidating the current session.
-The session can not be resumed and will disappear on your phone in the WhatsAppWeb client list.
-*/
-func (wac *Conn) Logout() error {
-	login := []interface{}{"admin", "Conn", "disconnect"}
-	_, err := wac.write(login)
-	if err != nil {
-		return fmt.Errorf("error writing logout: %v\n", err)
-	}
-
-	return nil
-}

+ 0 - 45
vendor/github.com/Rhymen/go-whatsapp/store.go

@@ -1,45 +0,0 @@
-package whatsapp
-
-import (
-	"github.com/Rhymen/go-whatsapp/binary"
-	"strings"
-)
-
-type Store struct {
-	Contacts map[string]Contact
-}
-
-type Contact struct {
-	Jid    string
-	Notify string
-	Name   string
-	Short  string
-}
-
-func newStore() *Store {
-	return &Store{
-		make(map[string]Contact),
-	}
-}
-
-func (wac *Conn) updateContacts(contacts interface{}) {
-	c, ok := contacts.([]interface{})
-	if !ok {
-		return
-	}
-
-	for _, contact := range c {
-		contactNode, ok := contact.(binary.Node)
-		if !ok {
-			continue
-		}
-
-		jid := strings.Replace(contactNode.Attributes["jid"], "@c.us", "@s.whatsapp.net", 1)
-		wac.Store.Contacts[jid] = Contact{
-			jid,
-			contactNode.Attributes["notify"],
-			contactNode.Attributes["name"],
-			contactNode.Attributes["short"],
-		}
-	}
-}

+ 0 - 5
vendor/github.com/fatih/color/.travis.yml

@@ -1,5 +0,0 @@
-language: go
-go: 
- - 1.8.x
- - tip
-

+ 0 - 27
vendor/github.com/fatih/color/Gopkg.lock

@@ -1,27 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
-  name = "github.com/mattn/go-colorable"
-  packages = ["."]
-  revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
-  version = "v0.0.9"
-
-[[projects]]
-  name = "github.com/mattn/go-isatty"
-  packages = ["."]
-  revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
-  version = "v0.0.3"
-
-[[projects]]
-  branch = "master"
-  name = "golang.org/x/sys"
-  packages = ["unix"]
-  revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd"
-
-[solve-meta]
-  analyzer-name = "dep"
-  analyzer-version = 1
-  inputs-digest = "e8a50671c3cb93ea935bf210b1cd20702876b9d9226129be581ef646d1565cdc"
-  solver-name = "gps-cdcl"
-  solver-version = 1

+ 0 - 30
vendor/github.com/fatih/color/Gopkg.toml

@@ -1,30 +0,0 @@
-
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-#   name = "github.com/user/project"
-#   version = "1.0.0"
-#
-# [[constraint]]
-#   name = "github.com/user/project2"
-#   branch = "dev"
-#   source = "github.com/myfork/project2"
-#
-# [[override]]
-#  name = "github.com/x/y"
-#  version = "2.4.0"
-
-
-[[constraint]]
-  name = "github.com/mattn/go-colorable"
-  version = "0.0.9"
-
-[[constraint]]
-  name = "github.com/mattn/go-isatty"
-  version = "0.0.3"

+ 0 - 20
vendor/github.com/fatih/color/LICENSE.md

@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Fatih Arslan
-
-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.

+ 0 - 179
vendor/github.com/fatih/color/README.md

@@ -1,179 +0,0 @@
-# Color [![GoDoc](https://godoc.org/github.com/fatih/color?status.svg)](https://godoc.org/github.com/fatih/color) [![Build Status](https://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color)
-
-
-
-Color lets you use colorized outputs in terms of [ANSI Escape
-Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It
-has support for Windows too! The API can be used in several ways, pick one that
-suits you.
-
-
-![Color](https://i.imgur.com/c1JI0lA.png)
-
-
-## Install
-
-```bash
-go get github.com/fatih/color
-```
-
-Note that the `vendor` folder is here for stability. Remove the folder if you
-already have the dependencies in your GOPATH.
-
-## Examples
-
-### Standard colors
-
-```go
-// Print with default helper functions
-color.Cyan("Prints text in cyan.")
-
-// A newline will be appended automatically
-color.Blue("Prints %s in blue.", "text")
-
-// These are using the default foreground colors
-color.Red("We have red")
-color.Magenta("And many others ..")
-
-```
-
-### Mix and reuse colors
-
-```go
-// Create a new color object
-c := color.New(color.FgCyan).Add(color.Underline)
-c.Println("Prints cyan text with an underline.")
-
-// Or just add them to New()
-d := color.New(color.FgCyan, color.Bold)
-d.Printf("This prints bold cyan %s\n", "too!.")
-
-// Mix up foreground and background colors, create new mixes!
-red := color.New(color.FgRed)
-
-boldRed := red.Add(color.Bold)
-boldRed.Println("This will print text in bold red.")
-
-whiteBackground := red.Add(color.BgWhite)
-whiteBackground.Println("Red text with white background.")
-```
-
-### Use your own output (io.Writer)
-
-```go
-// Use your own io.Writer output
-color.New(color.FgBlue).Fprintln(myWriter, "blue color!")
-
-blue := color.New(color.FgBlue)
-blue.Fprint(writer, "This will print text in blue.")
-```
-
-### Custom print functions (PrintFunc)
-
-```go
-// Create a custom print function for convenience
-red := color.New(color.FgRed).PrintfFunc()
-red("Warning")
-red("Error: %s", err)
-
-// Mix up multiple attributes
-notice := color.New(color.Bold, color.FgGreen).PrintlnFunc()
-notice("Don't forget this...")
-```
-
-### Custom fprint functions (FprintFunc)
-
-```go
-blue := color.New(FgBlue).FprintfFunc()
-blue(myWriter, "important notice: %s", stars)
-
-// Mix up with multiple attributes
-success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
-success(myWriter, "Don't forget this...")
-```
-
-### Insert into noncolor strings (SprintFunc)
-
-```go
-// Create SprintXxx functions to mix strings with other non-colorized strings:
-yellow := color.New(color.FgYellow).SprintFunc()
-red := color.New(color.FgRed).SprintFunc()
-fmt.Printf("This is a %s and this is %s.\n", yellow("warning"), red("error"))
-
-info := color.New(color.FgWhite, color.BgGreen).SprintFunc()
-fmt.Printf("This %s rocks!\n", info("package"))
-
-// Use helper functions
-fmt.Println("This", color.RedString("warning"), "should be not neglected.")
-fmt.Printf("%v %v\n", color.GreenString("Info:"), "an important message.")
-
-// Windows supported too! Just don't forget to change the output to color.Output
-fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS"))
-```
-
-### Plug into existing code
-
-```go
-// Use handy standard colors
-color.Set(color.FgYellow)
-
-fmt.Println("Existing text will now be in yellow")
-fmt.Printf("This one %s\n", "too")
-
-color.Unset() // Don't forget to unset
-
-// You can mix up parameters
-color.Set(color.FgMagenta, color.Bold)
-defer color.Unset() // Use it in your function
-
-fmt.Println("All text will now be bold magenta.")
-```
-
-### Disable/Enable color
- 
-There might be a case where you want to explicitly disable/enable color output. the 
-`go-isatty` package will automatically disable color output for non-tty output streams 
-(for example if the output were piped directly to `less`)
-
-`Color` has support to disable/enable colors both globally and for single color 
-definitions. For example suppose you have a CLI app and a `--no-color` bool flag. You 
-can easily disable the color output with:
-
-```go
-
-var flagNoColor = flag.Bool("no-color", false, "Disable color output")
-
-if *flagNoColor {
-	color.NoColor = true // disables colorized output
-}
-```
-
-It also has support for single color definitions (local). You can
-disable/enable color output on the fly:
-
-```go
-c := color.New(color.FgCyan)
-c.Println("Prints cyan text")
-
-c.DisableColor()
-c.Println("This is printed without any color")
-
-c.EnableColor()
-c.Println("This prints again cyan...")
-```
-
-## Todo
-
-* Save/Return previous values
-* Evaluate fmt.Formatter interface
-
-
-## Credits
-
- * [Fatih Arslan](https://github.com/fatih)
- * Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable)
-
-## License
-
-The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details
-

+ 0 - 603
vendor/github.com/fatih/color/color.go

@@ -1,603 +0,0 @@
-package color
-
-import (
-	"fmt"
-	"io"
-	"os"
-	"strconv"
-	"strings"
-	"sync"
-
-	"github.com/mattn/go-colorable"
-	"github.com/mattn/go-isatty"
-)
-
-var (
-	// NoColor defines if the output is colorized or not. It's dynamically set to
-	// false or true based on the stdout's file descriptor referring to a terminal
-	// or not. This is a global option and affects all colors. For more control
-	// over each color block use the methods DisableColor() individually.
-	NoColor = os.Getenv("TERM") == "dumb" ||
-		(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
-
-	// Output defines the standard output of the print functions. By default
-	// os.Stdout is used.
-	Output = colorable.NewColorableStdout()
-
-	// Error defines a color supporting writer for os.Stderr.
-	Error = colorable.NewColorableStderr()
-
-	// colorsCache is used to reduce the count of created Color objects and
-	// allows to reuse already created objects with required Attribute.
-	colorsCache   = make(map[Attribute]*Color)
-	colorsCacheMu sync.Mutex // protects colorsCache
-)
-
-// Color defines a custom color object which is defined by SGR parameters.
-type Color struct {
-	params  []Attribute
-	noColor *bool
-}
-
-// Attribute defines a single SGR Code
-type Attribute int
-
-const escape = "\x1b"
-
-// Base attributes
-const (
-	Reset Attribute = iota
-	Bold
-	Faint
-	Italic
-	Underline
-	BlinkSlow
-	BlinkRapid
-	ReverseVideo
-	Concealed
-	CrossedOut
-)
-
-// Foreground text colors
-const (
-	FgBlack Attribute = iota + 30
-	FgRed
-	FgGreen
-	FgYellow
-	FgBlue
-	FgMagenta
-	FgCyan
-	FgWhite
-)
-
-// Foreground Hi-Intensity text colors
-const (
-	FgHiBlack Attribute = iota + 90
-	FgHiRed
-	FgHiGreen
-	FgHiYellow
-	FgHiBlue
-	FgHiMagenta
-	FgHiCyan
-	FgHiWhite
-)
-
-// Background text colors
-const (
-	BgBlack Attribute = iota + 40
-	BgRed
-	BgGreen
-	BgYellow
-	BgBlue
-	BgMagenta
-	BgCyan
-	BgWhite
-)
-
-// Background Hi-Intensity text colors
-const (
-	BgHiBlack Attribute = iota + 100
-	BgHiRed
-	BgHiGreen
-	BgHiYellow
-	BgHiBlue
-	BgHiMagenta
-	BgHiCyan
-	BgHiWhite
-)
-
-// New returns a newly created color object.
-func New(value ...Attribute) *Color {
-	c := &Color{params: make([]Attribute, 0)}
-	c.Add(value...)
-	return c
-}
-
-// Set sets the given parameters immediately. It will change the color of
-// output with the given SGR parameters until color.Unset() is called.
-func Set(p ...Attribute) *Color {
-	c := New(p...)
-	c.Set()
-	return c
-}
-
-// Unset resets all escape attributes and clears the output. Usually should
-// be called after Set().
-func Unset() {
-	if NoColor {
-		return
-	}
-
-	fmt.Fprintf(Output, "%s[%dm", escape, Reset)
-}
-
-// Set sets the SGR sequence.
-func (c *Color) Set() *Color {
-	if c.isNoColorSet() {
-		return c
-	}
-
-	fmt.Fprintf(Output, c.format())
-	return c
-}
-
-func (c *Color) unset() {
-	if c.isNoColorSet() {
-		return
-	}
-
-	Unset()
-}
-
-func (c *Color) setWriter(w io.Writer) *Color {
-	if c.isNoColorSet() {
-		return c
-	}
-
-	fmt.Fprintf(w, c.format())
-	return c
-}
-
-func (c *Color) unsetWriter(w io.Writer) {
-	if c.isNoColorSet() {
-		return
-	}
-
-	if NoColor {
-		return
-	}
-
-	fmt.Fprintf(w, "%s[%dm", escape, Reset)
-}
-
-// Add is used to chain SGR parameters. Use as many as parameters to combine
-// and create custom color objects. Example: Add(color.FgRed, color.Underline).
-func (c *Color) Add(value ...Attribute) *Color {
-	c.params = append(c.params, value...)
-	return c
-}
-
-func (c *Color) prepend(value Attribute) {
-	c.params = append(c.params, 0)
-	copy(c.params[1:], c.params[0:])
-	c.params[0] = value
-}
-
-// Fprint formats using the default formats for its operands and writes to w.
-// Spaces are added between operands when neither is a string.
-// It returns the number of bytes written and any write error encountered.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
-	c.setWriter(w)
-	defer c.unsetWriter(w)
-
-	return fmt.Fprint(w, a...)
-}
-
-// Print formats using the default formats for its operands and writes to
-// standard output. Spaces are added between operands when neither is a
-// string. It returns the number of bytes written and any write error
-// encountered. This is the standard fmt.Print() method wrapped with the given
-// color.
-func (c *Color) Print(a ...interface{}) (n int, err error) {
-	c.Set()
-	defer c.unset()
-
-	return fmt.Fprint(Output, a...)
-}
-
-// Fprintf formats according to a format specifier and writes to w.
-// It returns the number of bytes written and any write error encountered.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
-	c.setWriter(w)
-	defer c.unsetWriter(w)
-
-	return fmt.Fprintf(w, format, a...)
-}
-
-// Printf formats according to a format specifier and writes to standard output.
-// It returns the number of bytes written and any write error encountered.
-// This is the standard fmt.Printf() method wrapped with the given color.
-func (c *Color) Printf(format string, a ...interface{}) (n int, err error) {
-	c.Set()
-	defer c.unset()
-
-	return fmt.Fprintf(Output, format, a...)
-}
-
-// Fprintln formats using the default formats for its operands and writes to w.
-// Spaces are always added between operands and a newline is appended.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
-	c.setWriter(w)
-	defer c.unsetWriter(w)
-
-	return fmt.Fprintln(w, a...)
-}
-
-// Println formats using the default formats for its operands and writes to
-// standard output. Spaces are always added between operands and a newline is
-// appended. It returns the number of bytes written and any write error
-// encountered. This is the standard fmt.Print() method wrapped with the given
-// color.
-func (c *Color) Println(a ...interface{}) (n int, err error) {
-	c.Set()
-	defer c.unset()
-
-	return fmt.Fprintln(Output, a...)
-}
-
-// Sprint is just like Print, but returns a string instead of printing it.
-func (c *Color) Sprint(a ...interface{}) string {
-	return c.wrap(fmt.Sprint(a...))
-}
-
-// Sprintln is just like Println, but returns a string instead of printing it.
-func (c *Color) Sprintln(a ...interface{}) string {
-	return c.wrap(fmt.Sprintln(a...))
-}
-
-// Sprintf is just like Printf, but returns a string instead of printing it.
-func (c *Color) Sprintf(format string, a ...interface{}) string {
-	return c.wrap(fmt.Sprintf(format, a...))
-}
-
-// FprintFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprint().
-func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) {
-	return func(w io.Writer, a ...interface{}) {
-		c.Fprint(w, a...)
-	}
-}
-
-// PrintFunc returns a new function that prints the passed arguments as
-// colorized with color.Print().
-func (c *Color) PrintFunc() func(a ...interface{}) {
-	return func(a ...interface{}) {
-		c.Print(a...)
-	}
-}
-
-// FprintfFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprintf().
-func (c *Color) FprintfFunc() func(w io.Writer, format string, a ...interface{}) {
-	return func(w io.Writer, format string, a ...interface{}) {
-		c.Fprintf(w, format, a...)
-	}
-}
-
-// PrintfFunc returns a new function that prints the passed arguments as
-// colorized with color.Printf().
-func (c *Color) PrintfFunc() func(format string, a ...interface{}) {
-	return func(format string, a ...interface{}) {
-		c.Printf(format, a...)
-	}
-}
-
-// FprintlnFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprintln().
-func (c *Color) FprintlnFunc() func(w io.Writer, a ...interface{}) {
-	return func(w io.Writer, a ...interface{}) {
-		c.Fprintln(w, a...)
-	}
-}
-
-// PrintlnFunc returns a new function that prints the passed arguments as
-// colorized with color.Println().
-func (c *Color) PrintlnFunc() func(a ...interface{}) {
-	return func(a ...interface{}) {
-		c.Println(a...)
-	}
-}
-
-// SprintFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprint(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output, example:
-//
-//	put := New(FgYellow).SprintFunc()
-//	fmt.Fprintf(color.Output, "This is a %s", put("warning"))
-func (c *Color) SprintFunc() func(a ...interface{}) string {
-	return func(a ...interface{}) string {
-		return c.wrap(fmt.Sprint(a...))
-	}
-}
-
-// SprintfFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprintf(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output.
-func (c *Color) SprintfFunc() func(format string, a ...interface{}) string {
-	return func(format string, a ...interface{}) string {
-		return c.wrap(fmt.Sprintf(format, a...))
-	}
-}
-
-// SprintlnFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprintln(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output.
-func (c *Color) SprintlnFunc() func(a ...interface{}) string {
-	return func(a ...interface{}) string {
-		return c.wrap(fmt.Sprintln(a...))
-	}
-}
-
-// sequence returns a formatted SGR sequence to be plugged into a "\x1b[...m"
-// an example output might be: "1;36" -> bold cyan
-func (c *Color) sequence() string {
-	format := make([]string, len(c.params))
-	for i, v := range c.params {
-		format[i] = strconv.Itoa(int(v))
-	}
-
-	return strings.Join(format, ";")
-}
-
-// wrap wraps the s string with the colors attributes. The string is ready to
-// be printed.
-func (c *Color) wrap(s string) string {
-	if c.isNoColorSet() {
-		return s
-	}
-
-	return c.format() + s + c.unformat()
-}
-
-func (c *Color) format() string {
-	return fmt.Sprintf("%s[%sm", escape, c.sequence())
-}
-
-func (c *Color) unformat() string {
-	return fmt.Sprintf("%s[%dm", escape, Reset)
-}
-
-// DisableColor disables the color output. Useful to not change any existing
-// code and still being able to output. Can be used for flags like
-// "--no-color". To enable back use EnableColor() method.
-func (c *Color) DisableColor() {
-	c.noColor = boolPtr(true)
-}
-
-// EnableColor enables the color output. Use it in conjunction with
-// DisableColor(). Otherwise this method has no side effects.
-func (c *Color) EnableColor() {
-	c.noColor = boolPtr(false)
-}
-
-func (c *Color) isNoColorSet() bool {
-	// check first if we have user setted action
-	if c.noColor != nil {
-		return *c.noColor
-	}
-
-	// if not return the global option, which is disabled by default
-	return NoColor
-}
-
-// Equals returns a boolean value indicating whether two colors are equal.
-func (c *Color) Equals(c2 *Color) bool {
-	if len(c.params) != len(c2.params) {
-		return false
-	}
-
-	for _, attr := range c.params {
-		if !c2.attrExists(attr) {
-			return false
-		}
-	}
-
-	return true
-}
-
-func (c *Color) attrExists(a Attribute) bool {
-	for _, attr := range c.params {
-		if attr == a {
-			return true
-		}
-	}
-
-	return false
-}
-
-func boolPtr(v bool) *bool {
-	return &v
-}
-
-func getCachedColor(p Attribute) *Color {
-	colorsCacheMu.Lock()
-	defer colorsCacheMu.Unlock()
-
-	c, ok := colorsCache[p]
-	if !ok {
-		c = New(p)
-		colorsCache[p] = c
-	}
-
-	return c
-}
-
-func colorPrint(format string, p Attribute, a ...interface{}) {
-	c := getCachedColor(p)
-
-	if !strings.HasSuffix(format, "\n") {
-		format += "\n"
-	}
-
-	if len(a) == 0 {
-		c.Print(format)
-	} else {
-		c.Printf(format, a...)
-	}
-}
-
-func colorString(format string, p Attribute, a ...interface{}) string {
-	c := getCachedColor(p)
-
-	if len(a) == 0 {
-		return c.SprintFunc()(format)
-	}
-
-	return c.SprintfFunc()(format, a...)
-}
-
-// Black is a convenient helper function to print with black foreground. A
-// newline is appended to format by default.
-func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) }
-
-// Red is a convenient helper function to print with red foreground. A
-// newline is appended to format by default.
-func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) }
-
-// Green is a convenient helper function to print with green foreground. A
-// newline is appended to format by default.
-func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) }
-
-// Yellow is a convenient helper function to print with yellow foreground.
-// A newline is appended to format by default.
-func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) }
-
-// Blue is a convenient helper function to print with blue foreground. A
-// newline is appended to format by default.
-func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) }
-
-// Magenta is a convenient helper function to print with magenta foreground.
-// A newline is appended to format by default.
-func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) }
-
-// Cyan is a convenient helper function to print with cyan foreground. A
-// newline is appended to format by default.
-func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) }
-
-// White is a convenient helper function to print with white foreground. A
-// newline is appended to format by default.
-func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) }
-
-// BlackString is a convenient helper function to return a string with black
-// foreground.
-func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) }
-
-// RedString is a convenient helper function to return a string with red
-// foreground.
-func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) }
-
-// GreenString is a convenient helper function to return a string with green
-// foreground.
-func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) }
-
-// YellowString is a convenient helper function to return a string with yellow
-// foreground.
-func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) }
-
-// BlueString is a convenient helper function to return a string with blue
-// foreground.
-func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) }
-
-// MagentaString is a convenient helper function to return a string with magenta
-// foreground.
-func MagentaString(format string, a ...interface{}) string {
-	return colorString(format, FgMagenta, a...)
-}
-
-// CyanString is a convenient helper function to return a string with cyan
-// foreground.
-func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) }
-
-// WhiteString is a convenient helper function to return a string with white
-// foreground.
-func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) }
-
-// HiBlack is a convenient helper function to print with hi-intensity black foreground. A
-// newline is appended to format by default.
-func HiBlack(format string, a ...interface{}) { colorPrint(format, FgHiBlack, a...) }
-
-// HiRed is a convenient helper function to print with hi-intensity red foreground. A
-// newline is appended to format by default.
-func HiRed(format string, a ...interface{}) { colorPrint(format, FgHiRed, a...) }
-
-// HiGreen is a convenient helper function to print with hi-intensity green foreground. A
-// newline is appended to format by default.
-func HiGreen(format string, a ...interface{}) { colorPrint(format, FgHiGreen, a...) }
-
-// HiYellow is a convenient helper function to print with hi-intensity yellow foreground.
-// A newline is appended to format by default.
-func HiYellow(format string, a ...interface{}) { colorPrint(format, FgHiYellow, a...) }
-
-// HiBlue is a convenient helper function to print with hi-intensity blue foreground. A
-// newline is appended to format by default.
-func HiBlue(format string, a ...interface{}) { colorPrint(format, FgHiBlue, a...) }
-
-// HiMagenta is a convenient helper function to print with hi-intensity magenta foreground.
-// A newline is appended to format by default.
-func HiMagenta(format string, a ...interface{}) { colorPrint(format, FgHiMagenta, a...) }
-
-// HiCyan is a convenient helper function to print with hi-intensity cyan foreground. A
-// newline is appended to format by default.
-func HiCyan(format string, a ...interface{}) { colorPrint(format, FgHiCyan, a...) }
-
-// HiWhite is a convenient helper function to print with hi-intensity white foreground. A
-// newline is appended to format by default.
-func HiWhite(format string, a ...interface{}) { colorPrint(format, FgHiWhite, a...) }
-
-// HiBlackString is a convenient helper function to return a string with hi-intensity black
-// foreground.
-func HiBlackString(format string, a ...interface{}) string {
-	return colorString(format, FgHiBlack, a...)
-}
-
-// HiRedString is a convenient helper function to return a string with hi-intensity red
-// foreground.
-func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) }
-
-// HiGreenString is a convenient helper function to return a string with hi-intensity green
-// foreground.
-func HiGreenString(format string, a ...interface{}) string {
-	return colorString(format, FgHiGreen, a...)
-}
-
-// HiYellowString is a convenient helper function to return a string with hi-intensity yellow
-// foreground.
-func HiYellowString(format string, a ...interface{}) string {
-	return colorString(format, FgHiYellow, a...)
-}
-
-// HiBlueString is a convenient helper function to return a string with hi-intensity blue
-// foreground.
-func HiBlueString(format string, a ...interface{}) string { return colorString(format, FgHiBlue, a...) }
-
-// HiMagentaString is a convenient helper function to return a string with hi-intensity magenta
-// foreground.
-func HiMagentaString(format string, a ...interface{}) string {
-	return colorString(format, FgHiMagenta, a...)
-}
-
-// HiCyanString is a convenient helper function to return a string with hi-intensity cyan
-// foreground.
-func HiCyanString(format string, a ...interface{}) string { return colorString(format, FgHiCyan, a...) }
-
-// HiWhiteString is a convenient helper function to return a string with hi-intensity white
-// foreground.
-func HiWhiteString(format string, a ...interface{}) string {
-	return colorString(format, FgHiWhite, a...)
-}

+ 0 - 133
vendor/github.com/fatih/color/doc.go

@@ -1,133 +0,0 @@
-/*
-Package color is an ANSI color package to output colorized or SGR defined
-output to the standard output. The API can be used in several way, pick one
-that suits you.
-
-Use simple and default helper functions with predefined foreground colors:
-
-    color.Cyan("Prints text in cyan.")
-
-    // a newline will be appended automatically
-    color.Blue("Prints %s in blue.", "text")
-
-    // More default foreground colors..
-    color.Red("We have red")
-    color.Yellow("Yellow color too!")
-    color.Magenta("And many others ..")
-
-    // Hi-intensity colors
-    color.HiGreen("Bright green color.")
-    color.HiBlack("Bright black means gray..")
-    color.HiWhite("Shiny white color!")
-
-However there are times where custom color mixes are required. Below are some
-examples to create custom color objects and use the print functions of each
-separate color object.
-
-    // Create a new color object
-    c := color.New(color.FgCyan).Add(color.Underline)
-    c.Println("Prints cyan text with an underline.")
-
-    // Or just add them to New()
-    d := color.New(color.FgCyan, color.Bold)
-    d.Printf("This prints bold cyan %s\n", "too!.")
-
-
-    // Mix up foreground and background colors, create new mixes!
-    red := color.New(color.FgRed)
-
-    boldRed := red.Add(color.Bold)
-    boldRed.Println("This will print text in bold red.")
-
-    whiteBackground := red.Add(color.BgWhite)
-    whiteBackground.Println("Red text with White background.")
-
-    // Use your own io.Writer output
-    color.New(color.FgBlue).Fprintln(myWriter, "blue color!")
-
-    blue := color.New(color.FgBlue)
-    blue.Fprint(myWriter, "This will print text in blue.")
-
-You can create PrintXxx functions to simplify even more:
-
-    // Create a custom print function for convenient
-    red := color.New(color.FgRed).PrintfFunc()
-    red("warning")
-    red("error: %s", err)
-
-    // Mix up multiple attributes
-    notice := color.New(color.Bold, color.FgGreen).PrintlnFunc()
-    notice("don't forget this...")
-
-You can also FprintXxx functions to pass your own io.Writer:
-
-    blue := color.New(FgBlue).FprintfFunc()
-    blue(myWriter, "important notice: %s", stars)
-
-    // Mix up with multiple attributes
-    success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
-    success(myWriter, don't forget this...")
-
-
-Or create SprintXxx functions to mix strings with other non-colorized strings:
-
-    yellow := New(FgYellow).SprintFunc()
-    red := New(FgRed).SprintFunc()
-
-    fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error"))
-
-    info := New(FgWhite, BgGreen).SprintFunc()
-    fmt.Printf("this %s rocks!\n", info("package"))
-
-Windows support is enabled by default. All Print functions work as intended.
-However only for color.SprintXXX functions, user should use fmt.FprintXXX and
-set the output to color.Output:
-
-    fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS"))
-
-    info := New(FgWhite, BgGreen).SprintFunc()
-    fmt.Fprintf(color.Output, "this %s rocks!\n", info("package"))
-
-Using with existing code is possible. Just use the Set() method to set the
-standard output to the given parameters. That way a rewrite of an existing
-code is not required.
-
-    // Use handy standard colors.
-    color.Set(color.FgYellow)
-
-    fmt.Println("Existing text will be now in Yellow")
-    fmt.Printf("This one %s\n", "too")
-
-    color.Unset() // don't forget to unset
-
-    // You can mix up parameters
-    color.Set(color.FgMagenta, color.Bold)
-    defer color.Unset() // use it in your function
-
-    fmt.Println("All text will be now bold magenta.")
-
-There might be a case where you want to disable color output (for example to
-pipe the standard output of your app to somewhere else). `Color` has support to
-disable colors both globally and for single color definition. For example
-suppose you have a CLI app and a `--no-color` bool flag. You can easily disable
-the color output with:
-
-    var flagNoColor = flag.Bool("no-color", false, "Disable color output")
-
-    if *flagNoColor {
-    	color.NoColor = true // disables colorized output
-    }
-
-It also has support for single color definitions (local). You can
-disable/enable color output on the fly:
-
-     c := color.New(color.FgCyan)
-     c.Println("Prints cyan text")
-
-     c.DisableColor()
-     c.Println("This is printed without any color")
-
-     c.EnableColor()
-     c.Println("This prints again cyan...")
-*/
-package color

+ 0 - 3
vendor/github.com/golang/protobuf/AUTHORS

@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.

+ 0 - 3
vendor/github.com/golang/protobuf/CONTRIBUTORS

@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.

+ 0 - 28
vendor/github.com/golang/protobuf/LICENSE

@@ -1,28 +0,0 @@
-Copyright 2010 The Go Authors.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-

+ 0 - 253
vendor/github.com/golang/protobuf/proto/clone.go

@@ -1,253 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Protocol buffer deep copy and merge.
-// TODO: RawMessage.
-
-package proto
-
-import (
-	"fmt"
-	"log"
-	"reflect"
-	"strings"
-)
-
-// Clone returns a deep copy of a protocol buffer.
-func Clone(src Message) Message {
-	in := reflect.ValueOf(src)
-	if in.IsNil() {
-		return src
-	}
-	out := reflect.New(in.Type().Elem())
-	dst := out.Interface().(Message)
-	Merge(dst, src)
-	return dst
-}
-
-// Merger is the interface representing objects that can merge messages of the same type.
-type Merger interface {
-	// Merge merges src into this message.
-	// Required and optional fields that are set in src will be set to that value in dst.
-	// Elements of repeated fields will be appended.
-	//
-	// Merge may panic if called with a different argument type than the receiver.
-	Merge(src Message)
-}
-
-// generatedMerger is the custom merge method that generated protos will have.
-// We must add this method since a generate Merge method will conflict with
-// many existing protos that have a Merge data field already defined.
-type generatedMerger interface {
-	XXX_Merge(src Message)
-}
-
-// Merge merges src into dst.
-// Required and optional fields that are set in src will be set to that value in dst.
-// Elements of repeated fields will be appended.
-// Merge panics if src and dst are not the same type, or if dst is nil.
-func Merge(dst, src Message) {
-	if m, ok := dst.(Merger); ok {
-		m.Merge(src)
-		return
-	}
-
-	in := reflect.ValueOf(src)
-	out := reflect.ValueOf(dst)
-	if out.IsNil() {
-		panic("proto: nil destination")
-	}
-	if in.Type() != out.Type() {
-		panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src))
-	}
-	if in.IsNil() {
-		return // Merge from nil src is a noop
-	}
-	if m, ok := dst.(generatedMerger); ok {
-		m.XXX_Merge(src)
-		return
-	}
-	mergeStruct(out.Elem(), in.Elem())
-}
-
-func mergeStruct(out, in reflect.Value) {
-	sprop := GetProperties(in.Type())
-	for i := 0; i < in.NumField(); i++ {
-		f := in.Type().Field(i)
-		if strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-		mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
-	}
-
-	if emIn, err := extendable(in.Addr().Interface()); err == nil {
-		emOut, _ := extendable(out.Addr().Interface())
-		mIn, muIn := emIn.extensionsRead()
-		if mIn != nil {
-			mOut := emOut.extensionsWrite()
-			muIn.Lock()
-			mergeExtension(mOut, mIn)
-			muIn.Unlock()
-		}
-	}
-
-	uf := in.FieldByName("XXX_unrecognized")
-	if !uf.IsValid() {
-		return
-	}
-	uin := uf.Bytes()
-	if len(uin) > 0 {
-		out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...))
-	}
-}
-
-// mergeAny performs a merge between two values of the same type.
-// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
-// prop is set if this is a struct field (it may be nil).
-func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
-	if in.Type() == protoMessageType {
-		if !in.IsNil() {
-			if out.IsNil() {
-				out.Set(reflect.ValueOf(Clone(in.Interface().(Message))))
-			} else {
-				Merge(out.Interface().(Message), in.Interface().(Message))
-			}
-		}
-		return
-	}
-	switch in.Kind() {
-	case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
-		reflect.String, reflect.Uint32, reflect.Uint64:
-		if !viaPtr && isProto3Zero(in) {
-			return
-		}
-		out.Set(in)
-	case reflect.Interface:
-		// Probably a oneof field; copy non-nil values.
-		if in.IsNil() {
-			return
-		}
-		// Allocate destination if it is not set, or set to a different type.
-		// Otherwise we will merge as normal.
-		if out.IsNil() || out.Elem().Type() != in.Elem().Type() {
-			out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)
-		}
-		mergeAny(out.Elem(), in.Elem(), false, nil)
-	case reflect.Map:
-		if in.Len() == 0 {
-			return
-		}
-		if out.IsNil() {
-			out.Set(reflect.MakeMap(in.Type()))
-		}
-		// For maps with value types of *T or []byte we need to deep copy each value.
-		elemKind := in.Type().Elem().Kind()
-		for _, key := range in.MapKeys() {
-			var val reflect.Value
-			switch elemKind {
-			case reflect.Ptr:
-				val = reflect.New(in.Type().Elem().Elem())
-				mergeAny(val, in.MapIndex(key), false, nil)
-			case reflect.Slice:
-				val = in.MapIndex(key)
-				val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
-			default:
-				val = in.MapIndex(key)
-			}
-			out.SetMapIndex(key, val)
-		}
-	case reflect.Ptr:
-		if in.IsNil() {
-			return
-		}
-		if out.IsNil() {
-			out.Set(reflect.New(in.Elem().Type()))
-		}
-		mergeAny(out.Elem(), in.Elem(), true, nil)
-	case reflect.Slice:
-		if in.IsNil() {
-			return
-		}
-		if in.Type().Elem().Kind() == reflect.Uint8 {
-			// []byte is a scalar bytes field, not a repeated field.
-
-			// Edge case: if this is in a proto3 message, a zero length
-			// bytes field is considered the zero value, and should not
-			// be merged.
-			if prop != nil && prop.proto3 && in.Len() == 0 {
-				return
-			}
-
-			// Make a deep copy.
-			// Append to []byte{} instead of []byte(nil) so that we never end up
-			// with a nil result.
-			out.SetBytes(append([]byte{}, in.Bytes()...))
-			return
-		}
-		n := in.Len()
-		if out.IsNil() {
-			out.Set(reflect.MakeSlice(in.Type(), 0, n))
-		}
-		switch in.Type().Elem().Kind() {
-		case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
-			reflect.String, reflect.Uint32, reflect.Uint64:
-			out.Set(reflect.AppendSlice(out, in))
-		default:
-			for i := 0; i < n; i++ {
-				x := reflect.Indirect(reflect.New(in.Type().Elem()))
-				mergeAny(x, in.Index(i), false, nil)
-				out.Set(reflect.Append(out, x))
-			}
-		}
-	case reflect.Struct:
-		mergeStruct(out, in)
-	default:
-		// unknown type, so not a protocol buffer
-		log.Printf("proto: don't know how to copy %v", in)
-	}
-}
-
-func mergeExtension(out, in map[int32]Extension) {
-	for extNum, eIn := range in {
-		eOut := Extension{desc: eIn.desc}
-		if eIn.value != nil {
-			v := reflect.New(reflect.TypeOf(eIn.value)).Elem()
-			mergeAny(v, reflect.ValueOf(eIn.value), false, nil)
-			eOut.value = v.Interface()
-		}
-		if eIn.enc != nil {
-			eOut.enc = make([]byte, len(eIn.enc))
-			copy(eOut.enc, eIn.enc)
-		}
-
-		out[extNum] = eOut
-	}
-}

+ 0 - 428
vendor/github.com/golang/protobuf/proto/decode.go

@@ -1,428 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for decoding protocol buffer data to construct in-memory representations.
- */
-
-import (
-	"errors"
-	"fmt"
-	"io"
-)
-
-// errOverflow is returned when an integer is too large to be represented.
-var errOverflow = errors.New("proto: integer overflow")
-
-// ErrInternalBadWireType is returned by generated code when an incorrect
-// wire type is encountered. It does not get returned to user code.
-var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
-
-// DecodeVarint reads a varint-encoded integer from the slice.
-// It returns the integer and the number of bytes consumed, or
-// zero if there is not enough.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func DecodeVarint(buf []byte) (x uint64, n int) {
-	for shift := uint(0); shift < 64; shift += 7 {
-		if n >= len(buf) {
-			return 0, 0
-		}
-		b := uint64(buf[n])
-		n++
-		x |= (b & 0x7F) << shift
-		if (b & 0x80) == 0 {
-			return x, n
-		}
-	}
-
-	// The number is too large to represent in a 64-bit value.
-	return 0, 0
-}
-
-func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
-	i := p.index
-	l := len(p.buf)
-
-	for shift := uint(0); shift < 64; shift += 7 {
-		if i >= l {
-			err = io.ErrUnexpectedEOF
-			return
-		}
-		b := p.buf[i]
-		i++
-		x |= (uint64(b) & 0x7F) << shift
-		if b < 0x80 {
-			p.index = i
-			return
-		}
-	}
-
-	// The number is too large to represent in a 64-bit value.
-	err = errOverflow
-	return
-}
-
-// DecodeVarint reads a varint-encoded integer from the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) DecodeVarint() (x uint64, err error) {
-	i := p.index
-	buf := p.buf
-
-	if i >= len(buf) {
-		return 0, io.ErrUnexpectedEOF
-	} else if buf[i] < 0x80 {
-		p.index++
-		return uint64(buf[i]), nil
-	} else if len(buf)-i < 10 {
-		return p.decodeVarintSlow()
-	}
-
-	var b uint64
-	// we already checked the first byte
-	x = uint64(buf[i]) - 0x80
-	i++
-
-	b = uint64(buf[i])
-	i++
-	x += b << 7
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 7
-
-	b = uint64(buf[i])
-	i++
-	x += b << 14
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 14
-
-	b = uint64(buf[i])
-	i++
-	x += b << 21
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 21
-
-	b = uint64(buf[i])
-	i++
-	x += b << 28
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 28
-
-	b = uint64(buf[i])
-	i++
-	x += b << 35
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 35
-
-	b = uint64(buf[i])
-	i++
-	x += b << 42
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 42
-
-	b = uint64(buf[i])
-	i++
-	x += b << 49
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 49
-
-	b = uint64(buf[i])
-	i++
-	x += b << 56
-	if b&0x80 == 0 {
-		goto done
-	}
-	x -= 0x80 << 56
-
-	b = uint64(buf[i])
-	i++
-	x += b << 63
-	if b&0x80 == 0 {
-		goto done
-	}
-	// x -= 0x80 << 63 // Always zero.
-
-	return 0, errOverflow
-
-done:
-	p.index = i
-	return x, nil
-}
-
-// DecodeFixed64 reads a 64-bit integer from the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) DecodeFixed64() (x uint64, err error) {
-	// x, err already 0
-	i := p.index + 8
-	if i < 0 || i > len(p.buf) {
-		err = io.ErrUnexpectedEOF
-		return
-	}
-	p.index = i
-
-	x = uint64(p.buf[i-8])
-	x |= uint64(p.buf[i-7]) << 8
-	x |= uint64(p.buf[i-6]) << 16
-	x |= uint64(p.buf[i-5]) << 24
-	x |= uint64(p.buf[i-4]) << 32
-	x |= uint64(p.buf[i-3]) << 40
-	x |= uint64(p.buf[i-2]) << 48
-	x |= uint64(p.buf[i-1]) << 56
-	return
-}
-
-// DecodeFixed32 reads a 32-bit integer from the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) DecodeFixed32() (x uint64, err error) {
-	// x, err already 0
-	i := p.index + 4
-	if i < 0 || i > len(p.buf) {
-		err = io.ErrUnexpectedEOF
-		return
-	}
-	p.index = i
-
-	x = uint64(p.buf[i-4])
-	x |= uint64(p.buf[i-3]) << 8
-	x |= uint64(p.buf[i-2]) << 16
-	x |= uint64(p.buf[i-1]) << 24
-	return
-}
-
-// DecodeZigzag64 reads a zigzag-encoded 64-bit integer
-// from the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
-	x, err = p.DecodeVarint()
-	if err != nil {
-		return
-	}
-	x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)
-	return
-}
-
-// DecodeZigzag32 reads a zigzag-encoded 32-bit integer
-// from  the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
-	x, err = p.DecodeVarint()
-	if err != nil {
-		return
-	}
-	x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
-	return
-}
-
-// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
-	n, err := p.DecodeVarint()
-	if err != nil {
-		return nil, err
-	}
-
-	nb := int(n)
-	if nb < 0 {
-		return nil, fmt.Errorf("proto: bad byte length %d", nb)
-	}
-	end := p.index + nb
-	if end < p.index || end > len(p.buf) {
-		return nil, io.ErrUnexpectedEOF
-	}
-
-	if !alloc {
-		// todo: check if can get more uses of alloc=false
-		buf = p.buf[p.index:end]
-		p.index += nb
-		return
-	}
-
-	buf = make([]byte, nb)
-	copy(buf, p.buf[p.index:])
-	p.index += nb
-	return
-}
-
-// DecodeStringBytes reads an encoded string from the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) DecodeStringBytes() (s string, err error) {
-	buf, err := p.DecodeRawBytes(false)
-	if err != nil {
-		return
-	}
-	return string(buf), nil
-}
-
-// Unmarshaler is the interface representing objects that can
-// unmarshal themselves.  The argument points to data that may be
-// overwritten, so implementations should not keep references to the
-// buffer.
-// Unmarshal implementations should not clear the receiver.
-// Any unmarshaled data should be merged into the receiver.
-// Callers of Unmarshal that do not want to retain existing data
-// should Reset the receiver before calling Unmarshal.
-type Unmarshaler interface {
-	Unmarshal([]byte) error
-}
-
-// newUnmarshaler is the interface representing objects that can
-// unmarshal themselves. The semantics are identical to Unmarshaler.
-//
-// This exists to support protoc-gen-go generated messages.
-// The proto package will stop type-asserting to this interface in the future.
-//
-// DO NOT DEPEND ON THIS.
-type newUnmarshaler interface {
-	XXX_Unmarshal([]byte) error
-}
-
-// Unmarshal parses the protocol buffer representation in buf and places the
-// decoded result in pb.  If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// Unmarshal resets pb before starting to unmarshal, so any
-// existing data in pb is always removed. Use UnmarshalMerge
-// to preserve and append to existing data.
-func Unmarshal(buf []byte, pb Message) error {
-	pb.Reset()
-	if u, ok := pb.(newUnmarshaler); ok {
-		return u.XXX_Unmarshal(buf)
-	}
-	if u, ok := pb.(Unmarshaler); ok {
-		return u.Unmarshal(buf)
-	}
-	return NewBuffer(buf).Unmarshal(pb)
-}
-
-// UnmarshalMerge parses the protocol buffer representation in buf and
-// writes the decoded result to pb.  If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// UnmarshalMerge merges into existing data in pb.
-// Most code should use Unmarshal instead.
-func UnmarshalMerge(buf []byte, pb Message) error {
-	if u, ok := pb.(newUnmarshaler); ok {
-		return u.XXX_Unmarshal(buf)
-	}
-	if u, ok := pb.(Unmarshaler); ok {
-		// NOTE: The history of proto have unfortunately been inconsistent
-		// whether Unmarshaler should or should not implicitly clear itself.
-		// Some implementations do, most do not.
-		// Thus, calling this here may or may not do what people want.
-		//
-		// See https://github.com/golang/protobuf/issues/424
-		return u.Unmarshal(buf)
-	}
-	return NewBuffer(buf).Unmarshal(pb)
-}
-
-// DecodeMessage reads a count-delimited message from the Buffer.
-func (p *Buffer) DecodeMessage(pb Message) error {
-	enc, err := p.DecodeRawBytes(false)
-	if err != nil {
-		return err
-	}
-	return NewBuffer(enc).Unmarshal(pb)
-}
-
-// DecodeGroup reads a tag-delimited group from the Buffer.
-// StartGroup tag is already consumed. This function consumes
-// EndGroup tag.
-func (p *Buffer) DecodeGroup(pb Message) error {
-	b := p.buf[p.index:]
-	x, y := findEndGroup(b)
-	if x < 0 {
-		return io.ErrUnexpectedEOF
-	}
-	err := Unmarshal(b[:x], pb)
-	p.index += y
-	return err
-}
-
-// Unmarshal parses the protocol buffer representation in the
-// Buffer and places the decoded result in pb.  If the struct
-// underlying pb does not match the data in the buffer, the results can be
-// unpredictable.
-//
-// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.
-func (p *Buffer) Unmarshal(pb Message) error {
-	// If the object can unmarshal itself, let it.
-	if u, ok := pb.(newUnmarshaler); ok {
-		err := u.XXX_Unmarshal(p.buf[p.index:])
-		p.index = len(p.buf)
-		return err
-	}
-	if u, ok := pb.(Unmarshaler); ok {
-		// NOTE: The history of proto have unfortunately been inconsistent
-		// whether Unmarshaler should or should not implicitly clear itself.
-		// Some implementations do, most do not.
-		// Thus, calling this here may or may not do what people want.
-		//
-		// See https://github.com/golang/protobuf/issues/424
-		err := u.Unmarshal(p.buf[p.index:])
-		p.index = len(p.buf)
-		return err
-	}
-
-	// Slow workaround for messages that aren't Unmarshalers.
-	// This includes some hand-coded .pb.go files and
-	// bootstrap protos.
-	// TODO: fix all of those and then add Unmarshal to
-	// the Message interface. Then:
-	// The cast above and code below can be deleted.
-	// The old unmarshaler can be deleted.
-	// Clients can call Unmarshal directly (can already do that, actually).
-	var info InternalMessageInfo
-	err := info.Unmarshal(pb, p.buf[p.index:])
-	p.index = len(p.buf)
-	return err
-}

+ 0 - 350
vendor/github.com/golang/protobuf/proto/discard.go

@@ -1,350 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2017 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
-	"fmt"
-	"reflect"
-	"strings"
-	"sync"
-	"sync/atomic"
-)
-
-type generatedDiscarder interface {
-	XXX_DiscardUnknown()
-}
-
-// DiscardUnknown recursively discards all unknown fields from this message
-// and all embedded messages.
-//
-// When unmarshaling a message with unrecognized fields, the tags and values
-// of such fields are preserved in the Message. This allows a later call to
-// marshal to be able to produce a message that continues to have those
-// unrecognized fields. To avoid this, DiscardUnknown is used to
-// explicitly clear the unknown fields after unmarshaling.
-//
-// For proto2 messages, the unknown fields of message extensions are only
-// discarded from messages that have been accessed via GetExtension.
-func DiscardUnknown(m Message) {
-	if m, ok := m.(generatedDiscarder); ok {
-		m.XXX_DiscardUnknown()
-		return
-	}
-	// TODO: Dynamically populate a InternalMessageInfo for legacy messages,
-	// but the master branch has no implementation for InternalMessageInfo,
-	// so it would be more work to replicate that approach.
-	discardLegacy(m)
-}
-
-// DiscardUnknown recursively discards all unknown fields.
-func (a *InternalMessageInfo) DiscardUnknown(m Message) {
-	di := atomicLoadDiscardInfo(&a.discard)
-	if di == nil {
-		di = getDiscardInfo(reflect.TypeOf(m).Elem())
-		atomicStoreDiscardInfo(&a.discard, di)
-	}
-	di.discard(toPointer(&m))
-}
-
-type discardInfo struct {
-	typ reflect.Type
-
-	initialized int32 // 0: only typ is valid, 1: everything is valid
-	lock        sync.Mutex
-
-	fields       []discardFieldInfo
-	unrecognized field
-}
-
-type discardFieldInfo struct {
-	field   field // Offset of field, guaranteed to be valid
-	discard func(src pointer)
-}
-
-var (
-	discardInfoMap  = map[reflect.Type]*discardInfo{}
-	discardInfoLock sync.Mutex
-)
-
-func getDiscardInfo(t reflect.Type) *discardInfo {
-	discardInfoLock.Lock()
-	defer discardInfoLock.Unlock()
-	di := discardInfoMap[t]
-	if di == nil {
-		di = &discardInfo{typ: t}
-		discardInfoMap[t] = di
-	}
-	return di
-}
-
-func (di *discardInfo) discard(src pointer) {
-	if src.isNil() {
-		return // Nothing to do.
-	}
-
-	if atomic.LoadInt32(&di.initialized) == 0 {
-		di.computeDiscardInfo()
-	}
-
-	for _, fi := range di.fields {
-		sfp := src.offset(fi.field)
-		fi.discard(sfp)
-	}
-
-	// For proto2 messages, only discard unknown fields in message extensions
-	// that have been accessed via GetExtension.
-	if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil {
-		// Ignore lock since DiscardUnknown is not concurrency safe.
-		emm, _ := em.extensionsRead()
-		for _, mx := range emm {
-			if m, ok := mx.value.(Message); ok {
-				DiscardUnknown(m)
-			}
-		}
-	}
-
-	if di.unrecognized.IsValid() {
-		*src.offset(di.unrecognized).toBytes() = nil
-	}
-}
-
-func (di *discardInfo) computeDiscardInfo() {
-	di.lock.Lock()
-	defer di.lock.Unlock()
-	if di.initialized != 0 {
-		return
-	}
-	t := di.typ
-	n := t.NumField()
-
-	for i := 0; i < n; i++ {
-		f := t.Field(i)
-		if strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-
-		dfi := discardFieldInfo{field: toField(&f)}
-		tf := f.Type
-
-		// Unwrap tf to get its most basic type.
-		var isPointer, isSlice bool
-		if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
-			isSlice = true
-			tf = tf.Elem()
-		}
-		if tf.Kind() == reflect.Ptr {
-			isPointer = true
-			tf = tf.Elem()
-		}
-		if isPointer && isSlice && tf.Kind() != reflect.Struct {
-			panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name))
-		}
-
-		switch tf.Kind() {
-		case reflect.Struct:
-			switch {
-			case !isPointer:
-				panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name))
-			case isSlice: // E.g., []*pb.T
-				di := getDiscardInfo(tf)
-				dfi.discard = func(src pointer) {
-					sps := src.getPointerSlice()
-					for _, sp := range sps {
-						if !sp.isNil() {
-							di.discard(sp)
-						}
-					}
-				}
-			default: // E.g., *pb.T
-				di := getDiscardInfo(tf)
-				dfi.discard = func(src pointer) {
-					sp := src.getPointer()
-					if !sp.isNil() {
-						di.discard(sp)
-					}
-				}
-			}
-		case reflect.Map:
-			switch {
-			case isPointer || isSlice:
-				panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name))
-			default: // E.g., map[K]V
-				if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T)
-					dfi.discard = func(src pointer) {
-						sm := src.asPointerTo(tf).Elem()
-						if sm.Len() == 0 {
-							return
-						}
-						for _, key := range sm.MapKeys() {
-							val := sm.MapIndex(key)
-							DiscardUnknown(val.Interface().(Message))
-						}
-					}
-				} else {
-					dfi.discard = func(pointer) {} // Noop
-				}
-			}
-		case reflect.Interface:
-			// Must be oneof field.
-			switch {
-			case isPointer || isSlice:
-				panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name))
-			default: // E.g., interface{}
-				// TODO: Make this faster?
-				dfi.discard = func(src pointer) {
-					su := src.asPointerTo(tf).Elem()
-					if !su.IsNil() {
-						sv := su.Elem().Elem().Field(0)
-						if sv.Kind() == reflect.Ptr && sv.IsNil() {
-							return
-						}
-						switch sv.Type().Kind() {
-						case reflect.Ptr: // Proto struct (e.g., *T)
-							DiscardUnknown(sv.Interface().(Message))
-						}
-					}
-				}
-			}
-		default:
-			continue
-		}
-		di.fields = append(di.fields, dfi)
-	}
-
-	di.unrecognized = invalidField
-	if f, ok := t.FieldByName("XXX_unrecognized"); ok {
-		if f.Type != reflect.TypeOf([]byte{}) {
-			panic("expected XXX_unrecognized to be of type []byte")
-		}
-		di.unrecognized = toField(&f)
-	}
-
-	atomic.StoreInt32(&di.initialized, 1)
-}
-
-func discardLegacy(m Message) {
-	v := reflect.ValueOf(m)
-	if v.Kind() != reflect.Ptr || v.IsNil() {
-		return
-	}
-	v = v.Elem()
-	if v.Kind() != reflect.Struct {
-		return
-	}
-	t := v.Type()
-
-	for i := 0; i < v.NumField(); i++ {
-		f := t.Field(i)
-		if strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-		vf := v.Field(i)
-		tf := f.Type
-
-		// Unwrap tf to get its most basic type.
-		var isPointer, isSlice bool
-		if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
-			isSlice = true
-			tf = tf.Elem()
-		}
-		if tf.Kind() == reflect.Ptr {
-			isPointer = true
-			tf = tf.Elem()
-		}
-		if isPointer && isSlice && tf.Kind() != reflect.Struct {
-			panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name))
-		}
-
-		switch tf.Kind() {
-		case reflect.Struct:
-			switch {
-			case !isPointer:
-				panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name))
-			case isSlice: // E.g., []*pb.T
-				for j := 0; j < vf.Len(); j++ {
-					discardLegacy(vf.Index(j).Interface().(Message))
-				}
-			default: // E.g., *pb.T
-				discardLegacy(vf.Interface().(Message))
-			}
-		case reflect.Map:
-			switch {
-			case isPointer || isSlice:
-				panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name))
-			default: // E.g., map[K]V
-				tv := vf.Type().Elem()
-				if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T)
-					for _, key := range vf.MapKeys() {
-						val := vf.MapIndex(key)
-						discardLegacy(val.Interface().(Message))
-					}
-				}
-			}
-		case reflect.Interface:
-			// Must be oneof field.
-			switch {
-			case isPointer || isSlice:
-				panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name))
-			default: // E.g., test_proto.isCommunique_Union interface
-				if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" {
-					vf = vf.Elem() // E.g., *test_proto.Communique_Msg
-					if !vf.IsNil() {
-						vf = vf.Elem()   // E.g., test_proto.Communique_Msg
-						vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value
-						if vf.Kind() == reflect.Ptr {
-							discardLegacy(vf.Interface().(Message))
-						}
-					}
-				}
-			}
-		}
-	}
-
-	if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() {
-		if vf.Type() != reflect.TypeOf([]byte{}) {
-			panic("expected XXX_unrecognized to be of type []byte")
-		}
-		vf.Set(reflect.ValueOf([]byte(nil)))
-	}
-
-	// For proto2 messages, only discard unknown fields in message extensions
-	// that have been accessed via GetExtension.
-	if em, err := extendable(m); err == nil {
-		// Ignore lock since discardLegacy is not concurrency safe.
-		emm, _ := em.extensionsRead()
-		for _, mx := range emm {
-			if m, ok := mx.value.(Message); ok {
-				discardLegacy(m)
-			}
-		}
-	}
-}

+ 0 - 203
vendor/github.com/golang/protobuf/proto/encode.go

@@ -1,203 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
-	"errors"
-	"reflect"
-)
-
-var (
-	// errRepeatedHasNil is the error returned if Marshal is called with
-	// a struct with a repeated field containing a nil element.
-	errRepeatedHasNil = errors.New("proto: repeated field has nil element")
-
-	// errOneofHasNil is the error returned if Marshal is called with
-	// a struct with a oneof field containing a nil element.
-	errOneofHasNil = errors.New("proto: oneof field has nil value")
-
-	// ErrNil is the error returned if Marshal is called with nil.
-	ErrNil = errors.New("proto: Marshal called with nil")
-
-	// ErrTooLarge is the error returned if Marshal is called with a
-	// message that encodes to >2GB.
-	ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
-)
-
-// The fundamental encoders that put bytes on the wire.
-// Those that take integer types all accept uint64 and are
-// therefore of type valueEncoder.
-
-const maxVarintBytes = 10 // maximum length of a varint
-
-// EncodeVarint returns the varint encoding of x.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-// Not used by the package itself, but helpful to clients
-// wishing to use the same encoding.
-func EncodeVarint(x uint64) []byte {
-	var buf [maxVarintBytes]byte
-	var n int
-	for n = 0; x > 127; n++ {
-		buf[n] = 0x80 | uint8(x&0x7F)
-		x >>= 7
-	}
-	buf[n] = uint8(x)
-	n++
-	return buf[0:n]
-}
-
-// EncodeVarint writes a varint-encoded integer to the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) EncodeVarint(x uint64) error {
-	for x >= 1<<7 {
-		p.buf = append(p.buf, uint8(x&0x7f|0x80))
-		x >>= 7
-	}
-	p.buf = append(p.buf, uint8(x))
-	return nil
-}
-
-// SizeVarint returns the varint encoding size of an integer.
-func SizeVarint(x uint64) int {
-	switch {
-	case x < 1<<7:
-		return 1
-	case x < 1<<14:
-		return 2
-	case x < 1<<21:
-		return 3
-	case x < 1<<28:
-		return 4
-	case x < 1<<35:
-		return 5
-	case x < 1<<42:
-		return 6
-	case x < 1<<49:
-		return 7
-	case x < 1<<56:
-		return 8
-	case x < 1<<63:
-		return 9
-	}
-	return 10
-}
-
-// EncodeFixed64 writes a 64-bit integer to the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) EncodeFixed64(x uint64) error {
-	p.buf = append(p.buf,
-		uint8(x),
-		uint8(x>>8),
-		uint8(x>>16),
-		uint8(x>>24),
-		uint8(x>>32),
-		uint8(x>>40),
-		uint8(x>>48),
-		uint8(x>>56))
-	return nil
-}
-
-// EncodeFixed32 writes a 32-bit integer to the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) EncodeFixed32(x uint64) error {
-	p.buf = append(p.buf,
-		uint8(x),
-		uint8(x>>8),
-		uint8(x>>16),
-		uint8(x>>24))
-	return nil
-}
-
-// EncodeZigzag64 writes a zigzag-encoded 64-bit integer
-// to the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) EncodeZigzag64(x uint64) error {
-	// use signed number to get arithmetic right shift.
-	return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-// EncodeZigzag32 writes a zigzag-encoded 32-bit integer
-// to the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) EncodeZigzag32(x uint64) error {
-	// use signed number to get arithmetic right shift.
-	return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) EncodeRawBytes(b []byte) error {
-	p.EncodeVarint(uint64(len(b)))
-	p.buf = append(p.buf, b...)
-	return nil
-}
-
-// EncodeStringBytes writes an encoded string to the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) EncodeStringBytes(s string) error {
-	p.EncodeVarint(uint64(len(s)))
-	p.buf = append(p.buf, s...)
-	return nil
-}
-
-// Marshaler is the interface representing objects that can marshal themselves.
-type Marshaler interface {
-	Marshal() ([]byte, error)
-}
-
-// EncodeMessage writes the protocol buffer to the Buffer,
-// prefixed by a varint-encoded length.
-func (p *Buffer) EncodeMessage(pb Message) error {
-	siz := Size(pb)
-	p.EncodeVarint(uint64(siz))
-	return p.Marshal(pb)
-}
-
-// All protocol buffer fields are nillable, but be careful.
-func isNil(v reflect.Value) bool {
-	switch v.Kind() {
-	case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
-		return v.IsNil()
-	}
-	return false
-}

+ 0 - 300
vendor/github.com/golang/protobuf/proto/equal.go

@@ -1,300 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Protocol buffer comparison.
-
-package proto
-
-import (
-	"bytes"
-	"log"
-	"reflect"
-	"strings"
-)
-
-/*
-Equal returns true iff protocol buffers a and b are equal.
-The arguments must both be pointers to protocol buffer structs.
-
-Equality is defined in this way:
-  - Two messages are equal iff they are the same type,
-    corresponding fields are equal, unknown field sets
-    are equal, and extensions sets are equal.
-  - Two set scalar fields are equal iff their values are equal.
-    If the fields are of a floating-point type, remember that
-    NaN != x for all x, including NaN. If the message is defined
-    in a proto3 .proto file, fields are not "set"; specifically,
-    zero length proto3 "bytes" fields are equal (nil == {}).
-  - Two repeated fields are equal iff their lengths are the same,
-    and their corresponding elements are equal. Note a "bytes" field,
-    although represented by []byte, is not a repeated field and the
-    rule for the scalar fields described above applies.
-  - Two unset fields are equal.
-  - Two unknown field sets are equal if their current
-    encoded state is equal.
-  - Two extension sets are equal iff they have corresponding
-    elements that are pairwise equal.
-  - Two map fields are equal iff their lengths are the same,
-    and they contain the same set of elements. Zero-length map
-    fields are equal.
-  - Every other combination of things are not equal.
-
-The return value is undefined if a and b are not protocol buffers.
-*/
-func Equal(a, b Message) bool {
-	if a == nil || b == nil {
-		return a == b
-	}
-	v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)
-	if v1.Type() != v2.Type() {
-		return false
-	}
-	if v1.Kind() == reflect.Ptr {
-		if v1.IsNil() {
-			return v2.IsNil()
-		}
-		if v2.IsNil() {
-			return false
-		}
-		v1, v2 = v1.Elem(), v2.Elem()
-	}
-	if v1.Kind() != reflect.Struct {
-		return false
-	}
-	return equalStruct(v1, v2)
-}
-
-// v1 and v2 are known to have the same type.
-func equalStruct(v1, v2 reflect.Value) bool {
-	sprop := GetProperties(v1.Type())
-	for i := 0; i < v1.NumField(); i++ {
-		f := v1.Type().Field(i)
-		if strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-		f1, f2 := v1.Field(i), v2.Field(i)
-		if f.Type.Kind() == reflect.Ptr {
-			if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {
-				// both unset
-				continue
-			} else if n1 != n2 {
-				// set/unset mismatch
-				return false
-			}
-			f1, f2 = f1.Elem(), f2.Elem()
-		}
-		if !equalAny(f1, f2, sprop.Prop[i]) {
-			return false
-		}
-	}
-
-	if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
-		em2 := v2.FieldByName("XXX_InternalExtensions")
-		if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
-			return false
-		}
-	}
-
-	if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
-		em2 := v2.FieldByName("XXX_extensions")
-		if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
-			return false
-		}
-	}
-
-	uf := v1.FieldByName("XXX_unrecognized")
-	if !uf.IsValid() {
-		return true
-	}
-
-	u1 := uf.Bytes()
-	u2 := v2.FieldByName("XXX_unrecognized").Bytes()
-	return bytes.Equal(u1, u2)
-}
-
-// v1 and v2 are known to have the same type.
-// prop may be nil.
-func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
-	if v1.Type() == protoMessageType {
-		m1, _ := v1.Interface().(Message)
-		m2, _ := v2.Interface().(Message)
-		return Equal(m1, m2)
-	}
-	switch v1.Kind() {
-	case reflect.Bool:
-		return v1.Bool() == v2.Bool()
-	case reflect.Float32, reflect.Float64:
-		return v1.Float() == v2.Float()
-	case reflect.Int32, reflect.Int64:
-		return v1.Int() == v2.Int()
-	case reflect.Interface:
-		// Probably a oneof field; compare the inner values.
-		n1, n2 := v1.IsNil(), v2.IsNil()
-		if n1 || n2 {
-			return n1 == n2
-		}
-		e1, e2 := v1.Elem(), v2.Elem()
-		if e1.Type() != e2.Type() {
-			return false
-		}
-		return equalAny(e1, e2, nil)
-	case reflect.Map:
-		if v1.Len() != v2.Len() {
-			return false
-		}
-		for _, key := range v1.MapKeys() {
-			val2 := v2.MapIndex(key)
-			if !val2.IsValid() {
-				// This key was not found in the second map.
-				return false
-			}
-			if !equalAny(v1.MapIndex(key), val2, nil) {
-				return false
-			}
-		}
-		return true
-	case reflect.Ptr:
-		// Maps may have nil values in them, so check for nil.
-		if v1.IsNil() && v2.IsNil() {
-			return true
-		}
-		if v1.IsNil() != v2.IsNil() {
-			return false
-		}
-		return equalAny(v1.Elem(), v2.Elem(), prop)
-	case reflect.Slice:
-		if v1.Type().Elem().Kind() == reflect.Uint8 {
-			// short circuit: []byte
-
-			// Edge case: if this is in a proto3 message, a zero length
-			// bytes field is considered the zero value.
-			if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
-				return true
-			}
-			if v1.IsNil() != v2.IsNil() {
-				return false
-			}
-			return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
-		}
-
-		if v1.Len() != v2.Len() {
-			return false
-		}
-		for i := 0; i < v1.Len(); i++ {
-			if !equalAny(v1.Index(i), v2.Index(i), prop) {
-				return false
-			}
-		}
-		return true
-	case reflect.String:
-		return v1.Interface().(string) == v2.Interface().(string)
-	case reflect.Struct:
-		return equalStruct(v1, v2)
-	case reflect.Uint32, reflect.Uint64:
-		return v1.Uint() == v2.Uint()
-	}
-
-	// unknown type, so not a protocol buffer
-	log.Printf("proto: don't know how to compare %v", v1)
-	return false
-}
-
-// base is the struct type that the extensions are based on.
-// x1 and x2 are InternalExtensions.
-func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
-	em1, _ := x1.extensionsRead()
-	em2, _ := x2.extensionsRead()
-	return equalExtMap(base, em1, em2)
-}
-
-func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
-	if len(em1) != len(em2) {
-		return false
-	}
-
-	for extNum, e1 := range em1 {
-		e2, ok := em2[extNum]
-		if !ok {
-			return false
-		}
-
-		m1, m2 := e1.value, e2.value
-
-		if m1 == nil && m2 == nil {
-			// Both have only encoded form.
-			if bytes.Equal(e1.enc, e2.enc) {
-				continue
-			}
-			// The bytes are different, but the extensions might still be
-			// equal. We need to decode them to compare.
-		}
-
-		if m1 != nil && m2 != nil {
-			// Both are unencoded.
-			if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
-				return false
-			}
-			continue
-		}
-
-		// At least one is encoded. To do a semantically correct comparison
-		// we need to unmarshal them first.
-		var desc *ExtensionDesc
-		if m := extensionMaps[base]; m != nil {
-			desc = m[extNum]
-		}
-		if desc == nil {
-			// If both have only encoded form and the bytes are the same,
-			// it is handled above. We get here when the bytes are different.
-			// We don't know how to decode it, so just compare them as byte
-			// slices.
-			log.Printf("proto: don't know how to compare extension %d of %v", extNum, base)
-			return false
-		}
-		var err error
-		if m1 == nil {
-			m1, err = decodeExtension(e1.enc, desc)
-		}
-		if m2 == nil && err == nil {
-			m2, err = decodeExtension(e2.enc, desc)
-		}
-		if err != nil {
-			// The encoded form is invalid.
-			log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err)
-			return false
-		}
-		if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
-			return false
-		}
-	}
-
-	return true
-}

+ 0 - 543
vendor/github.com/golang/protobuf/proto/extensions.go

@@ -1,543 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Types and routines for supporting protocol buffer extensions.
- */
-
-import (
-	"errors"
-	"fmt"
-	"io"
-	"reflect"
-	"strconv"
-	"sync"
-)
-
-// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.
-var ErrMissingExtension = errors.New("proto: missing extension")
-
-// ExtensionRange represents a range of message extensions for a protocol buffer.
-// Used in code generated by the protocol compiler.
-type ExtensionRange struct {
-	Start, End int32 // both inclusive
-}
-
-// extendableProto is an interface implemented by any protocol buffer generated by the current
-// proto compiler that may be extended.
-type extendableProto interface {
-	Message
-	ExtensionRangeArray() []ExtensionRange
-	extensionsWrite() map[int32]Extension
-	extensionsRead() (map[int32]Extension, sync.Locker)
-}
-
-// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
-// version of the proto compiler that may be extended.
-type extendableProtoV1 interface {
-	Message
-	ExtensionRangeArray() []ExtensionRange
-	ExtensionMap() map[int32]Extension
-}
-
-// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
-type extensionAdapter struct {
-	extendableProtoV1
-}
-
-func (e extensionAdapter) extensionsWrite() map[int32]Extension {
-	return e.ExtensionMap()
-}
-
-func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
-	return e.ExtensionMap(), notLocker{}
-}
-
-// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
-type notLocker struct{}
-
-func (n notLocker) Lock()   {}
-func (n notLocker) Unlock() {}
-
-// extendable returns the extendableProto interface for the given generated proto message.
-// If the proto message has the old extension format, it returns a wrapper that implements
-// the extendableProto interface.
-func extendable(p interface{}) (extendableProto, error) {
-	switch p := p.(type) {
-	case extendableProto:
-		if isNilPtr(p) {
-			return nil, fmt.Errorf("proto: nil %T is not extendable", p)
-		}
-		return p, nil
-	case extendableProtoV1:
-		if isNilPtr(p) {
-			return nil, fmt.Errorf("proto: nil %T is not extendable", p)
-		}
-		return extensionAdapter{p}, nil
-	}
-	// Don't allocate a specific error containing %T:
-	// this is the hot path for Clone and MarshalText.
-	return nil, errNotExtendable
-}
-
-var errNotExtendable = errors.New("proto: not an extendable proto.Message")
-
-func isNilPtr(x interface{}) bool {
-	v := reflect.ValueOf(x)
-	return v.Kind() == reflect.Ptr && v.IsNil()
-}
-
-// XXX_InternalExtensions is an internal representation of proto extensions.
-//
-// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
-// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
-//
-// The methods of XXX_InternalExtensions are not concurrency safe in general,
-// but calls to logically read-only methods such as has and get may be executed concurrently.
-type XXX_InternalExtensions struct {
-	// The struct must be indirect so that if a user inadvertently copies a
-	// generated message and its embedded XXX_InternalExtensions, they
-	// avoid the mayhem of a copied mutex.
-	//
-	// The mutex serializes all logically read-only operations to p.extensionMap.
-	// It is up to the client to ensure that write operations to p.extensionMap are
-	// mutually exclusive with other accesses.
-	p *struct {
-		mu           sync.Mutex
-		extensionMap map[int32]Extension
-	}
-}
-
-// extensionsWrite returns the extension map, creating it on first use.
-func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
-	if e.p == nil {
-		e.p = new(struct {
-			mu           sync.Mutex
-			extensionMap map[int32]Extension
-		})
-		e.p.extensionMap = make(map[int32]Extension)
-	}
-	return e.p.extensionMap
-}
-
-// extensionsRead returns the extensions map for read-only use.  It may be nil.
-// The caller must hold the returned mutex's lock when accessing Elements within the map.
-func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
-	if e.p == nil {
-		return nil, nil
-	}
-	return e.p.extensionMap, &e.p.mu
-}
-
-// ExtensionDesc represents an extension specification.
-// Used in generated code from the protocol compiler.
-type ExtensionDesc struct {
-	ExtendedType  Message     // nil pointer to the type that is being extended
-	ExtensionType interface{} // nil pointer to the extension type
-	Field         int32       // field number
-	Name          string      // fully-qualified name of extension, for text formatting
-	Tag           string      // protobuf tag style
-	Filename      string      // name of the file in which the extension is defined
-}
-
-func (ed *ExtensionDesc) repeated() bool {
-	t := reflect.TypeOf(ed.ExtensionType)
-	return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
-}
-
-// Extension represents an extension in a message.
-type Extension struct {
-	// When an extension is stored in a message using SetExtension
-	// only desc and value are set. When the message is marshaled
-	// enc will be set to the encoded form of the message.
-	//
-	// When a message is unmarshaled and contains extensions, each
-	// extension will have only enc set. When such an extension is
-	// accessed using GetExtension (or GetExtensions) desc and value
-	// will be set.
-	desc  *ExtensionDesc
-	value interface{}
-	enc   []byte
-}
-
-// SetRawExtension is for testing only.
-func SetRawExtension(base Message, id int32, b []byte) {
-	epb, err := extendable(base)
-	if err != nil {
-		return
-	}
-	extmap := epb.extensionsWrite()
-	extmap[id] = Extension{enc: b}
-}
-
-// isExtensionField returns true iff the given field number is in an extension range.
-func isExtensionField(pb extendableProto, field int32) bool {
-	for _, er := range pb.ExtensionRangeArray() {
-		if er.Start <= field && field <= er.End {
-			return true
-		}
-	}
-	return false
-}
-
-// checkExtensionTypes checks that the given extension is valid for pb.
-func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
-	var pbi interface{} = pb
-	// Check the extended type.
-	if ea, ok := pbi.(extensionAdapter); ok {
-		pbi = ea.extendableProtoV1
-	}
-	if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
-		return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a)
-	}
-	// Check the range.
-	if !isExtensionField(pb, extension.Field) {
-		return errors.New("proto: bad extension number; not in declared ranges")
-	}
-	return nil
-}
-
-// extPropKey is sufficient to uniquely identify an extension.
-type extPropKey struct {
-	base  reflect.Type
-	field int32
-}
-
-var extProp = struct {
-	sync.RWMutex
-	m map[extPropKey]*Properties
-}{
-	m: make(map[extPropKey]*Properties),
-}
-
-func extensionProperties(ed *ExtensionDesc) *Properties {
-	key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}
-
-	extProp.RLock()
-	if prop, ok := extProp.m[key]; ok {
-		extProp.RUnlock()
-		return prop
-	}
-	extProp.RUnlock()
-
-	extProp.Lock()
-	defer extProp.Unlock()
-	// Check again.
-	if prop, ok := extProp.m[key]; ok {
-		return prop
-	}
-
-	prop := new(Properties)
-	prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil)
-	extProp.m[key] = prop
-	return prop
-}
-
-// HasExtension returns whether the given extension is present in pb.
-func HasExtension(pb Message, extension *ExtensionDesc) bool {
-	// TODO: Check types, field numbers, etc.?
-	epb, err := extendable(pb)
-	if err != nil {
-		return false
-	}
-	extmap, mu := epb.extensionsRead()
-	if extmap == nil {
-		return false
-	}
-	mu.Lock()
-	_, ok := extmap[extension.Field]
-	mu.Unlock()
-	return ok
-}
-
-// ClearExtension removes the given extension from pb.
-func ClearExtension(pb Message, extension *ExtensionDesc) {
-	epb, err := extendable(pb)
-	if err != nil {
-		return
-	}
-	// TODO: Check types, field numbers, etc.?
-	extmap := epb.extensionsWrite()
-	delete(extmap, extension.Field)
-}
-
-// GetExtension retrieves a proto2 extended field from pb.
-//
-// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil),
-// then GetExtension parses the encoded field and returns a Go value of the specified type.
-// If the field is not present, then the default value is returned (if one is specified),
-// otherwise ErrMissingExtension is reported.
-//
-// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil),
-// then GetExtension returns the raw encoded bytes of the field extension.
-func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
-	epb, err := extendable(pb)
-	if err != nil {
-		return nil, err
-	}
-
-	if extension.ExtendedType != nil {
-		// can only check type if this is a complete descriptor
-		if err := checkExtensionTypes(epb, extension); err != nil {
-			return nil, err
-		}
-	}
-
-	emap, mu := epb.extensionsRead()
-	if emap == nil {
-		return defaultExtensionValue(extension)
-	}
-	mu.Lock()
-	defer mu.Unlock()
-	e, ok := emap[extension.Field]
-	if !ok {
-		// defaultExtensionValue returns the default value or
-		// ErrMissingExtension if there is no default.
-		return defaultExtensionValue(extension)
-	}
-
-	if e.value != nil {
-		// Already decoded. Check the descriptor, though.
-		if e.desc != extension {
-			// This shouldn't happen. If it does, it means that
-			// GetExtension was called twice with two different
-			// descriptors with the same field number.
-			return nil, errors.New("proto: descriptor conflict")
-		}
-		return e.value, nil
-	}
-
-	if extension.ExtensionType == nil {
-		// incomplete descriptor
-		return e.enc, nil
-	}
-
-	v, err := decodeExtension(e.enc, extension)
-	if err != nil {
-		return nil, err
-	}
-
-	// Remember the decoded version and drop the encoded version.
-	// That way it is safe to mutate what we return.
-	e.value = v
-	e.desc = extension
-	e.enc = nil
-	emap[extension.Field] = e
-	return e.value, nil
-}
-
-// defaultExtensionValue returns the default value for extension.
-// If no default for an extension is defined ErrMissingExtension is returned.
-func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {
-	if extension.ExtensionType == nil {
-		// incomplete descriptor, so no default
-		return nil, ErrMissingExtension
-	}
-
-	t := reflect.TypeOf(extension.ExtensionType)
-	props := extensionProperties(extension)
-
-	sf, _, err := fieldDefault(t, props)
-	if err != nil {
-		return nil, err
-	}
-
-	if sf == nil || sf.value == nil {
-		// There is no default value.
-		return nil, ErrMissingExtension
-	}
-
-	if t.Kind() != reflect.Ptr {
-		// We do not need to return a Ptr, we can directly return sf.value.
-		return sf.value, nil
-	}
-
-	// We need to return an interface{} that is a pointer to sf.value.
-	value := reflect.New(t).Elem()
-	value.Set(reflect.New(value.Type().Elem()))
-	if sf.kind == reflect.Int32 {
-		// We may have an int32 or an enum, but the underlying data is int32.
-		// Since we can't set an int32 into a non int32 reflect.value directly
-		// set it as a int32.
-		value.Elem().SetInt(int64(sf.value.(int32)))
-	} else {
-		value.Elem().Set(reflect.ValueOf(sf.value))
-	}
-	return value.Interface(), nil
-}
-
-// decodeExtension decodes an extension encoded in b.
-func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
-	t := reflect.TypeOf(extension.ExtensionType)
-	unmarshal := typeUnmarshaler(t, extension.Tag)
-
-	// t is a pointer to a struct, pointer to basic type or a slice.
-	// Allocate space to store the pointer/slice.
-	value := reflect.New(t).Elem()
-
-	var err error
-	for {
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		wire := int(x) & 7
-
-		b, err = unmarshal(b, valToPointer(value.Addr()), wire)
-		if err != nil {
-			return nil, err
-		}
-
-		if len(b) == 0 {
-			break
-		}
-	}
-	return value.Interface(), nil
-}
-
-// GetExtensions returns a slice of the extensions present in pb that are also listed in es.
-// The returned slice has the same length as es; missing extensions will appear as nil elements.
-func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
-	epb, err := extendable(pb)
-	if err != nil {
-		return nil, err
-	}
-	extensions = make([]interface{}, len(es))
-	for i, e := range es {
-		extensions[i], err = GetExtension(epb, e)
-		if err == ErrMissingExtension {
-			err = nil
-		}
-		if err != nil {
-			return
-		}
-	}
-	return
-}
-
-// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.
-// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing
-// just the Field field, which defines the extension's field number.
-func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
-	epb, err := extendable(pb)
-	if err != nil {
-		return nil, err
-	}
-	registeredExtensions := RegisteredExtensions(pb)
-
-	emap, mu := epb.extensionsRead()
-	if emap == nil {
-		return nil, nil
-	}
-	mu.Lock()
-	defer mu.Unlock()
-	extensions := make([]*ExtensionDesc, 0, len(emap))
-	for extid, e := range emap {
-		desc := e.desc
-		if desc == nil {
-			desc = registeredExtensions[extid]
-			if desc == nil {
-				desc = &ExtensionDesc{Field: extid}
-			}
-		}
-
-		extensions = append(extensions, desc)
-	}
-	return extensions, nil
-}
-
-// SetExtension sets the specified extension of pb to the specified value.
-func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
-	epb, err := extendable(pb)
-	if err != nil {
-		return err
-	}
-	if err := checkExtensionTypes(epb, extension); err != nil {
-		return err
-	}
-	typ := reflect.TypeOf(extension.ExtensionType)
-	if typ != reflect.TypeOf(value) {
-		return errors.New("proto: bad extension value type")
-	}
-	// nil extension values need to be caught early, because the
-	// encoder can't distinguish an ErrNil due to a nil extension
-	// from an ErrNil due to a missing field. Extensions are
-	// always optional, so the encoder would just swallow the error
-	// and drop all the extensions from the encoded message.
-	if reflect.ValueOf(value).IsNil() {
-		return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
-	}
-
-	extmap := epb.extensionsWrite()
-	extmap[extension.Field] = Extension{desc: extension, value: value}
-	return nil
-}
-
-// ClearAllExtensions clears all extensions from pb.
-func ClearAllExtensions(pb Message) {
-	epb, err := extendable(pb)
-	if err != nil {
-		return
-	}
-	m := epb.extensionsWrite()
-	for k := range m {
-		delete(m, k)
-	}
-}
-
-// A global registry of extensions.
-// The generated code will register the generated descriptors by calling RegisterExtension.
-
-var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc)
-
-// RegisterExtension is called from the generated code.
-func RegisterExtension(desc *ExtensionDesc) {
-	st := reflect.TypeOf(desc.ExtendedType).Elem()
-	m := extensionMaps[st]
-	if m == nil {
-		m = make(map[int32]*ExtensionDesc)
-		extensionMaps[st] = m
-	}
-	if _, ok := m[desc.Field]; ok {
-		panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field)))
-	}
-	m[desc.Field] = desc
-}
-
-// RegisteredExtensions returns a map of the registered extensions of a
-// protocol buffer struct, indexed by the extension number.
-// The argument pb should be a nil pointer to the struct type.
-func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
-	return extensionMaps[reflect.TypeOf(pb).Elem()]
-}

+ 0 - 979
vendor/github.com/golang/protobuf/proto/lib.go

@@ -1,979 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-/*
-Package proto converts data structures to and from the wire format of
-protocol buffers.  It works in concert with the Go source code generated
-for .proto files by the protocol compiler.
-
-A summary of the properties of the protocol buffer interface
-for a protocol buffer variable v:
-
-  - Names are turned from camel_case to CamelCase for export.
-  - There are no methods on v to set fields; just treat
-	them as structure fields.
-  - There are getters that return a field's value if set,
-	and return the field's default value if unset.
-	The getters work even if the receiver is a nil message.
-  - The zero value for a struct is its correct initialization state.
-	All desired fields must be set before marshaling.
-  - A Reset() method will restore a protobuf struct to its zero state.
-  - Non-repeated fields are pointers to the values; nil means unset.
-	That is, optional or required field int32 f becomes F *int32.
-  - Repeated fields are slices.
-  - Helper functions are available to aid the setting of fields.
-	msg.Foo = proto.String("hello") // set field
-  - Constants are defined to hold the default values of all fields that
-	have them.  They have the form Default_StructName_FieldName.
-	Because the getter methods handle defaulted values,
-	direct use of these constants should be rare.
-  - Enums are given type names and maps from names to values.
-	Enum values are prefixed by the enclosing message's name, or by the
-	enum's type name if it is a top-level enum. Enum types have a String
-	method, and a Enum method to assist in message construction.
-  - Nested messages, groups and enums have type names prefixed with the name of
-	the surrounding message type.
-  - Extensions are given descriptor names that start with E_,
-	followed by an underscore-delimited list of the nested messages
-	that contain it (if any) followed by the CamelCased name of the
-	extension field itself.  HasExtension, ClearExtension, GetExtension
-	and SetExtension are functions for manipulating extensions.
-  - Oneof field sets are given a single field in their message,
-	with distinguished wrapper types for each possible field value.
-  - Marshal and Unmarshal are functions to encode and decode the wire format.
-
-When the .proto file specifies `syntax="proto3"`, there are some differences:
-
-  - Non-repeated fields of non-message type are values instead of pointers.
-  - Enum types do not get an Enum method.
-
-The simplest way to describe this is to see an example.
-Given file test.proto, containing
-
-	package example;
-
-	enum FOO { X = 17; }
-
-	message Test {
-	  required string label = 1;
-	  optional int32 type = 2 [default=77];
-	  repeated int64 reps = 3;
-	  optional group OptionalGroup = 4 {
-	    required string RequiredField = 5;
-	  }
-	  oneof union {
-	    int32 number = 6;
-	    string name = 7;
-	  }
-	}
-
-The resulting file, test.pb.go, is:
-
-	package example
-
-	import proto "github.com/golang/protobuf/proto"
-	import math "math"
-
-	type FOO int32
-	const (
-		FOO_X FOO = 17
-	)
-	var FOO_name = map[int32]string{
-		17: "X",
-	}
-	var FOO_value = map[string]int32{
-		"X": 17,
-	}
-
-	func (x FOO) Enum() *FOO {
-		p := new(FOO)
-		*p = x
-		return p
-	}
-	func (x FOO) String() string {
-		return proto.EnumName(FOO_name, int32(x))
-	}
-	func (x *FOO) UnmarshalJSON(data []byte) error {
-		value, err := proto.UnmarshalJSONEnum(FOO_value, data)
-		if err != nil {
-			return err
-		}
-		*x = FOO(value)
-		return nil
-	}
-
-	type Test struct {
-		Label         *string             `protobuf:"bytes,1,req,name=label" json:"label,omitempty"`
-		Type          *int32              `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"`
-		Reps          []int64             `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"`
-		Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"`
-		// Types that are valid to be assigned to Union:
-		//	*Test_Number
-		//	*Test_Name
-		Union            isTest_Union `protobuf_oneof:"union"`
-		XXX_unrecognized []byte       `json:"-"`
-	}
-	func (m *Test) Reset()         { *m = Test{} }
-	func (m *Test) String() string { return proto.CompactTextString(m) }
-	func (*Test) ProtoMessage() {}
-
-	type isTest_Union interface {
-		isTest_Union()
-	}
-
-	type Test_Number struct {
-		Number int32 `protobuf:"varint,6,opt,name=number"`
-	}
-	type Test_Name struct {
-		Name string `protobuf:"bytes,7,opt,name=name"`
-	}
-
-	func (*Test_Number) isTest_Union() {}
-	func (*Test_Name) isTest_Union()   {}
-
-	func (m *Test) GetUnion() isTest_Union {
-		if m != nil {
-			return m.Union
-		}
-		return nil
-	}
-	const Default_Test_Type int32 = 77
-
-	func (m *Test) GetLabel() string {
-		if m != nil && m.Label != nil {
-			return *m.Label
-		}
-		return ""
-	}
-
-	func (m *Test) GetType() int32 {
-		if m != nil && m.Type != nil {
-			return *m.Type
-		}
-		return Default_Test_Type
-	}
-
-	func (m *Test) GetOptionalgroup() *Test_OptionalGroup {
-		if m != nil {
-			return m.Optionalgroup
-		}
-		return nil
-	}
-
-	type Test_OptionalGroup struct {
-		RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"`
-	}
-	func (m *Test_OptionalGroup) Reset()         { *m = Test_OptionalGroup{} }
-	func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) }
-
-	func (m *Test_OptionalGroup) GetRequiredField() string {
-		if m != nil && m.RequiredField != nil {
-			return *m.RequiredField
-		}
-		return ""
-	}
-
-	func (m *Test) GetNumber() int32 {
-		if x, ok := m.GetUnion().(*Test_Number); ok {
-			return x.Number
-		}
-		return 0
-	}
-
-	func (m *Test) GetName() string {
-		if x, ok := m.GetUnion().(*Test_Name); ok {
-			return x.Name
-		}
-		return ""
-	}
-
-	func init() {
-		proto.RegisterEnum("example.FOO", FOO_name, FOO_value)
-	}
-
-To create and play with a Test object:
-
-	package main
-
-	import (
-		"log"
-
-		"github.com/golang/protobuf/proto"
-		pb "./example.pb"
-	)
-
-	func main() {
-		test := &pb.Test{
-			Label: proto.String("hello"),
-			Type:  proto.Int32(17),
-			Reps:  []int64{1, 2, 3},
-			Optionalgroup: &pb.Test_OptionalGroup{
-				RequiredField: proto.String("good bye"),
-			},
-			Union: &pb.Test_Name{"fred"},
-		}
-		data, err := proto.Marshal(test)
-		if err != nil {
-			log.Fatal("marshaling error: ", err)
-		}
-		newTest := &pb.Test{}
-		err = proto.Unmarshal(data, newTest)
-		if err != nil {
-			log.Fatal("unmarshaling error: ", err)
-		}
-		// Now test and newTest contain the same data.
-		if test.GetLabel() != newTest.GetLabel() {
-			log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel())
-		}
-		// Use a type switch to determine which oneof was set.
-		switch u := test.Union.(type) {
-		case *pb.Test_Number: // u.Number contains the number.
-		case *pb.Test_Name: // u.Name contains the string.
-		}
-		// etc.
-	}
-*/
-package proto
-
-import (
-	"encoding/json"
-	"fmt"
-	"log"
-	"reflect"
-	"sort"
-	"strconv"
-	"sync"
-)
-
-// RequiredNotSetError is an error type returned by either Marshal or Unmarshal.
-// Marshal reports this when a required field is not initialized.
-// Unmarshal reports this when a required field is missing from the wire data.
-type RequiredNotSetError struct{ field string }
-
-func (e *RequiredNotSetError) Error() string {
-	if e.field == "" {
-		return fmt.Sprintf("proto: required field not set")
-	}
-	return fmt.Sprintf("proto: required field %q not set", e.field)
-}
-func (e *RequiredNotSetError) RequiredNotSet() bool {
-	return true
-}
-
-type invalidUTF8Error struct{ field string }
-
-func (e *invalidUTF8Error) Error() string {
-	if e.field == "" {
-		return "proto: invalid UTF-8 detected"
-	}
-	return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field)
-}
-func (e *invalidUTF8Error) InvalidUTF8() bool {
-	return true
-}
-
-// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8.
-// This error should not be exposed to the external API as such errors should
-// be recreated with the field information.
-var errInvalidUTF8 = &invalidUTF8Error{}
-
-// isNonFatal reports whether the error is either a RequiredNotSet error
-// or a InvalidUTF8 error.
-func isNonFatal(err error) bool {
-	if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() {
-		return true
-	}
-	if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() {
-		return true
-	}
-	return false
-}
-
-type nonFatal struct{ E error }
-
-// Merge merges err into nf and reports whether it was successful.
-// Otherwise it returns false for any fatal non-nil errors.
-func (nf *nonFatal) Merge(err error) (ok bool) {
-	if err == nil {
-		return true // not an error
-	}
-	if !isNonFatal(err) {
-		return false // fatal error
-	}
-	if nf.E == nil {
-		nf.E = err // store first instance of non-fatal error
-	}
-	return true
-}
-
-// Message is implemented by generated protocol buffer messages.
-type Message interface {
-	Reset()
-	String() string
-	ProtoMessage()
-}
-
-// Stats records allocation details about the protocol buffer encoders
-// and decoders.  Useful for tuning the library itself.
-type Stats struct {
-	Emalloc uint64 // mallocs in encode
-	Dmalloc uint64 // mallocs in decode
-	Encode  uint64 // number of encodes
-	Decode  uint64 // number of decodes
-	Chit    uint64 // number of cache hits
-	Cmiss   uint64 // number of cache misses
-	Size    uint64 // number of sizes
-}
-
-// Set to true to enable stats collection.
-const collectStats = false
-
-var stats Stats
-
-// GetStats returns a copy of the global Stats structure.
-func GetStats() Stats { return stats }
-
-// A Buffer is a buffer manager for marshaling and unmarshaling
-// protocol buffers.  It may be reused between invocations to
-// reduce memory usage.  It is not necessary to use a Buffer;
-// the global functions Marshal and Unmarshal create a
-// temporary Buffer and are fine for most applications.
-type Buffer struct {
-	buf   []byte // encode/decode byte stream
-	index int    // read point
-
-	deterministic bool
-}
-
-// NewBuffer allocates a new Buffer and initializes its internal data to
-// the contents of the argument slice.
-func NewBuffer(e []byte) *Buffer {
-	return &Buffer{buf: e}
-}
-
-// Reset resets the Buffer, ready for marshaling a new protocol buffer.
-func (p *Buffer) Reset() {
-	p.buf = p.buf[0:0] // for reading/writing
-	p.index = 0        // for reading
-}
-
-// SetBuf replaces the internal buffer with the slice,
-// ready for unmarshaling the contents of the slice.
-func (p *Buffer) SetBuf(s []byte) {
-	p.buf = s
-	p.index = 0
-}
-
-// Bytes returns the contents of the Buffer.
-func (p *Buffer) Bytes() []byte { return p.buf }
-
-// SetDeterministic sets whether to use deterministic serialization.
-//
-// Deterministic serialization guarantees that for a given binary, equal
-// messages will always be serialized to the same bytes. This implies:
-//
-//   - Repeated serialization of a message will return the same bytes.
-//   - Different processes of the same binary (which may be executing on
-//     different machines) will serialize equal messages to the same bytes.
-//
-// Note that the deterministic serialization is NOT canonical across
-// languages. It is not guaranteed to remain stable over time. It is unstable
-// across different builds with schema changes due to unknown fields.
-// Users who need canonical serialization (e.g., persistent storage in a
-// canonical form, fingerprinting, etc.) should define their own
-// canonicalization specification and implement their own serializer rather
-// than relying on this API.
-//
-// If deterministic serialization is requested, map entries will be sorted
-// by keys in lexographical order. This is an implementation detail and
-// subject to change.
-func (p *Buffer) SetDeterministic(deterministic bool) {
-	p.deterministic = deterministic
-}
-
-/*
- * Helper routines for simplifying the creation of optional fields of basic type.
- */
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool {
-	return &v
-}
-
-// Int32 is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it.
-func Int32(v int32) *int32 {
-	return &v
-}
-
-// Int is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it, but unlike Int32
-// its argument value is an int.
-func Int(v int) *int32 {
-	p := new(int32)
-	*p = int32(v)
-	return p
-}
-
-// Int64 is a helper routine that allocates a new int64 value
-// to store v and returns a pointer to it.
-func Int64(v int64) *int64 {
-	return &v
-}
-
-// Float32 is a helper routine that allocates a new float32 value
-// to store v and returns a pointer to it.
-func Float32(v float32) *float32 {
-	return &v
-}
-
-// Float64 is a helper routine that allocates a new float64 value
-// to store v and returns a pointer to it.
-func Float64(v float64) *float64 {
-	return &v
-}
-
-// Uint32 is a helper routine that allocates a new uint32 value
-// to store v and returns a pointer to it.
-func Uint32(v uint32) *uint32 {
-	return &v
-}
-
-// Uint64 is a helper routine that allocates a new uint64 value
-// to store v and returns a pointer to it.
-func Uint64(v uint64) *uint64 {
-	return &v
-}
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string {
-	return &v
-}
-
-// EnumName is a helper function to simplify printing protocol buffer enums
-// by name.  Given an enum map and a value, it returns a useful string.
-func EnumName(m map[int32]string, v int32) string {
-	s, ok := m[v]
-	if ok {
-		return s
-	}
-	return strconv.Itoa(int(v))
-}
-
-// UnmarshalJSONEnum is a helper function to simplify recovering enum int values
-// from their JSON-encoded representation. Given a map from the enum's symbolic
-// names to its int values, and a byte buffer containing the JSON-encoded
-// value, it returns an int32 that can be cast to the enum type by the caller.
-//
-// The function can deal with both JSON representations, numeric and symbolic.
-func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
-	if data[0] == '"' {
-		// New style: enums are strings.
-		var repr string
-		if err := json.Unmarshal(data, &repr); err != nil {
-			return -1, err
-		}
-		val, ok := m[repr]
-		if !ok {
-			return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
-		}
-		return val, nil
-	}
-	// Old style: enums are ints.
-	var val int32
-	if err := json.Unmarshal(data, &val); err != nil {
-		return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
-	}
-	return val, nil
-}
-
-// DebugPrint dumps the encoded data in b in a debugging format with a header
-// including the string s. Used in testing but made available for general debugging.
-func (p *Buffer) DebugPrint(s string, b []byte) {
-	var u uint64
-
-	obuf := p.buf
-	index := p.index
-	p.buf = b
-	p.index = 0
-	depth := 0
-
-	fmt.Printf("\n--- %s ---\n", s)
-
-out:
-	for {
-		for i := 0; i < depth; i++ {
-			fmt.Print("  ")
-		}
-
-		index := p.index
-		if index == len(p.buf) {
-			break
-		}
-
-		op, err := p.DecodeVarint()
-		if err != nil {
-			fmt.Printf("%3d: fetching op err %v\n", index, err)
-			break out
-		}
-		tag := op >> 3
-		wire := op & 7
-
-		switch wire {
-		default:
-			fmt.Printf("%3d: t=%3d unknown wire=%d\n",
-				index, tag, wire)
-			break out
-
-		case WireBytes:
-			var r []byte
-
-			r, err = p.DecodeRawBytes(false)
-			if err != nil {
-				break out
-			}
-			fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r))
-			if len(r) <= 6 {
-				for i := 0; i < len(r); i++ {
-					fmt.Printf(" %.2x", r[i])
-				}
-			} else {
-				for i := 0; i < 3; i++ {
-					fmt.Printf(" %.2x", r[i])
-				}
-				fmt.Printf(" ..")
-				for i := len(r) - 3; i < len(r); i++ {
-					fmt.Printf(" %.2x", r[i])
-				}
-			}
-			fmt.Printf("\n")
-
-		case WireFixed32:
-			u, err = p.DecodeFixed32()
-			if err != nil {
-				fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err)
-				break out
-			}
-			fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u)
-
-		case WireFixed64:
-			u, err = p.DecodeFixed64()
-			if err != nil {
-				fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err)
-				break out
-			}
-			fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u)
-
-		case WireVarint:
-			u, err = p.DecodeVarint()
-			if err != nil {
-				fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err)
-				break out
-			}
-			fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u)
-
-		case WireStartGroup:
-			fmt.Printf("%3d: t=%3d start\n", index, tag)
-			depth++
-
-		case WireEndGroup:
-			depth--
-			fmt.Printf("%3d: t=%3d end\n", index, tag)
-		}
-	}
-
-	if depth != 0 {
-		fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth)
-	}
-	fmt.Printf("\n")
-
-	p.buf = obuf
-	p.index = index
-}
-
-// SetDefaults sets unset protocol buffer fields to their default values.
-// It only modifies fields that are both unset and have defined defaults.
-// It recursively sets default values in any non-nil sub-messages.
-func SetDefaults(pb Message) {
-	setDefaults(reflect.ValueOf(pb), true, false)
-}
-
-// v is a pointer to a struct.
-func setDefaults(v reflect.Value, recur, zeros bool) {
-	v = v.Elem()
-
-	defaultMu.RLock()
-	dm, ok := defaults[v.Type()]
-	defaultMu.RUnlock()
-	if !ok {
-		dm = buildDefaultMessage(v.Type())
-		defaultMu.Lock()
-		defaults[v.Type()] = dm
-		defaultMu.Unlock()
-	}
-
-	for _, sf := range dm.scalars {
-		f := v.Field(sf.index)
-		if !f.IsNil() {
-			// field already set
-			continue
-		}
-		dv := sf.value
-		if dv == nil && !zeros {
-			// no explicit default, and don't want to set zeros
-			continue
-		}
-		fptr := f.Addr().Interface() // **T
-		// TODO: Consider batching the allocations we do here.
-		switch sf.kind {
-		case reflect.Bool:
-			b := new(bool)
-			if dv != nil {
-				*b = dv.(bool)
-			}
-			*(fptr.(**bool)) = b
-		case reflect.Float32:
-			f := new(float32)
-			if dv != nil {
-				*f = dv.(float32)
-			}
-			*(fptr.(**float32)) = f
-		case reflect.Float64:
-			f := new(float64)
-			if dv != nil {
-				*f = dv.(float64)
-			}
-			*(fptr.(**float64)) = f
-		case reflect.Int32:
-			// might be an enum
-			if ft := f.Type(); ft != int32PtrType {
-				// enum
-				f.Set(reflect.New(ft.Elem()))
-				if dv != nil {
-					f.Elem().SetInt(int64(dv.(int32)))
-				}
-			} else {
-				// int32 field
-				i := new(int32)
-				if dv != nil {
-					*i = dv.(int32)
-				}
-				*(fptr.(**int32)) = i
-			}
-		case reflect.Int64:
-			i := new(int64)
-			if dv != nil {
-				*i = dv.(int64)
-			}
-			*(fptr.(**int64)) = i
-		case reflect.String:
-			s := new(string)
-			if dv != nil {
-				*s = dv.(string)
-			}
-			*(fptr.(**string)) = s
-		case reflect.Uint8:
-			// exceptional case: []byte
-			var b []byte
-			if dv != nil {
-				db := dv.([]byte)
-				b = make([]byte, len(db))
-				copy(b, db)
-			} else {
-				b = []byte{}
-			}
-			*(fptr.(*[]byte)) = b
-		case reflect.Uint32:
-			u := new(uint32)
-			if dv != nil {
-				*u = dv.(uint32)
-			}
-			*(fptr.(**uint32)) = u
-		case reflect.Uint64:
-			u := new(uint64)
-			if dv != nil {
-				*u = dv.(uint64)
-			}
-			*(fptr.(**uint64)) = u
-		default:
-			log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind)
-		}
-	}
-
-	for _, ni := range dm.nested {
-		f := v.Field(ni)
-		// f is *T or []*T or map[T]*T
-		switch f.Kind() {
-		case reflect.Ptr:
-			if f.IsNil() {
-				continue
-			}
-			setDefaults(f, recur, zeros)
-
-		case reflect.Slice:
-			for i := 0; i < f.Len(); i++ {
-				e := f.Index(i)
-				if e.IsNil() {
-					continue
-				}
-				setDefaults(e, recur, zeros)
-			}
-
-		case reflect.Map:
-			for _, k := range f.MapKeys() {
-				e := f.MapIndex(k)
-				if e.IsNil() {
-					continue
-				}
-				setDefaults(e, recur, zeros)
-			}
-		}
-	}
-}
-
-var (
-	// defaults maps a protocol buffer struct type to a slice of the fields,
-	// with its scalar fields set to their proto-declared non-zero default values.
-	defaultMu sync.RWMutex
-	defaults  = make(map[reflect.Type]defaultMessage)
-
-	int32PtrType = reflect.TypeOf((*int32)(nil))
-)
-
-// defaultMessage represents information about the default values of a message.
-type defaultMessage struct {
-	scalars []scalarField
-	nested  []int // struct field index of nested messages
-}
-
-type scalarField struct {
-	index int          // struct field index
-	kind  reflect.Kind // element type (the T in *T or []T)
-	value interface{}  // the proto-declared default value, or nil
-}
-
-// t is a struct type.
-func buildDefaultMessage(t reflect.Type) (dm defaultMessage) {
-	sprop := GetProperties(t)
-	for _, prop := range sprop.Prop {
-		fi, ok := sprop.decoderTags.get(prop.Tag)
-		if !ok {
-			// XXX_unrecognized
-			continue
-		}
-		ft := t.Field(fi).Type
-
-		sf, nested, err := fieldDefault(ft, prop)
-		switch {
-		case err != nil:
-			log.Print(err)
-		case nested:
-			dm.nested = append(dm.nested, fi)
-		case sf != nil:
-			sf.index = fi
-			dm.scalars = append(dm.scalars, *sf)
-		}
-	}
-
-	return dm
-}
-
-// fieldDefault returns the scalarField for field type ft.
-// sf will be nil if the field can not have a default.
-// nestedMessage will be true if this is a nested message.
-// Note that sf.index is not set on return.
-func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {
-	var canHaveDefault bool
-	switch ft.Kind() {
-	case reflect.Ptr:
-		if ft.Elem().Kind() == reflect.Struct {
-			nestedMessage = true
-		} else {
-			canHaveDefault = true // proto2 scalar field
-		}
-
-	case reflect.Slice:
-		switch ft.Elem().Kind() {
-		case reflect.Ptr:
-			nestedMessage = true // repeated message
-		case reflect.Uint8:
-			canHaveDefault = true // bytes field
-		}
-
-	case reflect.Map:
-		if ft.Elem().Kind() == reflect.Ptr {
-			nestedMessage = true // map with message values
-		}
-	}
-
-	if !canHaveDefault {
-		if nestedMessage {
-			return nil, true, nil
-		}
-		return nil, false, nil
-	}
-
-	// We now know that ft is a pointer or slice.
-	sf = &scalarField{kind: ft.Elem().Kind()}
-
-	// scalar fields without defaults
-	if !prop.HasDefault {
-		return sf, false, nil
-	}
-
-	// a scalar field: either *T or []byte
-	switch ft.Elem().Kind() {
-	case reflect.Bool:
-		x, err := strconv.ParseBool(prop.Default)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err)
-		}
-		sf.value = x
-	case reflect.Float32:
-		x, err := strconv.ParseFloat(prop.Default, 32)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err)
-		}
-		sf.value = float32(x)
-	case reflect.Float64:
-		x, err := strconv.ParseFloat(prop.Default, 64)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err)
-		}
-		sf.value = x
-	case reflect.Int32:
-		x, err := strconv.ParseInt(prop.Default, 10, 32)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err)
-		}
-		sf.value = int32(x)
-	case reflect.Int64:
-		x, err := strconv.ParseInt(prop.Default, 10, 64)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err)
-		}
-		sf.value = x
-	case reflect.String:
-		sf.value = prop.Default
-	case reflect.Uint8:
-		// []byte (not *uint8)
-		sf.value = []byte(prop.Default)
-	case reflect.Uint32:
-		x, err := strconv.ParseUint(prop.Default, 10, 32)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err)
-		}
-		sf.value = uint32(x)
-	case reflect.Uint64:
-		x, err := strconv.ParseUint(prop.Default, 10, 64)
-		if err != nil {
-			return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err)
-		}
-		sf.value = x
-	default:
-		return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind())
-	}
-
-	return sf, false, nil
-}
-
-// mapKeys returns a sort.Interface to be used for sorting the map keys.
-// Map fields may have key types of non-float scalars, strings and enums.
-func mapKeys(vs []reflect.Value) sort.Interface {
-	s := mapKeySorter{vs: vs}
-
-	// Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps.
-	if len(vs) == 0 {
-		return s
-	}
-	switch vs[0].Kind() {
-	case reflect.Int32, reflect.Int64:
-		s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() }
-	case reflect.Uint32, reflect.Uint64:
-		s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() }
-	case reflect.Bool:
-		s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true
-	case reflect.String:
-		s.less = func(a, b reflect.Value) bool { return a.String() < b.String() }
-	default:
-		panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind()))
-	}
-
-	return s
-}
-
-type mapKeySorter struct {
-	vs   []reflect.Value
-	less func(a, b reflect.Value) bool
-}
-
-func (s mapKeySorter) Len() int      { return len(s.vs) }
-func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] }
-func (s mapKeySorter) Less(i, j int) bool {
-	return s.less(s.vs[i], s.vs[j])
-}
-
-// isProto3Zero reports whether v is a zero proto3 value.
-func isProto3Zero(v reflect.Value) bool {
-	switch v.Kind() {
-	case reflect.Bool:
-		return !v.Bool()
-	case reflect.Int32, reflect.Int64:
-		return v.Int() == 0
-	case reflect.Uint32, reflect.Uint64:
-		return v.Uint() == 0
-	case reflect.Float32, reflect.Float64:
-		return v.Float() == 0
-	case reflect.String:
-		return v.String() == ""
-	}
-	return false
-}
-
-// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const ProtoPackageIsVersion2 = true
-
-// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const ProtoPackageIsVersion1 = true
-
-// InternalMessageInfo is a type used internally by generated .pb.go files.
-// This type is not intended to be used by non-generated code.
-// This type is not subject to any compatibility guarantee.
-type InternalMessageInfo struct {
-	marshal   *marshalInfo
-	unmarshal *unmarshalInfo
-	merge     *mergeInfo
-	discard   *discardInfo
-}

+ 0 - 314
vendor/github.com/golang/protobuf/proto/message_set.go

@@ -1,314 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Support for message sets.
- */
-
-import (
-	"bytes"
-	"encoding/json"
-	"errors"
-	"fmt"
-	"reflect"
-	"sort"
-	"sync"
-)
-
-// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.
-// A message type ID is required for storing a protocol buffer in a message set.
-var errNoMessageTypeID = errors.New("proto does not have a message type ID")
-
-// The first two types (_MessageSet_Item and messageSet)
-// model what the protocol compiler produces for the following protocol message:
-//   message MessageSet {
-//     repeated group Item = 1 {
-//       required int32 type_id = 2;
-//       required string message = 3;
-//     };
-//   }
-// That is the MessageSet wire format. We can't use a proto to generate these
-// because that would introduce a circular dependency between it and this package.
-
-type _MessageSet_Item struct {
-	TypeId  *int32 `protobuf:"varint,2,req,name=type_id"`
-	Message []byte `protobuf:"bytes,3,req,name=message"`
-}
-
-type messageSet struct {
-	Item             []*_MessageSet_Item `protobuf:"group,1,rep"`
-	XXX_unrecognized []byte
-	// TODO: caching?
-}
-
-// Make sure messageSet is a Message.
-var _ Message = (*messageSet)(nil)
-
-// messageTypeIder is an interface satisfied by a protocol buffer type
-// that may be stored in a MessageSet.
-type messageTypeIder interface {
-	MessageTypeId() int32
-}
-
-func (ms *messageSet) find(pb Message) *_MessageSet_Item {
-	mti, ok := pb.(messageTypeIder)
-	if !ok {
-		return nil
-	}
-	id := mti.MessageTypeId()
-	for _, item := range ms.Item {
-		if *item.TypeId == id {
-			return item
-		}
-	}
-	return nil
-}
-
-func (ms *messageSet) Has(pb Message) bool {
-	return ms.find(pb) != nil
-}
-
-func (ms *messageSet) Unmarshal(pb Message) error {
-	if item := ms.find(pb); item != nil {
-		return Unmarshal(item.Message, pb)
-	}
-	if _, ok := pb.(messageTypeIder); !ok {
-		return errNoMessageTypeID
-	}
-	return nil // TODO: return error instead?
-}
-
-func (ms *messageSet) Marshal(pb Message) error {
-	msg, err := Marshal(pb)
-	if err != nil {
-		return err
-	}
-	if item := ms.find(pb); item != nil {
-		// reuse existing item
-		item.Message = msg
-		return nil
-	}
-
-	mti, ok := pb.(messageTypeIder)
-	if !ok {
-		return errNoMessageTypeID
-	}
-
-	mtid := mti.MessageTypeId()
-	ms.Item = append(ms.Item, &_MessageSet_Item{
-		TypeId:  &mtid,
-		Message: msg,
-	})
-	return nil
-}
-
-func (ms *messageSet) Reset()         { *ms = messageSet{} }
-func (ms *messageSet) String() string { return CompactTextString(ms) }
-func (*messageSet) ProtoMessage()     {}
-
-// Support for the message_set_wire_format message option.
-
-func skipVarint(buf []byte) []byte {
-	i := 0
-	for ; buf[i]&0x80 != 0; i++ {
-	}
-	return buf[i+1:]
-}
-
-// MarshalMessageSet encodes the extension map represented by m in the message set wire format.
-// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSet(exts interface{}) ([]byte, error) {
-	return marshalMessageSet(exts, false)
-}
-
-// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal.
-func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) {
-	switch exts := exts.(type) {
-	case *XXX_InternalExtensions:
-		var u marshalInfo
-		siz := u.sizeMessageSet(exts)
-		b := make([]byte, 0, siz)
-		return u.appendMessageSet(b, exts, deterministic)
-
-	case map[int32]Extension:
-		// This is an old-style extension map.
-		// Wrap it in a new-style XXX_InternalExtensions.
-		ie := XXX_InternalExtensions{
-			p: &struct {
-				mu           sync.Mutex
-				extensionMap map[int32]Extension
-			}{
-				extensionMap: exts,
-			},
-		}
-
-		var u marshalInfo
-		siz := u.sizeMessageSet(&ie)
-		b := make([]byte, 0, siz)
-		return u.appendMessageSet(b, &ie, deterministic)
-
-	default:
-		return nil, errors.New("proto: not an extension map")
-	}
-}
-
-// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
-// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSet(buf []byte, exts interface{}) error {
-	var m map[int32]Extension
-	switch exts := exts.(type) {
-	case *XXX_InternalExtensions:
-		m = exts.extensionsWrite()
-	case map[int32]Extension:
-		m = exts
-	default:
-		return errors.New("proto: not an extension map")
-	}
-
-	ms := new(messageSet)
-	if err := Unmarshal(buf, ms); err != nil {
-		return err
-	}
-	for _, item := range ms.Item {
-		id := *item.TypeId
-		msg := item.Message
-
-		// Restore wire type and field number varint, plus length varint.
-		// Be careful to preserve duplicate items.
-		b := EncodeVarint(uint64(id)<<3 | WireBytes)
-		if ext, ok := m[id]; ok {
-			// Existing data; rip off the tag and length varint
-			// so we join the new data correctly.
-			// We can assume that ext.enc is set because we are unmarshaling.
-			o := ext.enc[len(b):]   // skip wire type and field number
-			_, n := DecodeVarint(o) // calculate length of length varint
-			o = o[n:]               // skip length varint
-			msg = append(o, msg...) // join old data and new data
-		}
-		b = append(b, EncodeVarint(uint64(len(msg)))...)
-		b = append(b, msg...)
-
-		m[id] = Extension{enc: b}
-	}
-	return nil
-}
-
-// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
-// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
-	var m map[int32]Extension
-	switch exts := exts.(type) {
-	case *XXX_InternalExtensions:
-		var mu sync.Locker
-		m, mu = exts.extensionsRead()
-		if m != nil {
-			// Keep the extensions map locked until we're done marshaling to prevent
-			// races between marshaling and unmarshaling the lazily-{en,de}coded
-			// values.
-			mu.Lock()
-			defer mu.Unlock()
-		}
-	case map[int32]Extension:
-		m = exts
-	default:
-		return nil, errors.New("proto: not an extension map")
-	}
-	var b bytes.Buffer
-	b.WriteByte('{')
-
-	// Process the map in key order for deterministic output.
-	ids := make([]int32, 0, len(m))
-	for id := range m {
-		ids = append(ids, id)
-	}
-	sort.Sort(int32Slice(ids)) // int32Slice defined in text.go
-
-	for i, id := range ids {
-		ext := m[id]
-		msd, ok := messageSetMap[id]
-		if !ok {
-			// Unknown type; we can't render it, so skip it.
-			continue
-		}
-
-		if i > 0 && b.Len() > 1 {
-			b.WriteByte(',')
-		}
-
-		fmt.Fprintf(&b, `"[%s]":`, msd.name)
-
-		x := ext.value
-		if x == nil {
-			x = reflect.New(msd.t.Elem()).Interface()
-			if err := Unmarshal(ext.enc, x.(Message)); err != nil {
-				return nil, err
-			}
-		}
-		d, err := json.Marshal(x)
-		if err != nil {
-			return nil, err
-		}
-		b.Write(d)
-	}
-	b.WriteByte('}')
-	return b.Bytes(), nil
-}
-
-// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
-// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
-	// Common-case fast path.
-	if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
-		return nil
-	}
-
-	// This is fairly tricky, and it's not clear that it is needed.
-	return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented")
-}
-
-// A global registry of types that can be used in a MessageSet.
-
-var messageSetMap = make(map[int32]messageSetDesc)
-
-type messageSetDesc struct {
-	t    reflect.Type // pointer to struct
-	name string
-}
-
-// RegisterMessageSetType is called from the generated code.
-func RegisterMessageSetType(m Message, fieldNum int32, name string) {
-	messageSetMap[fieldNum] = messageSetDesc{
-		t:    reflect.TypeOf(m),
-		name: name,
-	}
-}

+ 0 - 357
vendor/github.com/golang/protobuf/proto/pointer_reflect.go

@@ -1,357 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build purego appengine js
-
-// This file contains an implementation of proto field accesses using package reflect.
-// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
-// be used on App Engine.
-
-package proto
-
-import (
-	"reflect"
-	"sync"
-)
-
-const unsafeAllowed = false
-
-// A field identifies a field in a struct, accessible from a pointer.
-// In this implementation, a field is identified by the sequence of field indices
-// passed to reflect's FieldByIndex.
-type field []int
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
-	return f.Index
-}
-
-// invalidField is an invalid field identifier.
-var invalidField = field(nil)
-
-// zeroField is a noop when calling pointer.offset.
-var zeroField = field([]int{})
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool { return f != nil }
-
-// The pointer type is for the table-driven decoder.
-// The implementation here uses a reflect.Value of pointer type to
-// create a generic pointer. In pointer_unsafe.go we use unsafe
-// instead of reflect to implement the same (but faster) interface.
-type pointer struct {
-	v reflect.Value
-}
-
-// toPointer converts an interface of pointer type to a pointer
-// that points to the same target.
-func toPointer(i *Message) pointer {
-	return pointer{v: reflect.ValueOf(*i)}
-}
-
-// toAddrPointer converts an interface to a pointer that points to
-// the interface data.
-func toAddrPointer(i *interface{}, isptr bool) pointer {
-	v := reflect.ValueOf(*i)
-	u := reflect.New(v.Type())
-	u.Elem().Set(v)
-	return pointer{v: u}
-}
-
-// valToPointer converts v to a pointer.  v must be of pointer type.
-func valToPointer(v reflect.Value) pointer {
-	return pointer{v: v}
-}
-
-// offset converts from a pointer to a structure to a pointer to
-// one of its fields.
-func (p pointer) offset(f field) pointer {
-	return pointer{v: p.v.Elem().FieldByIndex(f).Addr()}
-}
-
-func (p pointer) isNil() bool {
-	return p.v.IsNil()
-}
-
-// grow updates the slice s in place to make it one element longer.
-// s must be addressable.
-// Returns the (addressable) new element.
-func grow(s reflect.Value) reflect.Value {
-	n, m := s.Len(), s.Cap()
-	if n < m {
-		s.SetLen(n + 1)
-	} else {
-		s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem())))
-	}
-	return s.Index(n)
-}
-
-func (p pointer) toInt64() *int64 {
-	return p.v.Interface().(*int64)
-}
-func (p pointer) toInt64Ptr() **int64 {
-	return p.v.Interface().(**int64)
-}
-func (p pointer) toInt64Slice() *[]int64 {
-	return p.v.Interface().(*[]int64)
-}
-
-var int32ptr = reflect.TypeOf((*int32)(nil))
-
-func (p pointer) toInt32() *int32 {
-	return p.v.Convert(int32ptr).Interface().(*int32)
-}
-
-// The toInt32Ptr/Slice methods don't work because of enums.
-// Instead, we must use set/get methods for the int32ptr/slice case.
-/*
-	func (p pointer) toInt32Ptr() **int32 {
-		return p.v.Interface().(**int32)
-}
-	func (p pointer) toInt32Slice() *[]int32 {
-		return p.v.Interface().(*[]int32)
-}
-*/
-func (p pointer) getInt32Ptr() *int32 {
-	if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
-		// raw int32 type
-		return p.v.Elem().Interface().(*int32)
-	}
-	// an enum
-	return p.v.Elem().Convert(int32PtrType).Interface().(*int32)
-}
-func (p pointer) setInt32Ptr(v int32) {
-	// Allocate value in a *int32. Possibly convert that to a *enum.
-	// Then assign it to a **int32 or **enum.
-	// Note: we can convert *int32 to *enum, but we can't convert
-	// **int32 to **enum!
-	p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem()))
-}
-
-// getInt32Slice copies []int32 from p as a new slice.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) getInt32Slice() []int32 {
-	if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
-		// raw int32 type
-		return p.v.Elem().Interface().([]int32)
-	}
-	// an enum
-	// Allocate a []int32, then assign []enum's values into it.
-	// Note: we can't convert []enum to []int32.
-	slice := p.v.Elem()
-	s := make([]int32, slice.Len())
-	for i := 0; i < slice.Len(); i++ {
-		s[i] = int32(slice.Index(i).Int())
-	}
-	return s
-}
-
-// setInt32Slice copies []int32 into p as a new slice.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) setInt32Slice(v []int32) {
-	if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
-		// raw int32 type
-		p.v.Elem().Set(reflect.ValueOf(v))
-		return
-	}
-	// an enum
-	// Allocate a []enum, then assign []int32's values into it.
-	// Note: we can't convert []enum to []int32.
-	slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v))
-	for i, x := range v {
-		slice.Index(i).SetInt(int64(x))
-	}
-	p.v.Elem().Set(slice)
-}
-func (p pointer) appendInt32Slice(v int32) {
-	grow(p.v.Elem()).SetInt(int64(v))
-}
-
-func (p pointer) toUint64() *uint64 {
-	return p.v.Interface().(*uint64)
-}
-func (p pointer) toUint64Ptr() **uint64 {
-	return p.v.Interface().(**uint64)
-}
-func (p pointer) toUint64Slice() *[]uint64 {
-	return p.v.Interface().(*[]uint64)
-}
-func (p pointer) toUint32() *uint32 {
-	return p.v.Interface().(*uint32)
-}
-func (p pointer) toUint32Ptr() **uint32 {
-	return p.v.Interface().(**uint32)
-}
-func (p pointer) toUint32Slice() *[]uint32 {
-	return p.v.Interface().(*[]uint32)
-}
-func (p pointer) toBool() *bool {
-	return p.v.Interface().(*bool)
-}
-func (p pointer) toBoolPtr() **bool {
-	return p.v.Interface().(**bool)
-}
-func (p pointer) toBoolSlice() *[]bool {
-	return p.v.Interface().(*[]bool)
-}
-func (p pointer) toFloat64() *float64 {
-	return p.v.Interface().(*float64)
-}
-func (p pointer) toFloat64Ptr() **float64 {
-	return p.v.Interface().(**float64)
-}
-func (p pointer) toFloat64Slice() *[]float64 {
-	return p.v.Interface().(*[]float64)
-}
-func (p pointer) toFloat32() *float32 {
-	return p.v.Interface().(*float32)
-}
-func (p pointer) toFloat32Ptr() **float32 {
-	return p.v.Interface().(**float32)
-}
-func (p pointer) toFloat32Slice() *[]float32 {
-	return p.v.Interface().(*[]float32)
-}
-func (p pointer) toString() *string {
-	return p.v.Interface().(*string)
-}
-func (p pointer) toStringPtr() **string {
-	return p.v.Interface().(**string)
-}
-func (p pointer) toStringSlice() *[]string {
-	return p.v.Interface().(*[]string)
-}
-func (p pointer) toBytes() *[]byte {
-	return p.v.Interface().(*[]byte)
-}
-func (p pointer) toBytesSlice() *[][]byte {
-	return p.v.Interface().(*[][]byte)
-}
-func (p pointer) toExtensions() *XXX_InternalExtensions {
-	return p.v.Interface().(*XXX_InternalExtensions)
-}
-func (p pointer) toOldExtensions() *map[int32]Extension {
-	return p.v.Interface().(*map[int32]Extension)
-}
-func (p pointer) getPointer() pointer {
-	return pointer{v: p.v.Elem()}
-}
-func (p pointer) setPointer(q pointer) {
-	p.v.Elem().Set(q.v)
-}
-func (p pointer) appendPointer(q pointer) {
-	grow(p.v.Elem()).Set(q.v)
-}
-
-// getPointerSlice copies []*T from p as a new []pointer.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) getPointerSlice() []pointer {
-	if p.v.IsNil() {
-		return nil
-	}
-	n := p.v.Elem().Len()
-	s := make([]pointer, n)
-	for i := 0; i < n; i++ {
-		s[i] = pointer{v: p.v.Elem().Index(i)}
-	}
-	return s
-}
-
-// setPointerSlice copies []pointer into p as a new []*T.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) setPointerSlice(v []pointer) {
-	if v == nil {
-		p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem())
-		return
-	}
-	s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v))
-	for _, p := range v {
-		s = reflect.Append(s, p.v)
-	}
-	p.v.Elem().Set(s)
-}
-
-// getInterfacePointer returns a pointer that points to the
-// interface data of the interface pointed by p.
-func (p pointer) getInterfacePointer() pointer {
-	if p.v.Elem().IsNil() {
-		return pointer{v: p.v.Elem()}
-	}
-	return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct
-}
-
-func (p pointer) asPointerTo(t reflect.Type) reflect.Value {
-	// TODO: check that p.v.Type().Elem() == t?
-	return p.v
-}
-
-func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	return *p
-}
-func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	*p = v
-}
-func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	return *p
-}
-func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	*p = v
-}
-func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	return *p
-}
-func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	*p = v
-}
-func atomicLoadDiscardInfo(p **discardInfo) *discardInfo {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	return *p
-}
-func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) {
-	atomicLock.Lock()
-	defer atomicLock.Unlock()
-	*p = v
-}
-
-var atomicLock sync.Mutex

+ 0 - 308
vendor/github.com/golang/protobuf/proto/pointer_unsafe.go

@@ -1,308 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build !purego,!appengine,!js
-
-// This file contains the implementation of the proto field accesses using package unsafe.
-
-package proto
-
-import (
-	"reflect"
-	"sync/atomic"
-	"unsafe"
-)
-
-const unsafeAllowed = true
-
-// A field identifies a field in a struct, accessible from a pointer.
-// In this implementation, a field is identified by its byte offset from the start of the struct.
-type field uintptr
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
-	return field(f.Offset)
-}
-
-// invalidField is an invalid field identifier.
-const invalidField = ^field(0)
-
-// zeroField is a noop when calling pointer.offset.
-const zeroField = field(0)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool {
-	return f != invalidField
-}
-
-// The pointer type below is for the new table-driven encoder/decoder.
-// The implementation here uses unsafe.Pointer to create a generic pointer.
-// In pointer_reflect.go we use reflect instead of unsafe to implement
-// the same (but slower) interface.
-type pointer struct {
-	p unsafe.Pointer
-}
-
-// size of pointer
-var ptrSize = unsafe.Sizeof(uintptr(0))
-
-// toPointer converts an interface of pointer type to a pointer
-// that points to the same target.
-func toPointer(i *Message) pointer {
-	// Super-tricky - read pointer out of data word of interface value.
-	// Saves ~25ns over the equivalent:
-	// return valToPointer(reflect.ValueOf(*i))
-	return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
-}
-
-// toAddrPointer converts an interface to a pointer that points to
-// the interface data.
-func toAddrPointer(i *interface{}, isptr bool) pointer {
-	// Super-tricky - read or get the address of data word of interface value.
-	if isptr {
-		// The interface is of pointer type, thus it is a direct interface.
-		// The data word is the pointer data itself. We take its address.
-		return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)}
-	}
-	// The interface is not of pointer type. The data word is the pointer
-	// to the data.
-	return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
-}
-
-// valToPointer converts v to a pointer. v must be of pointer type.
-func valToPointer(v reflect.Value) pointer {
-	return pointer{p: unsafe.Pointer(v.Pointer())}
-}
-
-// offset converts from a pointer to a structure to a pointer to
-// one of its fields.
-func (p pointer) offset(f field) pointer {
-	// For safety, we should panic if !f.IsValid, however calling panic causes
-	// this to no longer be inlineable, which is a serious performance cost.
-	/*
-		if !f.IsValid() {
-			panic("invalid field")
-		}
-	*/
-	return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}
-}
-
-func (p pointer) isNil() bool {
-	return p.p == nil
-}
-
-func (p pointer) toInt64() *int64 {
-	return (*int64)(p.p)
-}
-func (p pointer) toInt64Ptr() **int64 {
-	return (**int64)(p.p)
-}
-func (p pointer) toInt64Slice() *[]int64 {
-	return (*[]int64)(p.p)
-}
-func (p pointer) toInt32() *int32 {
-	return (*int32)(p.p)
-}
-
-// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist.
-/*
-	func (p pointer) toInt32Ptr() **int32 {
-		return (**int32)(p.p)
-	}
-	func (p pointer) toInt32Slice() *[]int32 {
-		return (*[]int32)(p.p)
-	}
-*/
-func (p pointer) getInt32Ptr() *int32 {
-	return *(**int32)(p.p)
-}
-func (p pointer) setInt32Ptr(v int32) {
-	*(**int32)(p.p) = &v
-}
-
-// getInt32Slice loads a []int32 from p.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) getInt32Slice() []int32 {
-	return *(*[]int32)(p.p)
-}
-
-// setInt32Slice stores a []int32 to p.
-// The value set is aliased with the input slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) setInt32Slice(v []int32) {
-	*(*[]int32)(p.p) = v
-}
-
-// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead?
-func (p pointer) appendInt32Slice(v int32) {
-	s := (*[]int32)(p.p)
-	*s = append(*s, v)
-}
-
-func (p pointer) toUint64() *uint64 {
-	return (*uint64)(p.p)
-}
-func (p pointer) toUint64Ptr() **uint64 {
-	return (**uint64)(p.p)
-}
-func (p pointer) toUint64Slice() *[]uint64 {
-	return (*[]uint64)(p.p)
-}
-func (p pointer) toUint32() *uint32 {
-	return (*uint32)(p.p)
-}
-func (p pointer) toUint32Ptr() **uint32 {
-	return (**uint32)(p.p)
-}
-func (p pointer) toUint32Slice() *[]uint32 {
-	return (*[]uint32)(p.p)
-}
-func (p pointer) toBool() *bool {
-	return (*bool)(p.p)
-}
-func (p pointer) toBoolPtr() **bool {
-	return (**bool)(p.p)
-}
-func (p pointer) toBoolSlice() *[]bool {
-	return (*[]bool)(p.p)
-}
-func (p pointer) toFloat64() *float64 {
-	return (*float64)(p.p)
-}
-func (p pointer) toFloat64Ptr() **float64 {
-	return (**float64)(p.p)
-}
-func (p pointer) toFloat64Slice() *[]float64 {
-	return (*[]float64)(p.p)
-}
-func (p pointer) toFloat32() *float32 {
-	return (*float32)(p.p)
-}
-func (p pointer) toFloat32Ptr() **float32 {
-	return (**float32)(p.p)
-}
-func (p pointer) toFloat32Slice() *[]float32 {
-	return (*[]float32)(p.p)
-}
-func (p pointer) toString() *string {
-	return (*string)(p.p)
-}
-func (p pointer) toStringPtr() **string {
-	return (**string)(p.p)
-}
-func (p pointer) toStringSlice() *[]string {
-	return (*[]string)(p.p)
-}
-func (p pointer) toBytes() *[]byte {
-	return (*[]byte)(p.p)
-}
-func (p pointer) toBytesSlice() *[][]byte {
-	return (*[][]byte)(p.p)
-}
-func (p pointer) toExtensions() *XXX_InternalExtensions {
-	return (*XXX_InternalExtensions)(p.p)
-}
-func (p pointer) toOldExtensions() *map[int32]Extension {
-	return (*map[int32]Extension)(p.p)
-}
-
-// getPointerSlice loads []*T from p as a []pointer.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) getPointerSlice() []pointer {
-	// Super-tricky - p should point to a []*T where T is a
-	// message type. We load it as []pointer.
-	return *(*[]pointer)(p.p)
-}
-
-// setPointerSlice stores []pointer into p as a []*T.
-// The value set is aliased with the input slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) setPointerSlice(v []pointer) {
-	// Super-tricky - p should point to a []*T where T is a
-	// message type. We store it as []pointer.
-	*(*[]pointer)(p.p) = v
-}
-
-// getPointer loads the pointer at p and returns it.
-func (p pointer) getPointer() pointer {
-	return pointer{p: *(*unsafe.Pointer)(p.p)}
-}
-
-// setPointer stores the pointer q at p.
-func (p pointer) setPointer(q pointer) {
-	*(*unsafe.Pointer)(p.p) = q.p
-}
-
-// append q to the slice pointed to by p.
-func (p pointer) appendPointer(q pointer) {
-	s := (*[]unsafe.Pointer)(p.p)
-	*s = append(*s, q.p)
-}
-
-// getInterfacePointer returns a pointer that points to the
-// interface data of the interface pointed by p.
-func (p pointer) getInterfacePointer() pointer {
-	// Super-tricky - read pointer out of data word of interface value.
-	return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]}
-}
-
-// asPointerTo returns a reflect.Value that is a pointer to an
-// object of type t stored at p.
-func (p pointer) asPointerTo(t reflect.Type) reflect.Value {
-	return reflect.NewAt(t, p.p)
-}
-
-func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo {
-	return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) {
-	atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo {
-	return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) {
-	atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo {
-	return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) {
-	atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadDiscardInfo(p **discardInfo) *discardInfo {
-	return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) {
-	atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}

+ 0 - 544
vendor/github.com/golang/protobuf/proto/properties.go

@@ -1,544 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
-	"fmt"
-	"log"
-	"os"
-	"reflect"
-	"sort"
-	"strconv"
-	"strings"
-	"sync"
-)
-
-const debug bool = false
-
-// Constants that identify the encoding of a value on the wire.
-const (
-	WireVarint     = 0
-	WireFixed64    = 1
-	WireBytes      = 2
-	WireStartGroup = 3
-	WireEndGroup   = 4
-	WireFixed32    = 5
-)
-
-// tagMap is an optimization over map[int]int for typical protocol buffer
-// use-cases. Encoded protocol buffers are often in tag order with small tag
-// numbers.
-type tagMap struct {
-	fastTags []int
-	slowTags map[int]int
-}
-
-// tagMapFastLimit is the upper bound on the tag number that will be stored in
-// the tagMap slice rather than its map.
-const tagMapFastLimit = 1024
-
-func (p *tagMap) get(t int) (int, bool) {
-	if t > 0 && t < tagMapFastLimit {
-		if t >= len(p.fastTags) {
-			return 0, false
-		}
-		fi := p.fastTags[t]
-		return fi, fi >= 0
-	}
-	fi, ok := p.slowTags[t]
-	return fi, ok
-}
-
-func (p *tagMap) put(t int, fi int) {
-	if t > 0 && t < tagMapFastLimit {
-		for len(p.fastTags) < t+1 {
-			p.fastTags = append(p.fastTags, -1)
-		}
-		p.fastTags[t] = fi
-		return
-	}
-	if p.slowTags == nil {
-		p.slowTags = make(map[int]int)
-	}
-	p.slowTags[t] = fi
-}
-
-// StructProperties represents properties for all the fields of a struct.
-// decoderTags and decoderOrigNames should only be used by the decoder.
-type StructProperties struct {
-	Prop             []*Properties  // properties for each field
-	reqCount         int            // required count
-	decoderTags      tagMap         // map from proto tag to struct field number
-	decoderOrigNames map[string]int // map from original name to struct field number
-	order            []int          // list of struct field numbers in tag order
-
-	// OneofTypes contains information about the oneof fields in this message.
-	// It is keyed by the original name of a field.
-	OneofTypes map[string]*OneofProperties
-}
-
-// OneofProperties represents information about a specific field in a oneof.
-type OneofProperties struct {
-	Type  reflect.Type // pointer to generated struct type for this oneof field
-	Field int          // struct field number of the containing oneof in the message
-	Prop  *Properties
-}
-
-// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec.
-// See encode.go, (*Buffer).enc_struct.
-
-func (sp *StructProperties) Len() int { return len(sp.order) }
-func (sp *StructProperties) Less(i, j int) bool {
-	return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag
-}
-func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] }
-
-// Properties represents the protocol-specific behavior of a single struct field.
-type Properties struct {
-	Name     string // name of the field, for error messages
-	OrigName string // original name before protocol compiler (always set)
-	JSONName string // name to use for JSON; determined by protoc
-	Wire     string
-	WireType int
-	Tag      int
-	Required bool
-	Optional bool
-	Repeated bool
-	Packed   bool   // relevant for repeated primitives only
-	Enum     string // set for enum types only
-	proto3   bool   // whether this is known to be a proto3 field
-	oneof    bool   // whether this is a oneof field
-
-	Default    string // default value
-	HasDefault bool   // whether an explicit default was provided
-
-	stype reflect.Type      // set for struct types only
-	sprop *StructProperties // set for struct types only
-
-	mtype      reflect.Type // set for map types only
-	MapKeyProp *Properties  // set for map types only
-	MapValProp *Properties  // set for map types only
-}
-
-// String formats the properties in the protobuf struct field tag style.
-func (p *Properties) String() string {
-	s := p.Wire
-	s += ","
-	s += strconv.Itoa(p.Tag)
-	if p.Required {
-		s += ",req"
-	}
-	if p.Optional {
-		s += ",opt"
-	}
-	if p.Repeated {
-		s += ",rep"
-	}
-	if p.Packed {
-		s += ",packed"
-	}
-	s += ",name=" + p.OrigName
-	if p.JSONName != p.OrigName {
-		s += ",json=" + p.JSONName
-	}
-	if p.proto3 {
-		s += ",proto3"
-	}
-	if p.oneof {
-		s += ",oneof"
-	}
-	if len(p.Enum) > 0 {
-		s += ",enum=" + p.Enum
-	}
-	if p.HasDefault {
-		s += ",def=" + p.Default
-	}
-	return s
-}
-
-// Parse populates p by parsing a string in the protobuf struct field tag style.
-func (p *Properties) Parse(s string) {
-	// "bytes,49,opt,name=foo,def=hello!"
-	fields := strings.Split(s, ",") // breaks def=, but handled below.
-	if len(fields) < 2 {
-		fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s)
-		return
-	}
-
-	p.Wire = fields[0]
-	switch p.Wire {
-	case "varint":
-		p.WireType = WireVarint
-	case "fixed32":
-		p.WireType = WireFixed32
-	case "fixed64":
-		p.WireType = WireFixed64
-	case "zigzag32":
-		p.WireType = WireVarint
-	case "zigzag64":
-		p.WireType = WireVarint
-	case "bytes", "group":
-		p.WireType = WireBytes
-		// no numeric converter for non-numeric types
-	default:
-		fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s)
-		return
-	}
-
-	var err error
-	p.Tag, err = strconv.Atoi(fields[1])
-	if err != nil {
-		return
-	}
-
-outer:
-	for i := 2; i < len(fields); i++ {
-		f := fields[i]
-		switch {
-		case f == "req":
-			p.Required = true
-		case f == "opt":
-			p.Optional = true
-		case f == "rep":
-			p.Repeated = true
-		case f == "packed":
-			p.Packed = true
-		case strings.HasPrefix(f, "name="):
-			p.OrigName = f[5:]
-		case strings.HasPrefix(f, "json="):
-			p.JSONName = f[5:]
-		case strings.HasPrefix(f, "enum="):
-			p.Enum = f[5:]
-		case f == "proto3":
-			p.proto3 = true
-		case f == "oneof":
-			p.oneof = true
-		case strings.HasPrefix(f, "def="):
-			p.HasDefault = true
-			p.Default = f[4:] // rest of string
-			if i+1 < len(fields) {
-				// Commas aren't escaped, and def is always last.
-				p.Default += "," + strings.Join(fields[i+1:], ",")
-				break outer
-			}
-		}
-	}
-}
-
-var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem()
-
-// setFieldProps initializes the field properties for submessages and maps.
-func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) {
-	switch t1 := typ; t1.Kind() {
-	case reflect.Ptr:
-		if t1.Elem().Kind() == reflect.Struct {
-			p.stype = t1.Elem()
-		}
-
-	case reflect.Slice:
-		if t2 := t1.Elem(); t2.Kind() == reflect.Ptr && t2.Elem().Kind() == reflect.Struct {
-			p.stype = t2.Elem()
-		}
-
-	case reflect.Map:
-		p.mtype = t1
-		p.MapKeyProp = &Properties{}
-		p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp)
-		p.MapValProp = &Properties{}
-		vtype := p.mtype.Elem()
-		if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice {
-			// The value type is not a message (*T) or bytes ([]byte),
-			// so we need encoders for the pointer to this type.
-			vtype = reflect.PtrTo(vtype)
-		}
-		p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp)
-	}
-
-	if p.stype != nil {
-		if lockGetProp {
-			p.sprop = GetProperties(p.stype)
-		} else {
-			p.sprop = getPropertiesLocked(p.stype)
-		}
-	}
-}
-
-var (
-	marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
-)
-
-// Init populates the properties from a protocol buffer struct tag.
-func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
-	p.init(typ, name, tag, f, true)
-}
-
-func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) {
-	// "bytes,49,opt,def=hello!"
-	p.Name = name
-	p.OrigName = name
-	if tag == "" {
-		return
-	}
-	p.Parse(tag)
-	p.setFieldProps(typ, f, lockGetProp)
-}
-
-var (
-	propertiesMu  sync.RWMutex
-	propertiesMap = make(map[reflect.Type]*StructProperties)
-)
-
-// GetProperties returns the list of properties for the type represented by t.
-// t must represent a generated struct type of a protocol message.
-func GetProperties(t reflect.Type) *StructProperties {
-	if t.Kind() != reflect.Struct {
-		panic("proto: type must have kind struct")
-	}
-
-	// Most calls to GetProperties in a long-running program will be
-	// retrieving details for types we have seen before.
-	propertiesMu.RLock()
-	sprop, ok := propertiesMap[t]
-	propertiesMu.RUnlock()
-	if ok {
-		if collectStats {
-			stats.Chit++
-		}
-		return sprop
-	}
-
-	propertiesMu.Lock()
-	sprop = getPropertiesLocked(t)
-	propertiesMu.Unlock()
-	return sprop
-}
-
-// getPropertiesLocked requires that propertiesMu is held.
-func getPropertiesLocked(t reflect.Type) *StructProperties {
-	if prop, ok := propertiesMap[t]; ok {
-		if collectStats {
-			stats.Chit++
-		}
-		return prop
-	}
-	if collectStats {
-		stats.Cmiss++
-	}
-
-	prop := new(StructProperties)
-	// in case of recursive protos, fill this in now.
-	propertiesMap[t] = prop
-
-	// build properties
-	prop.Prop = make([]*Properties, t.NumField())
-	prop.order = make([]int, t.NumField())
-
-	for i := 0; i < t.NumField(); i++ {
-		f := t.Field(i)
-		p := new(Properties)
-		name := f.Name
-		p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false)
-
-		oneof := f.Tag.Get("protobuf_oneof") // special case
-		if oneof != "" {
-			// Oneof fields don't use the traditional protobuf tag.
-			p.OrigName = oneof
-		}
-		prop.Prop[i] = p
-		prop.order[i] = i
-		if debug {
-			print(i, " ", f.Name, " ", t.String(), " ")
-			if p.Tag > 0 {
-				print(p.String())
-			}
-			print("\n")
-		}
-	}
-
-	// Re-order prop.order.
-	sort.Sort(prop)
-
-	type oneofMessage interface {
-		XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
-	}
-	if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok {
-		var oots []interface{}
-		_, _, _, oots = om.XXX_OneofFuncs()
-
-		// Interpret oneof metadata.
-		prop.OneofTypes = make(map[string]*OneofProperties)
-		for _, oot := range oots {
-			oop := &OneofProperties{
-				Type: reflect.ValueOf(oot).Type(), // *T
-				Prop: new(Properties),
-			}
-			sft := oop.Type.Elem().Field(0)
-			oop.Prop.Name = sft.Name
-			oop.Prop.Parse(sft.Tag.Get("protobuf"))
-			// There will be exactly one interface field that
-			// this new value is assignable to.
-			for i := 0; i < t.NumField(); i++ {
-				f := t.Field(i)
-				if f.Type.Kind() != reflect.Interface {
-					continue
-				}
-				if !oop.Type.AssignableTo(f.Type) {
-					continue
-				}
-				oop.Field = i
-				break
-			}
-			prop.OneofTypes[oop.Prop.OrigName] = oop
-		}
-	}
-
-	// build required counts
-	// build tags
-	reqCount := 0
-	prop.decoderOrigNames = make(map[string]int)
-	for i, p := range prop.Prop {
-		if strings.HasPrefix(p.Name, "XXX_") {
-			// Internal fields should not appear in tags/origNames maps.
-			// They are handled specially when encoding and decoding.
-			continue
-		}
-		if p.Required {
-			reqCount++
-		}
-		prop.decoderTags.put(p.Tag, i)
-		prop.decoderOrigNames[p.OrigName] = i
-	}
-	prop.reqCount = reqCount
-
-	return prop
-}
-
-// A global registry of enum types.
-// The generated code will register the generated maps by calling RegisterEnum.
-
-var enumValueMaps = make(map[string]map[string]int32)
-
-// RegisterEnum is called from the generated code to install the enum descriptor
-// maps into the global table to aid parsing text format protocol buffers.
-func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {
-	if _, ok := enumValueMaps[typeName]; ok {
-		panic("proto: duplicate enum registered: " + typeName)
-	}
-	enumValueMaps[typeName] = valueMap
-}
-
-// EnumValueMap returns the mapping from names to integers of the
-// enum type enumType, or a nil if not found.
-func EnumValueMap(enumType string) map[string]int32 {
-	return enumValueMaps[enumType]
-}
-
-// A registry of all linked message types.
-// The string is a fully-qualified proto name ("pkg.Message").
-var (
-	protoTypedNils = make(map[string]Message)      // a map from proto names to typed nil pointers
-	protoMapTypes  = make(map[string]reflect.Type) // a map from proto names to map types
-	revProtoTypes  = make(map[reflect.Type]string)
-)
-
-// RegisterType is called from generated code and maps from the fully qualified
-// proto name to the type (pointer to struct) of the protocol buffer.
-func RegisterType(x Message, name string) {
-	if _, ok := protoTypedNils[name]; ok {
-		// TODO: Some day, make this a panic.
-		log.Printf("proto: duplicate proto type registered: %s", name)
-		return
-	}
-	t := reflect.TypeOf(x)
-	if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 {
-		// Generated code always calls RegisterType with nil x.
-		// This check is just for extra safety.
-		protoTypedNils[name] = x
-	} else {
-		protoTypedNils[name] = reflect.Zero(t).Interface().(Message)
-	}
-	revProtoTypes[t] = name
-}
-
-// RegisterMapType is called from generated code and maps from the fully qualified
-// proto name to the native map type of the proto map definition.
-func RegisterMapType(x interface{}, name string) {
-	if reflect.TypeOf(x).Kind() != reflect.Map {
-		panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name))
-	}
-	if _, ok := protoMapTypes[name]; ok {
-		log.Printf("proto: duplicate proto type registered: %s", name)
-		return
-	}
-	t := reflect.TypeOf(x)
-	protoMapTypes[name] = t
-	revProtoTypes[t] = name
-}
-
-// MessageName returns the fully-qualified proto name for the given message type.
-func MessageName(x Message) string {
-	type xname interface {
-		XXX_MessageName() string
-	}
-	if m, ok := x.(xname); ok {
-		return m.XXX_MessageName()
-	}
-	return revProtoTypes[reflect.TypeOf(x)]
-}
-
-// MessageType returns the message type (pointer to struct) for a named message.
-// The type is not guaranteed to implement proto.Message if the name refers to a
-// map entry.
-func MessageType(name string) reflect.Type {
-	if t, ok := protoTypedNils[name]; ok {
-		return reflect.TypeOf(t)
-	}
-	return protoMapTypes[name]
-}
-
-// A registry of all linked proto files.
-var (
-	protoFiles = make(map[string][]byte) // file name => fileDescriptor
-)
-
-// RegisterFile is called from generated code and maps from the
-// full file name of a .proto file to its compressed FileDescriptorProto.
-func RegisterFile(filename string, fileDescriptor []byte) {
-	protoFiles[filename] = fileDescriptor
-}
-
-// FileDescriptor returns the compressed FileDescriptorProto for a .proto file.
-func FileDescriptor(filename string) []byte { return protoFiles[filename] }

+ 0 - 2767
vendor/github.com/golang/protobuf/proto/table_marshal.go

@@ -1,2767 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
-	"errors"
-	"fmt"
-	"math"
-	"reflect"
-	"sort"
-	"strconv"
-	"strings"
-	"sync"
-	"sync/atomic"
-	"unicode/utf8"
-)
-
-// a sizer takes a pointer to a field and the size of its tag, computes the size of
-// the encoded data.
-type sizer func(pointer, int) int
-
-// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format),
-// marshals the field to the end of the slice, returns the slice and error (if any).
-type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error)
-
-// marshalInfo is the information used for marshaling a message.
-type marshalInfo struct {
-	typ          reflect.Type
-	fields       []*marshalFieldInfo
-	unrecognized field                      // offset of XXX_unrecognized
-	extensions   field                      // offset of XXX_InternalExtensions
-	v1extensions field                      // offset of XXX_extensions
-	sizecache    field                      // offset of XXX_sizecache
-	initialized  int32                      // 0 -- only typ is set, 1 -- fully initialized
-	messageset   bool                       // uses message set wire format
-	hasmarshaler bool                       // has custom marshaler
-	sync.RWMutex                            // protect extElems map, also for initialization
-	extElems     map[int32]*marshalElemInfo // info of extension elements
-}
-
-// marshalFieldInfo is the information used for marshaling a field of a message.
-type marshalFieldInfo struct {
-	field      field
-	wiretag    uint64 // tag in wire format
-	tagsize    int    // size of tag in wire format
-	sizer      sizer
-	marshaler  marshaler
-	isPointer  bool
-	required   bool                              // field is required
-	name       string                            // name of the field, for error reporting
-	oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements
-}
-
-// marshalElemInfo is the information used for marshaling an extension or oneof element.
-type marshalElemInfo struct {
-	wiretag   uint64 // tag in wire format
-	tagsize   int    // size of tag in wire format
-	sizer     sizer
-	marshaler marshaler
-	isptr     bool // elem is pointer typed, thus interface of this type is a direct interface (extension only)
-}
-
-var (
-	marshalInfoMap  = map[reflect.Type]*marshalInfo{}
-	marshalInfoLock sync.Mutex
-)
-
-// getMarshalInfo returns the information to marshal a given type of message.
-// The info it returns may not necessarily initialized.
-// t is the type of the message (NOT the pointer to it).
-func getMarshalInfo(t reflect.Type) *marshalInfo {
-	marshalInfoLock.Lock()
-	u, ok := marshalInfoMap[t]
-	if !ok {
-		u = &marshalInfo{typ: t}
-		marshalInfoMap[t] = u
-	}
-	marshalInfoLock.Unlock()
-	return u
-}
-
-// Size is the entry point from generated code,
-// and should be ONLY called by generated code.
-// It computes the size of encoded data of msg.
-// a is a pointer to a place to store cached marshal info.
-func (a *InternalMessageInfo) Size(msg Message) int {
-	u := getMessageMarshalInfo(msg, a)
-	ptr := toPointer(&msg)
-	if ptr.isNil() {
-		// We get here if msg is a typed nil ((*SomeMessage)(nil)),
-		// so it satisfies the interface, and msg == nil wouldn't
-		// catch it. We don't want crash in this case.
-		return 0
-	}
-	return u.size(ptr)
-}
-
-// Marshal is the entry point from generated code,
-// and should be ONLY called by generated code.
-// It marshals msg to the end of b.
-// a is a pointer to a place to store cached marshal info.
-func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) {
-	u := getMessageMarshalInfo(msg, a)
-	ptr := toPointer(&msg)
-	if ptr.isNil() {
-		// We get here if msg is a typed nil ((*SomeMessage)(nil)),
-		// so it satisfies the interface, and msg == nil wouldn't
-		// catch it. We don't want crash in this case.
-		return b, ErrNil
-	}
-	return u.marshal(b, ptr, deterministic)
-}
-
-func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo {
-	// u := a.marshal, but atomically.
-	// We use an atomic here to ensure memory consistency.
-	u := atomicLoadMarshalInfo(&a.marshal)
-	if u == nil {
-		// Get marshal information from type of message.
-		t := reflect.ValueOf(msg).Type()
-		if t.Kind() != reflect.Ptr {
-			panic(fmt.Sprintf("cannot handle non-pointer message type %v", t))
-		}
-		u = getMarshalInfo(t.Elem())
-		// Store it in the cache for later users.
-		// a.marshal = u, but atomically.
-		atomicStoreMarshalInfo(&a.marshal, u)
-	}
-	return u
-}
-
-// size is the main function to compute the size of the encoded data of a message.
-// ptr is the pointer to the message.
-func (u *marshalInfo) size(ptr pointer) int {
-	if atomic.LoadInt32(&u.initialized) == 0 {
-		u.computeMarshalInfo()
-	}
-
-	// If the message can marshal itself, let it do it, for compatibility.
-	// NOTE: This is not efficient.
-	if u.hasmarshaler {
-		m := ptr.asPointerTo(u.typ).Interface().(Marshaler)
-		b, _ := m.Marshal()
-		return len(b)
-	}
-
-	n := 0
-	for _, f := range u.fields {
-		if f.isPointer && ptr.offset(f.field).getPointer().isNil() {
-			// nil pointer always marshals to nothing
-			continue
-		}
-		n += f.sizer(ptr.offset(f.field), f.tagsize)
-	}
-	if u.extensions.IsValid() {
-		e := ptr.offset(u.extensions).toExtensions()
-		if u.messageset {
-			n += u.sizeMessageSet(e)
-		} else {
-			n += u.sizeExtensions(e)
-		}
-	}
-	if u.v1extensions.IsValid() {
-		m := *ptr.offset(u.v1extensions).toOldExtensions()
-		n += u.sizeV1Extensions(m)
-	}
-	if u.unrecognized.IsValid() {
-		s := *ptr.offset(u.unrecognized).toBytes()
-		n += len(s)
-	}
-	// cache the result for use in marshal
-	if u.sizecache.IsValid() {
-		atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n))
-	}
-	return n
-}
-
-// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated),
-// fall back to compute the size.
-func (u *marshalInfo) cachedsize(ptr pointer) int {
-	if u.sizecache.IsValid() {
-		return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32()))
-	}
-	return u.size(ptr)
-}
-
-// marshal is the main function to marshal a message. It takes a byte slice and appends
-// the encoded data to the end of the slice, returns the slice and error (if any).
-// ptr is the pointer to the message.
-// If deterministic is true, map is marshaled in deterministic order.
-func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) {
-	if atomic.LoadInt32(&u.initialized) == 0 {
-		u.computeMarshalInfo()
-	}
-
-	// If the message can marshal itself, let it do it, for compatibility.
-	// NOTE: This is not efficient.
-	if u.hasmarshaler {
-		m := ptr.asPointerTo(u.typ).Interface().(Marshaler)
-		b1, err := m.Marshal()
-		b = append(b, b1...)
-		return b, err
-	}
-
-	var err, errLater error
-	// The old marshaler encodes extensions at beginning.
-	if u.extensions.IsValid() {
-		e := ptr.offset(u.extensions).toExtensions()
-		if u.messageset {
-			b, err = u.appendMessageSet(b, e, deterministic)
-		} else {
-			b, err = u.appendExtensions(b, e, deterministic)
-		}
-		if err != nil {
-			return b, err
-		}
-	}
-	if u.v1extensions.IsValid() {
-		m := *ptr.offset(u.v1extensions).toOldExtensions()
-		b, err = u.appendV1Extensions(b, m, deterministic)
-		if err != nil {
-			return b, err
-		}
-	}
-	for _, f := range u.fields {
-		if f.required {
-			if ptr.offset(f.field).getPointer().isNil() {
-				// Required field is not set.
-				// We record the error but keep going, to give a complete marshaling.
-				if errLater == nil {
-					errLater = &RequiredNotSetError{f.name}
-				}
-				continue
-			}
-		}
-		if f.isPointer && ptr.offset(f.field).getPointer().isNil() {
-			// nil pointer always marshals to nothing
-			continue
-		}
-		b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic)
-		if err != nil {
-			if err1, ok := err.(*RequiredNotSetError); ok {
-				// Required field in submessage is not set.
-				// We record the error but keep going, to give a complete marshaling.
-				if errLater == nil {
-					errLater = &RequiredNotSetError{f.name + "." + err1.field}
-				}
-				continue
-			}
-			if err == errRepeatedHasNil {
-				err = errors.New("proto: repeated field " + f.name + " has nil element")
-			}
-			if err == errInvalidUTF8 {
-				if errLater == nil {
-					fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
-					errLater = &invalidUTF8Error{fullName}
-				}
-				continue
-			}
-			return b, err
-		}
-	}
-	if u.unrecognized.IsValid() {
-		s := *ptr.offset(u.unrecognized).toBytes()
-		b = append(b, s...)
-	}
-	return b, errLater
-}
-
-// computeMarshalInfo initializes the marshal info.
-func (u *marshalInfo) computeMarshalInfo() {
-	u.Lock()
-	defer u.Unlock()
-	if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock
-		return
-	}
-
-	t := u.typ
-	u.unrecognized = invalidField
-	u.extensions = invalidField
-	u.v1extensions = invalidField
-	u.sizecache = invalidField
-
-	// If the message can marshal itself, let it do it, for compatibility.
-	// NOTE: This is not efficient.
-	if reflect.PtrTo(t).Implements(marshalerType) {
-		u.hasmarshaler = true
-		atomic.StoreInt32(&u.initialized, 1)
-		return
-	}
-
-	// get oneof implementers
-	var oneofImplementers []interface{}
-	if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok {
-		_, _, _, oneofImplementers = m.XXX_OneofFuncs()
-	}
-
-	n := t.NumField()
-
-	// deal with XXX fields first
-	for i := 0; i < t.NumField(); i++ {
-		f := t.Field(i)
-		if !strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-		switch f.Name {
-		case "XXX_sizecache":
-			u.sizecache = toField(&f)
-		case "XXX_unrecognized":
-			u.unrecognized = toField(&f)
-		case "XXX_InternalExtensions":
-			u.extensions = toField(&f)
-			u.messageset = f.Tag.Get("protobuf_messageset") == "1"
-		case "XXX_extensions":
-			u.v1extensions = toField(&f)
-		case "XXX_NoUnkeyedLiteral":
-			// nothing to do
-		default:
-			panic("unknown XXX field: " + f.Name)
-		}
-		n--
-	}
-
-	// normal fields
-	fields := make([]marshalFieldInfo, n) // batch allocation
-	u.fields = make([]*marshalFieldInfo, 0, n)
-	for i, j := 0, 0; i < t.NumField(); i++ {
-		f := t.Field(i)
-
-		if strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-		field := &fields[j]
-		j++
-		field.name = f.Name
-		u.fields = append(u.fields, field)
-		if f.Tag.Get("protobuf_oneof") != "" {
-			field.computeOneofFieldInfo(&f, oneofImplementers)
-			continue
-		}
-		if f.Tag.Get("protobuf") == "" {
-			// field has no tag (not in generated message), ignore it
-			u.fields = u.fields[:len(u.fields)-1]
-			j--
-			continue
-		}
-		field.computeMarshalFieldInfo(&f)
-	}
-
-	// fields are marshaled in tag order on the wire.
-	sort.Sort(byTag(u.fields))
-
-	atomic.StoreInt32(&u.initialized, 1)
-}
-
-// helper for sorting fields by tag
-type byTag []*marshalFieldInfo
-
-func (a byTag) Len() int           { return len(a) }
-func (a byTag) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
-func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag }
-
-// getExtElemInfo returns the information to marshal an extension element.
-// The info it returns is initialized.
-func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo {
-	// get from cache first
-	u.RLock()
-	e, ok := u.extElems[desc.Field]
-	u.RUnlock()
-	if ok {
-		return e
-	}
-
-	t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct
-	tags := strings.Split(desc.Tag, ",")
-	tag, err := strconv.Atoi(tags[1])
-	if err != nil {
-		panic("tag is not an integer")
-	}
-	wt := wiretype(tags[0])
-	sizer, marshaler := typeMarshaler(t, tags, false, false)
-	e = &marshalElemInfo{
-		wiretag:   uint64(tag)<<3 | wt,
-		tagsize:   SizeVarint(uint64(tag) << 3),
-		sizer:     sizer,
-		marshaler: marshaler,
-		isptr:     t.Kind() == reflect.Ptr,
-	}
-
-	// update cache
-	u.Lock()
-	if u.extElems == nil {
-		u.extElems = make(map[int32]*marshalElemInfo)
-	}
-	u.extElems[desc.Field] = e
-	u.Unlock()
-	return e
-}
-
-// computeMarshalFieldInfo fills up the information to marshal a field.
-func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) {
-	// parse protobuf tag of the field.
-	// tag has format of "bytes,49,opt,name=foo,def=hello!"
-	tags := strings.Split(f.Tag.Get("protobuf"), ",")
-	if tags[0] == "" {
-		return
-	}
-	tag, err := strconv.Atoi(tags[1])
-	if err != nil {
-		panic("tag is not an integer")
-	}
-	wt := wiretype(tags[0])
-	if tags[2] == "req" {
-		fi.required = true
-	}
-	fi.setTag(f, tag, wt)
-	fi.setMarshaler(f, tags)
-}
-
-func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) {
-	fi.field = toField(f)
-	fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire.
-	fi.isPointer = true
-	fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f)
-	fi.oneofElems = make(map[reflect.Type]*marshalElemInfo)
-
-	ityp := f.Type // interface type
-	for _, o := range oneofImplementers {
-		t := reflect.TypeOf(o)
-		if !t.Implements(ityp) {
-			continue
-		}
-		sf := t.Elem().Field(0) // oneof implementer is a struct with a single field
-		tags := strings.Split(sf.Tag.Get("protobuf"), ",")
-		tag, err := strconv.Atoi(tags[1])
-		if err != nil {
-			panic("tag is not an integer")
-		}
-		wt := wiretype(tags[0])
-		sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value
-		fi.oneofElems[t.Elem()] = &marshalElemInfo{
-			wiretag:   uint64(tag)<<3 | wt,
-			tagsize:   SizeVarint(uint64(tag) << 3),
-			sizer:     sizer,
-			marshaler: marshaler,
-		}
-	}
-}
-
-type oneofMessage interface {
-	XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
-}
-
-// wiretype returns the wire encoding of the type.
-func wiretype(encoding string) uint64 {
-	switch encoding {
-	case "fixed32":
-		return WireFixed32
-	case "fixed64":
-		return WireFixed64
-	case "varint", "zigzag32", "zigzag64":
-		return WireVarint
-	case "bytes":
-		return WireBytes
-	case "group":
-		return WireStartGroup
-	}
-	panic("unknown wire type " + encoding)
-}
-
-// setTag fills up the tag (in wire format) and its size in the info of a field.
-func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) {
-	fi.field = toField(f)
-	fi.wiretag = uint64(tag)<<3 | wt
-	fi.tagsize = SizeVarint(uint64(tag) << 3)
-}
-
-// setMarshaler fills up the sizer and marshaler in the info of a field.
-func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) {
-	switch f.Type.Kind() {
-	case reflect.Map:
-		// map field
-		fi.isPointer = true
-		fi.sizer, fi.marshaler = makeMapMarshaler(f)
-		return
-	case reflect.Ptr, reflect.Slice:
-		fi.isPointer = true
-	}
-	fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false)
-}
-
-// typeMarshaler returns the sizer and marshaler of a given field.
-// t is the type of the field.
-// tags is the generated "protobuf" tag of the field.
-// If nozero is true, zero value is not marshaled to the wire.
-// If oneof is true, it is a oneof field.
-func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) {
-	encoding := tags[0]
-
-	pointer := false
-	slice := false
-	if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
-		slice = true
-		t = t.Elem()
-	}
-	if t.Kind() == reflect.Ptr {
-		pointer = true
-		t = t.Elem()
-	}
-
-	packed := false
-	proto3 := false
-	validateUTF8 := true
-	for i := 2; i < len(tags); i++ {
-		if tags[i] == "packed" {
-			packed = true
-		}
-		if tags[i] == "proto3" {
-			proto3 = true
-		}
-	}
-	validateUTF8 = validateUTF8 && proto3
-
-	switch t.Kind() {
-	case reflect.Bool:
-		if pointer {
-			return sizeBoolPtr, appendBoolPtr
-		}
-		if slice {
-			if packed {
-				return sizeBoolPackedSlice, appendBoolPackedSlice
-			}
-			return sizeBoolSlice, appendBoolSlice
-		}
-		if nozero {
-			return sizeBoolValueNoZero, appendBoolValueNoZero
-		}
-		return sizeBoolValue, appendBoolValue
-	case reflect.Uint32:
-		switch encoding {
-		case "fixed32":
-			if pointer {
-				return sizeFixed32Ptr, appendFixed32Ptr
-			}
-			if slice {
-				if packed {
-					return sizeFixed32PackedSlice, appendFixed32PackedSlice
-				}
-				return sizeFixed32Slice, appendFixed32Slice
-			}
-			if nozero {
-				return sizeFixed32ValueNoZero, appendFixed32ValueNoZero
-			}
-			return sizeFixed32Value, appendFixed32Value
-		case "varint":
-			if pointer {
-				return sizeVarint32Ptr, appendVarint32Ptr
-			}
-			if slice {
-				if packed {
-					return sizeVarint32PackedSlice, appendVarint32PackedSlice
-				}
-				return sizeVarint32Slice, appendVarint32Slice
-			}
-			if nozero {
-				return sizeVarint32ValueNoZero, appendVarint32ValueNoZero
-			}
-			return sizeVarint32Value, appendVarint32Value
-		}
-	case reflect.Int32:
-		switch encoding {
-		case "fixed32":
-			if pointer {
-				return sizeFixedS32Ptr, appendFixedS32Ptr
-			}
-			if slice {
-				if packed {
-					return sizeFixedS32PackedSlice, appendFixedS32PackedSlice
-				}
-				return sizeFixedS32Slice, appendFixedS32Slice
-			}
-			if nozero {
-				return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero
-			}
-			return sizeFixedS32Value, appendFixedS32Value
-		case "varint":
-			if pointer {
-				return sizeVarintS32Ptr, appendVarintS32Ptr
-			}
-			if slice {
-				if packed {
-					return sizeVarintS32PackedSlice, appendVarintS32PackedSlice
-				}
-				return sizeVarintS32Slice, appendVarintS32Slice
-			}
-			if nozero {
-				return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero
-			}
-			return sizeVarintS32Value, appendVarintS32Value
-		case "zigzag32":
-			if pointer {
-				return sizeZigzag32Ptr, appendZigzag32Ptr
-			}
-			if slice {
-				if packed {
-					return sizeZigzag32PackedSlice, appendZigzag32PackedSlice
-				}
-				return sizeZigzag32Slice, appendZigzag32Slice
-			}
-			if nozero {
-				return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero
-			}
-			return sizeZigzag32Value, appendZigzag32Value
-		}
-	case reflect.Uint64:
-		switch encoding {
-		case "fixed64":
-			if pointer {
-				return sizeFixed64Ptr, appendFixed64Ptr
-			}
-			if slice {
-				if packed {
-					return sizeFixed64PackedSlice, appendFixed64PackedSlice
-				}
-				return sizeFixed64Slice, appendFixed64Slice
-			}
-			if nozero {
-				return sizeFixed64ValueNoZero, appendFixed64ValueNoZero
-			}
-			return sizeFixed64Value, appendFixed64Value
-		case "varint":
-			if pointer {
-				return sizeVarint64Ptr, appendVarint64Ptr
-			}
-			if slice {
-				if packed {
-					return sizeVarint64PackedSlice, appendVarint64PackedSlice
-				}
-				return sizeVarint64Slice, appendVarint64Slice
-			}
-			if nozero {
-				return sizeVarint64ValueNoZero, appendVarint64ValueNoZero
-			}
-			return sizeVarint64Value, appendVarint64Value
-		}
-	case reflect.Int64:
-		switch encoding {
-		case "fixed64":
-			if pointer {
-				return sizeFixedS64Ptr, appendFixedS64Ptr
-			}
-			if slice {
-				if packed {
-					return sizeFixedS64PackedSlice, appendFixedS64PackedSlice
-				}
-				return sizeFixedS64Slice, appendFixedS64Slice
-			}
-			if nozero {
-				return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero
-			}
-			return sizeFixedS64Value, appendFixedS64Value
-		case "varint":
-			if pointer {
-				return sizeVarintS64Ptr, appendVarintS64Ptr
-			}
-			if slice {
-				if packed {
-					return sizeVarintS64PackedSlice, appendVarintS64PackedSlice
-				}
-				return sizeVarintS64Slice, appendVarintS64Slice
-			}
-			if nozero {
-				return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero
-			}
-			return sizeVarintS64Value, appendVarintS64Value
-		case "zigzag64":
-			if pointer {
-				return sizeZigzag64Ptr, appendZigzag64Ptr
-			}
-			if slice {
-				if packed {
-					return sizeZigzag64PackedSlice, appendZigzag64PackedSlice
-				}
-				return sizeZigzag64Slice, appendZigzag64Slice
-			}
-			if nozero {
-				return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero
-			}
-			return sizeZigzag64Value, appendZigzag64Value
-		}
-	case reflect.Float32:
-		if pointer {
-			return sizeFloat32Ptr, appendFloat32Ptr
-		}
-		if slice {
-			if packed {
-				return sizeFloat32PackedSlice, appendFloat32PackedSlice
-			}
-			return sizeFloat32Slice, appendFloat32Slice
-		}
-		if nozero {
-			return sizeFloat32ValueNoZero, appendFloat32ValueNoZero
-		}
-		return sizeFloat32Value, appendFloat32Value
-	case reflect.Float64:
-		if pointer {
-			return sizeFloat64Ptr, appendFloat64Ptr
-		}
-		if slice {
-			if packed {
-				return sizeFloat64PackedSlice, appendFloat64PackedSlice
-			}
-			return sizeFloat64Slice, appendFloat64Slice
-		}
-		if nozero {
-			return sizeFloat64ValueNoZero, appendFloat64ValueNoZero
-		}
-		return sizeFloat64Value, appendFloat64Value
-	case reflect.String:
-		if validateUTF8 {
-			if pointer {
-				return sizeStringPtr, appendUTF8StringPtr
-			}
-			if slice {
-				return sizeStringSlice, appendUTF8StringSlice
-			}
-			if nozero {
-				return sizeStringValueNoZero, appendUTF8StringValueNoZero
-			}
-			return sizeStringValue, appendUTF8StringValue
-		}
-		if pointer {
-			return sizeStringPtr, appendStringPtr
-		}
-		if slice {
-			return sizeStringSlice, appendStringSlice
-		}
-		if nozero {
-			return sizeStringValueNoZero, appendStringValueNoZero
-		}
-		return sizeStringValue, appendStringValue
-	case reflect.Slice:
-		if slice {
-			return sizeBytesSlice, appendBytesSlice
-		}
-		if oneof {
-			// Oneof bytes field may also have "proto3" tag.
-			// We want to marshal it as a oneof field. Do this
-			// check before the proto3 check.
-			return sizeBytesOneof, appendBytesOneof
-		}
-		if proto3 {
-			return sizeBytes3, appendBytes3
-		}
-		return sizeBytes, appendBytes
-	case reflect.Struct:
-		switch encoding {
-		case "group":
-			if slice {
-				return makeGroupSliceMarshaler(getMarshalInfo(t))
-			}
-			return makeGroupMarshaler(getMarshalInfo(t))
-		case "bytes":
-			if slice {
-				return makeMessageSliceMarshaler(getMarshalInfo(t))
-			}
-			return makeMessageMarshaler(getMarshalInfo(t))
-		}
-	}
-	panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding))
-}
-
-// Below are functions to size/marshal a specific type of a field.
-// They are stored in the field's info, and called by function pointers.
-// They have type sizer or marshaler.
-
-func sizeFixed32Value(_ pointer, tagsize int) int {
-	return 4 + tagsize
-}
-func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toUint32()
-	if v == 0 {
-		return 0
-	}
-	return 4 + tagsize
-}
-func sizeFixed32Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toUint32Ptr()
-	if p == nil {
-		return 0
-	}
-	return 4 + tagsize
-}
-func sizeFixed32Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint32Slice()
-	return (4 + tagsize) * len(s)
-}
-func sizeFixed32PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint32Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFixedS32Value(_ pointer, tagsize int) int {
-	return 4 + tagsize
-}
-func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toInt32()
-	if v == 0 {
-		return 0
-	}
-	return 4 + tagsize
-}
-func sizeFixedS32Ptr(ptr pointer, tagsize int) int {
-	p := ptr.getInt32Ptr()
-	if p == nil {
-		return 0
-	}
-	return 4 + tagsize
-}
-func sizeFixedS32Slice(ptr pointer, tagsize int) int {
-	s := ptr.getInt32Slice()
-	return (4 + tagsize) * len(s)
-}
-func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int {
-	s := ptr.getInt32Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFloat32Value(_ pointer, tagsize int) int {
-	return 4 + tagsize
-}
-func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int {
-	v := math.Float32bits(*ptr.toFloat32())
-	if v == 0 {
-		return 0
-	}
-	return 4 + tagsize
-}
-func sizeFloat32Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toFloat32Ptr()
-	if p == nil {
-		return 0
-	}
-	return 4 + tagsize
-}
-func sizeFloat32Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toFloat32Slice()
-	return (4 + tagsize) * len(s)
-}
-func sizeFloat32PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toFloat32Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFixed64Value(_ pointer, tagsize int) int {
-	return 8 + tagsize
-}
-func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toUint64()
-	if v == 0 {
-		return 0
-	}
-	return 8 + tagsize
-}
-func sizeFixed64Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toUint64Ptr()
-	if p == nil {
-		return 0
-	}
-	return 8 + tagsize
-}
-func sizeFixed64Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint64Slice()
-	return (8 + tagsize) * len(s)
-}
-func sizeFixed64PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint64Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeFixedS64Value(_ pointer, tagsize int) int {
-	return 8 + tagsize
-}
-func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toInt64()
-	if v == 0 {
-		return 0
-	}
-	return 8 + tagsize
-}
-func sizeFixedS64Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toInt64Ptr()
-	if p == nil {
-		return 0
-	}
-	return 8 + tagsize
-}
-func sizeFixedS64Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toInt64Slice()
-	return (8 + tagsize) * len(s)
-}
-func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toInt64Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeFloat64Value(_ pointer, tagsize int) int {
-	return 8 + tagsize
-}
-func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int {
-	v := math.Float64bits(*ptr.toFloat64())
-	if v == 0 {
-		return 0
-	}
-	return 8 + tagsize
-}
-func sizeFloat64Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toFloat64Ptr()
-	if p == nil {
-		return 0
-	}
-	return 8 + tagsize
-}
-func sizeFloat64Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toFloat64Slice()
-	return (8 + tagsize) * len(s)
-}
-func sizeFloat64PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toFloat64Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeVarint32Value(ptr pointer, tagsize int) int {
-	v := *ptr.toUint32()
-	return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toUint32()
-	if v == 0 {
-		return 0
-	}
-	return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarint32Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toUint32Ptr()
-	if p == nil {
-		return 0
-	}
-	return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarint32Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint32Slice()
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v)) + tagsize
-	}
-	return n
-}
-func sizeVarint32PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint32Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v))
-	}
-	return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarintS32Value(ptr pointer, tagsize int) int {
-	v := *ptr.toInt32()
-	return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toInt32()
-	if v == 0 {
-		return 0
-	}
-	return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS32Ptr(ptr pointer, tagsize int) int {
-	p := ptr.getInt32Ptr()
-	if p == nil {
-		return 0
-	}
-	return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarintS32Slice(ptr pointer, tagsize int) int {
-	s := ptr.getInt32Slice()
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v)) + tagsize
-	}
-	return n
-}
-func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int {
-	s := ptr.getInt32Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v))
-	}
-	return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarint64Value(ptr pointer, tagsize int) int {
-	v := *ptr.toUint64()
-	return SizeVarint(v) + tagsize
-}
-func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toUint64()
-	if v == 0 {
-		return 0
-	}
-	return SizeVarint(v) + tagsize
-}
-func sizeVarint64Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toUint64Ptr()
-	if p == nil {
-		return 0
-	}
-	return SizeVarint(*p) + tagsize
-}
-func sizeVarint64Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint64Slice()
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(v) + tagsize
-	}
-	return n
-}
-func sizeVarint64PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toUint64Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(v)
-	}
-	return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarintS64Value(ptr pointer, tagsize int) int {
-	v := *ptr.toInt64()
-	return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toInt64()
-	if v == 0 {
-		return 0
-	}
-	return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS64Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toInt64Ptr()
-	if p == nil {
-		return 0
-	}
-	return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarintS64Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toInt64Slice()
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v)) + tagsize
-	}
-	return n
-}
-func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toInt64Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v))
-	}
-	return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeZigzag32Value(ptr pointer, tagsize int) int {
-	v := *ptr.toInt32()
-	return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toInt32()
-	if v == 0 {
-		return 0
-	}
-	return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32Ptr(ptr pointer, tagsize int) int {
-	p := ptr.getInt32Ptr()
-	if p == nil {
-		return 0
-	}
-	v := *p
-	return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32Slice(ptr pointer, tagsize int) int {
-	s := ptr.getInt32Slice()
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-	}
-	return n
-}
-func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int {
-	s := ptr.getInt32Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
-	}
-	return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeZigzag64Value(ptr pointer, tagsize int) int {
-	v := *ptr.toInt64()
-	return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toInt64()
-	if v == 0 {
-		return 0
-	}
-	return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64Ptr(ptr pointer, tagsize int) int {
-	p := *ptr.toInt64Ptr()
-	if p == nil {
-		return 0
-	}
-	v := *p
-	return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64Slice(ptr pointer, tagsize int) int {
-	s := *ptr.toInt64Slice()
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-	}
-	return n
-}
-func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toInt64Slice()
-	if len(s) == 0 {
-		return 0
-	}
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63)))
-	}
-	return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeBoolValue(_ pointer, tagsize int) int {
-	return 1 + tagsize
-}
-func sizeBoolValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toBool()
-	if !v {
-		return 0
-	}
-	return 1 + tagsize
-}
-func sizeBoolPtr(ptr pointer, tagsize int) int {
-	p := *ptr.toBoolPtr()
-	if p == nil {
-		return 0
-	}
-	return 1 + tagsize
-}
-func sizeBoolSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toBoolSlice()
-	return (1 + tagsize) * len(s)
-}
-func sizeBoolPackedSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toBoolSlice()
-	if len(s) == 0 {
-		return 0
-	}
-	return len(s) + SizeVarint(uint64(len(s))) + tagsize
-}
-func sizeStringValue(ptr pointer, tagsize int) int {
-	v := *ptr.toString()
-	return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringValueNoZero(ptr pointer, tagsize int) int {
-	v := *ptr.toString()
-	if v == "" {
-		return 0
-	}
-	return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringPtr(ptr pointer, tagsize int) int {
-	p := *ptr.toStringPtr()
-	if p == nil {
-		return 0
-	}
-	v := *p
-	return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toStringSlice()
-	n := 0
-	for _, v := range s {
-		n += len(v) + SizeVarint(uint64(len(v))) + tagsize
-	}
-	return n
-}
-func sizeBytes(ptr pointer, tagsize int) int {
-	v := *ptr.toBytes()
-	if v == nil {
-		return 0
-	}
-	return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytes3(ptr pointer, tagsize int) int {
-	v := *ptr.toBytes()
-	if len(v) == 0 {
-		return 0
-	}
-	return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytesOneof(ptr pointer, tagsize int) int {
-	v := *ptr.toBytes()
-	return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytesSlice(ptr pointer, tagsize int) int {
-	s := *ptr.toBytesSlice()
-	n := 0
-	for _, v := range s {
-		n += len(v) + SizeVarint(uint64(len(v))) + tagsize
-	}
-	return n
-}
-
-// appendFixed32 appends an encoded fixed32 to b.
-func appendFixed32(b []byte, v uint32) []byte {
-	b = append(b,
-		byte(v),
-		byte(v>>8),
-		byte(v>>16),
-		byte(v>>24))
-	return b
-}
-
-// appendFixed64 appends an encoded fixed64 to b.
-func appendFixed64(b []byte, v uint64) []byte {
-	b = append(b,
-		byte(v),
-		byte(v>>8),
-		byte(v>>16),
-		byte(v>>24),
-		byte(v>>32),
-		byte(v>>40),
-		byte(v>>48),
-		byte(v>>56))
-	return b
-}
-
-// appendVarint appends an encoded varint to b.
-func appendVarint(b []byte, v uint64) []byte {
-	// TODO: make 1-byte (maybe 2-byte) case inline-able, once we
-	// have non-leaf inliner.
-	switch {
-	case v < 1<<7:
-		b = append(b, byte(v))
-	case v < 1<<14:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte(v>>7))
-	case v < 1<<21:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte(v>>14))
-	case v < 1<<28:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte(v>>21))
-	case v < 1<<35:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte((v>>21)&0x7f|0x80),
-			byte(v>>28))
-	case v < 1<<42:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte((v>>21)&0x7f|0x80),
-			byte((v>>28)&0x7f|0x80),
-			byte(v>>35))
-	case v < 1<<49:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte((v>>21)&0x7f|0x80),
-			byte((v>>28)&0x7f|0x80),
-			byte((v>>35)&0x7f|0x80),
-			byte(v>>42))
-	case v < 1<<56:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte((v>>21)&0x7f|0x80),
-			byte((v>>28)&0x7f|0x80),
-			byte((v>>35)&0x7f|0x80),
-			byte((v>>42)&0x7f|0x80),
-			byte(v>>49))
-	case v < 1<<63:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte((v>>21)&0x7f|0x80),
-			byte((v>>28)&0x7f|0x80),
-			byte((v>>35)&0x7f|0x80),
-			byte((v>>42)&0x7f|0x80),
-			byte((v>>49)&0x7f|0x80),
-			byte(v>>56))
-	default:
-		b = append(b,
-			byte(v&0x7f|0x80),
-			byte((v>>7)&0x7f|0x80),
-			byte((v>>14)&0x7f|0x80),
-			byte((v>>21)&0x7f|0x80),
-			byte((v>>28)&0x7f|0x80),
-			byte((v>>35)&0x7f|0x80),
-			byte((v>>42)&0x7f|0x80),
-			byte((v>>49)&0x7f|0x80),
-			byte((v>>56)&0x7f|0x80),
-			1)
-	}
-	return b
-}
-
-func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint32()
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, v)
-	return b, nil
-}
-func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint32()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, v)
-	return b, nil
-}
-func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toUint32Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, *p)
-	return b, nil
-}
-func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint32Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendFixed32(b, v)
-	}
-	return b, nil
-}
-func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint32Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(4*len(s)))
-	for _, v := range s {
-		b = appendFixed32(b, v)
-	}
-	return b, nil
-}
-func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt32()
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, uint32(v))
-	return b, nil
-}
-func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt32()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, uint32(v))
-	return b, nil
-}
-func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := ptr.getInt32Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, uint32(*p))
-	return b, nil
-}
-func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := ptr.getInt32Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendFixed32(b, uint32(v))
-	}
-	return b, nil
-}
-func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := ptr.getInt32Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(4*len(s)))
-	for _, v := range s {
-		b = appendFixed32(b, uint32(v))
-	}
-	return b, nil
-}
-func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := math.Float32bits(*ptr.toFloat32())
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, v)
-	return b, nil
-}
-func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := math.Float32bits(*ptr.toFloat32())
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, v)
-	return b, nil
-}
-func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toFloat32Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed32(b, math.Float32bits(*p))
-	return b, nil
-}
-func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toFloat32Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendFixed32(b, math.Float32bits(v))
-	}
-	return b, nil
-}
-func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toFloat32Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(4*len(s)))
-	for _, v := range s {
-		b = appendFixed32(b, math.Float32bits(v))
-	}
-	return b, nil
-}
-func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint64()
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, v)
-	return b, nil
-}
-func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint64()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, v)
-	return b, nil
-}
-func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toUint64Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, *p)
-	return b, nil
-}
-func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint64Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendFixed64(b, v)
-	}
-	return b, nil
-}
-func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint64Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(8*len(s)))
-	for _, v := range s {
-		b = appendFixed64(b, v)
-	}
-	return b, nil
-}
-func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt64()
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, uint64(v))
-	return b, nil
-}
-func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt64()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, uint64(v))
-	return b, nil
-}
-func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toInt64Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, uint64(*p))
-	return b, nil
-}
-func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toInt64Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendFixed64(b, uint64(v))
-	}
-	return b, nil
-}
-func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toInt64Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(8*len(s)))
-	for _, v := range s {
-		b = appendFixed64(b, uint64(v))
-	}
-	return b, nil
-}
-func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := math.Float64bits(*ptr.toFloat64())
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, v)
-	return b, nil
-}
-func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := math.Float64bits(*ptr.toFloat64())
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, v)
-	return b, nil
-}
-func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toFloat64Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendFixed64(b, math.Float64bits(*p))
-	return b, nil
-}
-func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toFloat64Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendFixed64(b, math.Float64bits(v))
-	}
-	return b, nil
-}
-func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toFloat64Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(8*len(s)))
-	for _, v := range s {
-		b = appendFixed64(b, math.Float64bits(v))
-	}
-	return b, nil
-}
-func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint32()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v))
-	return b, nil
-}
-func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint32()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v))
-	return b, nil
-}
-func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toUint32Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(*p))
-	return b, nil
-}
-func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint32Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(v))
-	}
-	return b, nil
-}
-func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint32Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	// compute size
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v))
-	}
-	b = appendVarint(b, uint64(n))
-	for _, v := range s {
-		b = appendVarint(b, uint64(v))
-	}
-	return b, nil
-}
-func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt32()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v))
-	return b, nil
-}
-func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt32()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v))
-	return b, nil
-}
-func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := ptr.getInt32Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(*p))
-	return b, nil
-}
-func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := ptr.getInt32Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(v))
-	}
-	return b, nil
-}
-func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := ptr.getInt32Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	// compute size
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v))
-	}
-	b = appendVarint(b, uint64(n))
-	for _, v := range s {
-		b = appendVarint(b, uint64(v))
-	}
-	return b, nil
-}
-func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint64()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, v)
-	return b, nil
-}
-func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toUint64()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, v)
-	return b, nil
-}
-func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toUint64Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, *p)
-	return b, nil
-}
-func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint64Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, v)
-	}
-	return b, nil
-}
-func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toUint64Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	// compute size
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(v)
-	}
-	b = appendVarint(b, uint64(n))
-	for _, v := range s {
-		b = appendVarint(b, v)
-	}
-	return b, nil
-}
-func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt64()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v))
-	return b, nil
-}
-func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt64()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v))
-	return b, nil
-}
-func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toInt64Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(*p))
-	return b, nil
-}
-func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toInt64Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(v))
-	}
-	return b, nil
-}
-func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toInt64Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	// compute size
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v))
-	}
-	b = appendVarint(b, uint64(n))
-	for _, v := range s {
-		b = appendVarint(b, uint64(v))
-	}
-	return b, nil
-}
-func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt32()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
-	return b, nil
-}
-func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt32()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
-	return b, nil
-}
-func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := ptr.getInt32Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	v := *p
-	b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
-	return b, nil
-}
-func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := ptr.getInt32Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
-	}
-	return b, nil
-}
-func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := ptr.getInt32Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	// compute size
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
-	}
-	b = appendVarint(b, uint64(n))
-	for _, v := range s {
-		b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
-	}
-	return b, nil
-}
-func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt64()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
-	return b, nil
-}
-func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toInt64()
-	if v == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
-	return b, nil
-}
-func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toInt64Ptr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	v := *p
-	b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
-	return b, nil
-}
-func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toInt64Slice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
-	}
-	return b, nil
-}
-func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toInt64Slice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	// compute size
-	n := 0
-	for _, v := range s {
-		n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63)))
-	}
-	b = appendVarint(b, uint64(n))
-	for _, v := range s {
-		b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
-	}
-	return b, nil
-}
-func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toBool()
-	b = appendVarint(b, wiretag)
-	if v {
-		b = append(b, 1)
-	} else {
-		b = append(b, 0)
-	}
-	return b, nil
-}
-func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toBool()
-	if !v {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = append(b, 1)
-	return b, nil
-}
-
-func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toBoolPtr()
-	if p == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	if *p {
-		b = append(b, 1)
-	} else {
-		b = append(b, 0)
-	}
-	return b, nil
-}
-func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toBoolSlice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		if v {
-			b = append(b, 1)
-		} else {
-			b = append(b, 0)
-		}
-	}
-	return b, nil
-}
-func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toBoolSlice()
-	if len(s) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag&^7|WireBytes)
-	b = appendVarint(b, uint64(len(s)))
-	for _, v := range s {
-		if v {
-			b = append(b, 1)
-		} else {
-			b = append(b, 0)
-		}
-	}
-	return b, nil
-}
-func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toString()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	return b, nil
-}
-func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toString()
-	if v == "" {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	return b, nil
-}
-func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	p := *ptr.toStringPtr()
-	if p == nil {
-		return b, nil
-	}
-	v := *p
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	return b, nil
-}
-func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toStringSlice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(len(v)))
-		b = append(b, v...)
-	}
-	return b, nil
-}
-func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	var invalidUTF8 bool
-	v := *ptr.toString()
-	if !utf8.ValidString(v) {
-		invalidUTF8 = true
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	if invalidUTF8 {
-		return b, errInvalidUTF8
-	}
-	return b, nil
-}
-func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	var invalidUTF8 bool
-	v := *ptr.toString()
-	if v == "" {
-		return b, nil
-	}
-	if !utf8.ValidString(v) {
-		invalidUTF8 = true
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	if invalidUTF8 {
-		return b, errInvalidUTF8
-	}
-	return b, nil
-}
-func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	var invalidUTF8 bool
-	p := *ptr.toStringPtr()
-	if p == nil {
-		return b, nil
-	}
-	v := *p
-	if !utf8.ValidString(v) {
-		invalidUTF8 = true
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	if invalidUTF8 {
-		return b, errInvalidUTF8
-	}
-	return b, nil
-}
-func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	var invalidUTF8 bool
-	s := *ptr.toStringSlice()
-	for _, v := range s {
-		if !utf8.ValidString(v) {
-			invalidUTF8 = true
-		}
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(len(v)))
-		b = append(b, v...)
-	}
-	if invalidUTF8 {
-		return b, errInvalidUTF8
-	}
-	return b, nil
-}
-func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toBytes()
-	if v == nil {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	return b, nil
-}
-func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toBytes()
-	if len(v) == 0 {
-		return b, nil
-	}
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	return b, nil
-}
-func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	v := *ptr.toBytes()
-	b = appendVarint(b, wiretag)
-	b = appendVarint(b, uint64(len(v)))
-	b = append(b, v...)
-	return b, nil
-}
-func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
-	s := *ptr.toBytesSlice()
-	for _, v := range s {
-		b = appendVarint(b, wiretag)
-		b = appendVarint(b, uint64(len(v)))
-		b = append(b, v...)
-	}
-	return b, nil
-}
-
-// makeGroupMarshaler returns the sizer and marshaler for a group.
-// u is the marshal info of the underlying message.
-func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) {
-	return func(ptr pointer, tagsize int) int {
-			p := ptr.getPointer()
-			if p.isNil() {
-				return 0
-			}
-			return u.size(p) + 2*tagsize
-		},
-		func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
-			p := ptr.getPointer()
-			if p.isNil() {
-				return b, nil
-			}
-			var err error
-			b = appendVarint(b, wiretag) // start group
-			b, err = u.marshal(b, p, deterministic)
-			b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
-			return b, err
-		}
-}
-
-// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice.
-// u is the marshal info of the underlying message.
-func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
-	return func(ptr pointer, tagsize int) int {
-			s := ptr.getPointerSlice()
-			n := 0
-			for _, v := range s {
-				if v.isNil() {
-					continue
-				}
-				n += u.size(v) + 2*tagsize
-			}
-			return n
-		},
-		func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
-			s := ptr.getPointerSlice()
-			var err error
-			var nerr nonFatal
-			for _, v := range s {
-				if v.isNil() {
-					return b, errRepeatedHasNil
-				}
-				b = appendVarint(b, wiretag) // start group
-				b, err = u.marshal(b, v, deterministic)
-				b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
-				if !nerr.Merge(err) {
-					if err == ErrNil {
-						err = errRepeatedHasNil
-					}
-					return b, err
-				}
-			}
-			return b, nerr.E
-		}
-}
-
-// makeMessageMarshaler returns the sizer and marshaler for a message field.
-// u is the marshal info of the message.
-func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) {
-	return func(ptr pointer, tagsize int) int {
-			p := ptr.getPointer()
-			if p.isNil() {
-				return 0
-			}
-			siz := u.size(p)
-			return siz + SizeVarint(uint64(siz)) + tagsize
-		},
-		func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
-			p := ptr.getPointer()
-			if p.isNil() {
-				return b, nil
-			}
-			b = appendVarint(b, wiretag)
-			siz := u.cachedsize(p)
-			b = appendVarint(b, uint64(siz))
-			return u.marshal(b, p, deterministic)
-		}
-}
-
-// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice.
-// u is the marshal info of the message.
-func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
-	return func(ptr pointer, tagsize int) int {
-			s := ptr.getPointerSlice()
-			n := 0
-			for _, v := range s {
-				if v.isNil() {
-					continue
-				}
-				siz := u.size(v)
-				n += siz + SizeVarint(uint64(siz)) + tagsize
-			}
-			return n
-		},
-		func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
-			s := ptr.getPointerSlice()
-			var err error
-			var nerr nonFatal
-			for _, v := range s {
-				if v.isNil() {
-					return b, errRepeatedHasNil
-				}
-				b = appendVarint(b, wiretag)
-				siz := u.cachedsize(v)
-				b = appendVarint(b, uint64(siz))
-				b, err = u.marshal(b, v, deterministic)
-
-				if !nerr.Merge(err) {
-					if err == ErrNil {
-						err = errRepeatedHasNil
-					}
-					return b, err
-				}
-			}
-			return b, nerr.E
-		}
-}
-
-// makeMapMarshaler returns the sizer and marshaler for a map field.
-// f is the pointer to the reflect data structure of the field.
-func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
-	// figure out key and value type
-	t := f.Type
-	keyType := t.Key()
-	valType := t.Elem()
-	keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",")
-	valTags := strings.Split(f.Tag.Get("protobuf_val"), ",")
-	keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map
-	valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map
-	keyWireTag := 1<<3 | wiretype(keyTags[0])
-	valWireTag := 2<<3 | wiretype(valTags[0])
-
-	// We create an interface to get the addresses of the map key and value.
-	// If value is pointer-typed, the interface is a direct interface, the
-	// idata itself is the value. Otherwise, the idata is the pointer to the
-	// value.
-	// Key cannot be pointer-typed.
-	valIsPtr := valType.Kind() == reflect.Ptr
-
-	// If value is a message with nested maps, calling
-	// valSizer in marshal may be quadratic. We should use
-	// cached version in marshal (but not in size).
-	// If value is not message type, we don't have size cache,
-	// but it cannot be nested either. Just use valSizer.
-	valCachedSizer := valSizer
-	if valIsPtr && valType.Elem().Kind() == reflect.Struct {
-		u := getMarshalInfo(valType.Elem())
-		valCachedSizer = func(ptr pointer, tagsize int) int {
-			// Same as message sizer, but use cache.
-			p := ptr.getPointer()
-			if p.isNil() {
-				return 0
-			}
-			siz := u.cachedsize(p)
-			return siz + SizeVarint(uint64(siz)) + tagsize
-		}
-	}
-	return func(ptr pointer, tagsize int) int {
-			m := ptr.asPointerTo(t).Elem() // the map
-			n := 0
-			for _, k := range m.MapKeys() {
-				ki := k.Interface()
-				vi := m.MapIndex(k).Interface()
-				kaddr := toAddrPointer(&ki, false)             // pointer to key
-				vaddr := toAddrPointer(&vi, valIsPtr)          // pointer to value
-				siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
-				n += siz + SizeVarint(uint64(siz)) + tagsize
-			}
-			return n
-		},
-		func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) {
-			m := ptr.asPointerTo(t).Elem() // the map
-			var err error
-			keys := m.MapKeys()
-			if len(keys) > 1 && deterministic {
-				sort.Sort(mapKeys(keys))
-			}
-
-			var nerr nonFatal
-			for _, k := range keys {
-				ki := k.Interface()
-				vi := m.MapIndex(k).Interface()
-				kaddr := toAddrPointer(&ki, false)    // pointer to key
-				vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value
-				b = appendVarint(b, tag)
-				siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
-				b = appendVarint(b, uint64(siz))
-				b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic)
-				if !nerr.Merge(err) {
-					return b, err
-				}
-				b, err = valMarshaler(b, vaddr, valWireTag, deterministic)
-				if err != ErrNil && !nerr.Merge(err) { // allow nil value in map
-					return b, err
-				}
-			}
-			return b, nerr.E
-		}
-}
-
-// makeOneOfMarshaler returns the sizer and marshaler for a oneof field.
-// fi is the marshal info of the field.
-// f is the pointer to the reflect data structure of the field.
-func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) {
-	// Oneof field is an interface. We need to get the actual data type on the fly.
-	t := f.Type
-	return func(ptr pointer, _ int) int {
-			p := ptr.getInterfacePointer()
-			if p.isNil() {
-				return 0
-			}
-			v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct
-			telem := v.Type()
-			e := fi.oneofElems[telem]
-			return e.sizer(p, e.tagsize)
-		},
-		func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) {
-			p := ptr.getInterfacePointer()
-			if p.isNil() {
-				return b, nil
-			}
-			v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct
-			telem := v.Type()
-			if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() {
-				return b, errOneofHasNil
-			}
-			e := fi.oneofElems[telem]
-			return e.marshaler(b, p, e.wiretag, deterministic)
-		}
-}
-
-// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field.
-func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int {
-	m, mu := ext.extensionsRead()
-	if m == nil {
-		return 0
-	}
-	mu.Lock()
-
-	n := 0
-	for _, e := range m {
-		if e.value == nil || e.desc == nil {
-			// Extension is only in its encoded form.
-			n += len(e.enc)
-			continue
-		}
-
-		// We don't skip extensions that have an encoded form set,
-		// because the extension value may have been mutated after
-		// the last time this function was called.
-		ei := u.getExtElemInfo(e.desc)
-		v := e.value
-		p := toAddrPointer(&v, ei.isptr)
-		n += ei.sizer(p, ei.tagsize)
-	}
-	mu.Unlock()
-	return n
-}
-
-// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b.
-func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) {
-	m, mu := ext.extensionsRead()
-	if m == nil {
-		return b, nil
-	}
-	mu.Lock()
-	defer mu.Unlock()
-
-	var err error
-	var nerr nonFatal
-
-	// Fast-path for common cases: zero or one extensions.
-	// Don't bother sorting the keys.
-	if len(m) <= 1 {
-		for _, e := range m {
-			if e.value == nil || e.desc == nil {
-				// Extension is only in its encoded form.
-				b = append(b, e.enc...)
-				continue
-			}
-
-			// We don't skip extensions that have an encoded form set,
-			// because the extension value may have been mutated after
-			// the last time this function was called.
-
-			ei := u.getExtElemInfo(e.desc)
-			v := e.value
-			p := toAddrPointer(&v, ei.isptr)
-			b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
-			if !nerr.Merge(err) {
-				return b, err
-			}
-		}
-		return b, nerr.E
-	}
-
-	// Sort the keys to provide a deterministic encoding.
-	// Not sure this is required, but the old code does it.
-	keys := make([]int, 0, len(m))
-	for k := range m {
-		keys = append(keys, int(k))
-	}
-	sort.Ints(keys)
-
-	for _, k := range keys {
-		e := m[int32(k)]
-		if e.value == nil || e.desc == nil {
-			// Extension is only in its encoded form.
-			b = append(b, e.enc...)
-			continue
-		}
-
-		// We don't skip extensions that have an encoded form set,
-		// because the extension value may have been mutated after
-		// the last time this function was called.
-
-		ei := u.getExtElemInfo(e.desc)
-		v := e.value
-		p := toAddrPointer(&v, ei.isptr)
-		b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
-		if !nerr.Merge(err) {
-			return b, err
-		}
-	}
-	return b, nerr.E
-}
-
-// message set format is:
-//   message MessageSet {
-//     repeated group Item = 1 {
-//       required int32 type_id = 2;
-//       required string message = 3;
-//     };
-//   }
-
-// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field
-// in message set format (above).
-func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int {
-	m, mu := ext.extensionsRead()
-	if m == nil {
-		return 0
-	}
-	mu.Lock()
-
-	n := 0
-	for id, e := range m {
-		n += 2                          // start group, end group. tag = 1 (size=1)
-		n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1)
-
-		if e.value == nil || e.desc == nil {
-			// Extension is only in its encoded form.
-			msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
-			siz := len(msgWithLen)
-			n += siz + 1 // message, tag = 3 (size=1)
-			continue
-		}
-
-		// We don't skip extensions that have an encoded form set,
-		// because the extension value may have been mutated after
-		// the last time this function was called.
-
-		ei := u.getExtElemInfo(e.desc)
-		v := e.value
-		p := toAddrPointer(&v, ei.isptr)
-		n += ei.sizer(p, 1) // message, tag = 3 (size=1)
-	}
-	mu.Unlock()
-	return n
-}
-
-// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above)
-// to the end of byte slice b.
-func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) {
-	m, mu := ext.extensionsRead()
-	if m == nil {
-		return b, nil
-	}
-	mu.Lock()
-	defer mu.Unlock()
-
-	var err error
-	var nerr nonFatal
-
-	// Fast-path for common cases: zero or one extensions.
-	// Don't bother sorting the keys.
-	if len(m) <= 1 {
-		for id, e := range m {
-			b = append(b, 1<<3|WireStartGroup)
-			b = append(b, 2<<3|WireVarint)
-			b = appendVarint(b, uint64(id))
-
-			if e.value == nil || e.desc == nil {
-				// Extension is only in its encoded form.
-				msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
-				b = append(b, 3<<3|WireBytes)
-				b = append(b, msgWithLen...)
-				b = append(b, 1<<3|WireEndGroup)
-				continue
-			}
-
-			// We don't skip extensions that have an encoded form set,
-			// because the extension value may have been mutated after
-			// the last time this function was called.
-
-			ei := u.getExtElemInfo(e.desc)
-			v := e.value
-			p := toAddrPointer(&v, ei.isptr)
-			b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
-			if !nerr.Merge(err) {
-				return b, err
-			}
-			b = append(b, 1<<3|WireEndGroup)
-		}
-		return b, nerr.E
-	}
-
-	// Sort the keys to provide a deterministic encoding.
-	keys := make([]int, 0, len(m))
-	for k := range m {
-		keys = append(keys, int(k))
-	}
-	sort.Ints(keys)
-
-	for _, id := range keys {
-		e := m[int32(id)]
-		b = append(b, 1<<3|WireStartGroup)
-		b = append(b, 2<<3|WireVarint)
-		b = appendVarint(b, uint64(id))
-
-		if e.value == nil || e.desc == nil {
-			// Extension is only in its encoded form.
-			msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
-			b = append(b, 3<<3|WireBytes)
-			b = append(b, msgWithLen...)
-			b = append(b, 1<<3|WireEndGroup)
-			continue
-		}
-
-		// We don't skip extensions that have an encoded form set,
-		// because the extension value may have been mutated after
-		// the last time this function was called.
-
-		ei := u.getExtElemInfo(e.desc)
-		v := e.value
-		p := toAddrPointer(&v, ei.isptr)
-		b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
-		b = append(b, 1<<3|WireEndGroup)
-		if !nerr.Merge(err) {
-			return b, err
-		}
-	}
-	return b, nerr.E
-}
-
-// sizeV1Extensions computes the size of encoded data for a V1-API extension field.
-func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int {
-	if m == nil {
-		return 0
-	}
-
-	n := 0
-	for _, e := range m {
-		if e.value == nil || e.desc == nil {
-			// Extension is only in its encoded form.
-			n += len(e.enc)
-			continue
-		}
-
-		// We don't skip extensions that have an encoded form set,
-		// because the extension value may have been mutated after
-		// the last time this function was called.
-
-		ei := u.getExtElemInfo(e.desc)
-		v := e.value
-		p := toAddrPointer(&v, ei.isptr)
-		n += ei.sizer(p, ei.tagsize)
-	}
-	return n
-}
-
-// appendV1Extensions marshals a V1-API extension field to the end of byte slice b.
-func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) {
-	if m == nil {
-		return b, nil
-	}
-
-	// Sort the keys to provide a deterministic encoding.
-	keys := make([]int, 0, len(m))
-	for k := range m {
-		keys = append(keys, int(k))
-	}
-	sort.Ints(keys)
-
-	var err error
-	var nerr nonFatal
-	for _, k := range keys {
-		e := m[int32(k)]
-		if e.value == nil || e.desc == nil {
-			// Extension is only in its encoded form.
-			b = append(b, e.enc...)
-			continue
-		}
-
-		// We don't skip extensions that have an encoded form set,
-		// because the extension value may have been mutated after
-		// the last time this function was called.
-
-		ei := u.getExtElemInfo(e.desc)
-		v := e.value
-		p := toAddrPointer(&v, ei.isptr)
-		b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
-		if !nerr.Merge(err) {
-			return b, err
-		}
-	}
-	return b, nerr.E
-}
-
-// newMarshaler is the interface representing objects that can marshal themselves.
-//
-// This exists to support protoc-gen-go generated messages.
-// The proto package will stop type-asserting to this interface in the future.
-//
-// DO NOT DEPEND ON THIS.
-type newMarshaler interface {
-	XXX_Size() int
-	XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
-}
-
-// Size returns the encoded size of a protocol buffer message.
-// This is the main entry point.
-func Size(pb Message) int {
-	if m, ok := pb.(newMarshaler); ok {
-		return m.XXX_Size()
-	}
-	if m, ok := pb.(Marshaler); ok {
-		// If the message can marshal itself, let it do it, for compatibility.
-		// NOTE: This is not efficient.
-		b, _ := m.Marshal()
-		return len(b)
-	}
-	// in case somehow we didn't generate the wrapper
-	if pb == nil {
-		return 0
-	}
-	var info InternalMessageInfo
-	return info.Size(pb)
-}
-
-// Marshal takes a protocol buffer message
-// and encodes it into the wire format, returning the data.
-// This is the main entry point.
-func Marshal(pb Message) ([]byte, error) {
-	if m, ok := pb.(newMarshaler); ok {
-		siz := m.XXX_Size()
-		b := make([]byte, 0, siz)
-		return m.XXX_Marshal(b, false)
-	}
-	if m, ok := pb.(Marshaler); ok {
-		// If the message can marshal itself, let it do it, for compatibility.
-		// NOTE: This is not efficient.
-		return m.Marshal()
-	}
-	// in case somehow we didn't generate the wrapper
-	if pb == nil {
-		return nil, ErrNil
-	}
-	var info InternalMessageInfo
-	siz := info.Size(pb)
-	b := make([]byte, 0, siz)
-	return info.Marshal(b, pb, false)
-}
-
-// Marshal takes a protocol buffer message
-// and encodes it into the wire format, writing the result to the
-// Buffer.
-// This is an alternative entry point. It is not necessary to use
-// a Buffer for most applications.
-func (p *Buffer) Marshal(pb Message) error {
-	var err error
-	if m, ok := pb.(newMarshaler); ok {
-		siz := m.XXX_Size()
-		p.grow(siz) // make sure buf has enough capacity
-		p.buf, err = m.XXX_Marshal(p.buf, p.deterministic)
-		return err
-	}
-	if m, ok := pb.(Marshaler); ok {
-		// If the message can marshal itself, let it do it, for compatibility.
-		// NOTE: This is not efficient.
-		b, err := m.Marshal()
-		p.buf = append(p.buf, b...)
-		return err
-	}
-	// in case somehow we didn't generate the wrapper
-	if pb == nil {
-		return ErrNil
-	}
-	var info InternalMessageInfo
-	siz := info.Size(pb)
-	p.grow(siz) // make sure buf has enough capacity
-	p.buf, err = info.Marshal(p.buf, pb, p.deterministic)
-	return err
-}
-
-// grow grows the buffer's capacity, if necessary, to guarantee space for
-// another n bytes. After grow(n), at least n bytes can be written to the
-// buffer without another allocation.
-func (p *Buffer) grow(n int) {
-	need := len(p.buf) + n
-	if need <= cap(p.buf) {
-		return
-	}
-	newCap := len(p.buf) * 2
-	if newCap < need {
-		newCap = need
-	}
-	p.buf = append(make([]byte, 0, newCap), p.buf...)
-}

+ 0 - 654
vendor/github.com/golang/protobuf/proto/table_merge.go

@@ -1,654 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
-	"fmt"
-	"reflect"
-	"strings"
-	"sync"
-	"sync/atomic"
-)
-
-// Merge merges the src message into dst.
-// This assumes that dst and src of the same type and are non-nil.
-func (a *InternalMessageInfo) Merge(dst, src Message) {
-	mi := atomicLoadMergeInfo(&a.merge)
-	if mi == nil {
-		mi = getMergeInfo(reflect.TypeOf(dst).Elem())
-		atomicStoreMergeInfo(&a.merge, mi)
-	}
-	mi.merge(toPointer(&dst), toPointer(&src))
-}
-
-type mergeInfo struct {
-	typ reflect.Type
-
-	initialized int32 // 0: only typ is valid, 1: everything is valid
-	lock        sync.Mutex
-
-	fields       []mergeFieldInfo
-	unrecognized field // Offset of XXX_unrecognized
-}
-
-type mergeFieldInfo struct {
-	field field // Offset of field, guaranteed to be valid
-
-	// isPointer reports whether the value in the field is a pointer.
-	// This is true for the following situations:
-	//	* Pointer to struct
-	//	* Pointer to basic type (proto2 only)
-	//	* Slice (first value in slice header is a pointer)
-	//	* String (first value in string header is a pointer)
-	isPointer bool
-
-	// basicWidth reports the width of the field assuming that it is directly
-	// embedded in the struct (as is the case for basic types in proto3).
-	// The possible values are:
-	// 	0: invalid
-	//	1: bool
-	//	4: int32, uint32, float32
-	//	8: int64, uint64, float64
-	basicWidth int
-
-	// Where dst and src are pointers to the types being merged.
-	merge func(dst, src pointer)
-}
-
-var (
-	mergeInfoMap  = map[reflect.Type]*mergeInfo{}
-	mergeInfoLock sync.Mutex
-)
-
-func getMergeInfo(t reflect.Type) *mergeInfo {
-	mergeInfoLock.Lock()
-	defer mergeInfoLock.Unlock()
-	mi := mergeInfoMap[t]
-	if mi == nil {
-		mi = &mergeInfo{typ: t}
-		mergeInfoMap[t] = mi
-	}
-	return mi
-}
-
-// merge merges src into dst assuming they are both of type *mi.typ.
-func (mi *mergeInfo) merge(dst, src pointer) {
-	if dst.isNil() {
-		panic("proto: nil destination")
-	}
-	if src.isNil() {
-		return // Nothing to do.
-	}
-
-	if atomic.LoadInt32(&mi.initialized) == 0 {
-		mi.computeMergeInfo()
-	}
-
-	for _, fi := range mi.fields {
-		sfp := src.offset(fi.field)
-
-		// As an optimization, we can avoid the merge function call cost
-		// if we know for sure that the source will have no effect
-		// by checking if it is the zero value.
-		if unsafeAllowed {
-			if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string
-				continue
-			}
-			if fi.basicWidth > 0 {
-				switch {
-				case fi.basicWidth == 1 && !*sfp.toBool():
-					continue
-				case fi.basicWidth == 4 && *sfp.toUint32() == 0:
-					continue
-				case fi.basicWidth == 8 && *sfp.toUint64() == 0:
-					continue
-				}
-			}
-		}
-
-		dfp := dst.offset(fi.field)
-		fi.merge(dfp, sfp)
-	}
-
-	// TODO: Make this faster?
-	out := dst.asPointerTo(mi.typ).Elem()
-	in := src.asPointerTo(mi.typ).Elem()
-	if emIn, err := extendable(in.Addr().Interface()); err == nil {
-		emOut, _ := extendable(out.Addr().Interface())
-		mIn, muIn := emIn.extensionsRead()
-		if mIn != nil {
-			mOut := emOut.extensionsWrite()
-			muIn.Lock()
-			mergeExtension(mOut, mIn)
-			muIn.Unlock()
-		}
-	}
-
-	if mi.unrecognized.IsValid() {
-		if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 {
-			*dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...)
-		}
-	}
-}
-
-func (mi *mergeInfo) computeMergeInfo() {
-	mi.lock.Lock()
-	defer mi.lock.Unlock()
-	if mi.initialized != 0 {
-		return
-	}
-	t := mi.typ
-	n := t.NumField()
-
-	props := GetProperties(t)
-	for i := 0; i < n; i++ {
-		f := t.Field(i)
-		if strings.HasPrefix(f.Name, "XXX_") {
-			continue
-		}
-
-		mfi := mergeFieldInfo{field: toField(&f)}
-		tf := f.Type
-
-		// As an optimization, we can avoid the merge function call cost
-		// if we know for sure that the source will have no effect
-		// by checking if it is the zero value.
-		if unsafeAllowed {
-			switch tf.Kind() {
-			case reflect.Ptr, reflect.Slice, reflect.String:
-				// As a special case, we assume slices and strings are pointers
-				// since we know that the first field in the SliceSlice or
-				// StringHeader is a data pointer.
-				mfi.isPointer = true
-			case reflect.Bool:
-				mfi.basicWidth = 1
-			case reflect.Int32, reflect.Uint32, reflect.Float32:
-				mfi.basicWidth = 4
-			case reflect.Int64, reflect.Uint64, reflect.Float64:
-				mfi.basicWidth = 8
-			}
-		}
-
-		// Unwrap tf to get at its most basic type.
-		var isPointer, isSlice bool
-		if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
-			isSlice = true
-			tf = tf.Elem()
-		}
-		if tf.Kind() == reflect.Ptr {
-			isPointer = true
-			tf = tf.Elem()
-		}
-		if isPointer && isSlice && tf.Kind() != reflect.Struct {
-			panic("both pointer and slice for basic type in " + tf.Name())
-		}
-
-		switch tf.Kind() {
-		case reflect.Int32:
-			switch {
-			case isSlice: // E.g., []int32
-				mfi.merge = func(dst, src pointer) {
-					// NOTE: toInt32Slice is not defined (see pointer_reflect.go).
-					/*
-						sfsp := src.toInt32Slice()
-						if *sfsp != nil {
-							dfsp := dst.toInt32Slice()
-							*dfsp = append(*dfsp, *sfsp...)
-							if *dfsp == nil {
-								*dfsp = []int64{}
-							}
-						}
-					*/
-					sfs := src.getInt32Slice()
-					if sfs != nil {
-						dfs := dst.getInt32Slice()
-						dfs = append(dfs, sfs...)
-						if dfs == nil {
-							dfs = []int32{}
-						}
-						dst.setInt32Slice(dfs)
-					}
-				}
-			case isPointer: // E.g., *int32
-				mfi.merge = func(dst, src pointer) {
-					// NOTE: toInt32Ptr is not defined (see pointer_reflect.go).
-					/*
-						sfpp := src.toInt32Ptr()
-						if *sfpp != nil {
-							dfpp := dst.toInt32Ptr()
-							if *dfpp == nil {
-								*dfpp = Int32(**sfpp)
-							} else {
-								**dfpp = **sfpp
-							}
-						}
-					*/
-					sfp := src.getInt32Ptr()
-					if sfp != nil {
-						dfp := dst.getInt32Ptr()
-						if dfp == nil {
-							dst.setInt32Ptr(*sfp)
-						} else {
-							*dfp = *sfp
-						}
-					}
-				}
-			default: // E.g., int32
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toInt32(); v != 0 {
-						*dst.toInt32() = v
-					}
-				}
-			}
-		case reflect.Int64:
-			switch {
-			case isSlice: // E.g., []int64
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toInt64Slice()
-					if *sfsp != nil {
-						dfsp := dst.toInt64Slice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []int64{}
-						}
-					}
-				}
-			case isPointer: // E.g., *int64
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toInt64Ptr()
-					if *sfpp != nil {
-						dfpp := dst.toInt64Ptr()
-						if *dfpp == nil {
-							*dfpp = Int64(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., int64
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toInt64(); v != 0 {
-						*dst.toInt64() = v
-					}
-				}
-			}
-		case reflect.Uint32:
-			switch {
-			case isSlice: // E.g., []uint32
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toUint32Slice()
-					if *sfsp != nil {
-						dfsp := dst.toUint32Slice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []uint32{}
-						}
-					}
-				}
-			case isPointer: // E.g., *uint32
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toUint32Ptr()
-					if *sfpp != nil {
-						dfpp := dst.toUint32Ptr()
-						if *dfpp == nil {
-							*dfpp = Uint32(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., uint32
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toUint32(); v != 0 {
-						*dst.toUint32() = v
-					}
-				}
-			}
-		case reflect.Uint64:
-			switch {
-			case isSlice: // E.g., []uint64
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toUint64Slice()
-					if *sfsp != nil {
-						dfsp := dst.toUint64Slice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []uint64{}
-						}
-					}
-				}
-			case isPointer: // E.g., *uint64
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toUint64Ptr()
-					if *sfpp != nil {
-						dfpp := dst.toUint64Ptr()
-						if *dfpp == nil {
-							*dfpp = Uint64(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., uint64
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toUint64(); v != 0 {
-						*dst.toUint64() = v
-					}
-				}
-			}
-		case reflect.Float32:
-			switch {
-			case isSlice: // E.g., []float32
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toFloat32Slice()
-					if *sfsp != nil {
-						dfsp := dst.toFloat32Slice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []float32{}
-						}
-					}
-				}
-			case isPointer: // E.g., *float32
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toFloat32Ptr()
-					if *sfpp != nil {
-						dfpp := dst.toFloat32Ptr()
-						if *dfpp == nil {
-							*dfpp = Float32(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., float32
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toFloat32(); v != 0 {
-						*dst.toFloat32() = v
-					}
-				}
-			}
-		case reflect.Float64:
-			switch {
-			case isSlice: // E.g., []float64
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toFloat64Slice()
-					if *sfsp != nil {
-						dfsp := dst.toFloat64Slice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []float64{}
-						}
-					}
-				}
-			case isPointer: // E.g., *float64
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toFloat64Ptr()
-					if *sfpp != nil {
-						dfpp := dst.toFloat64Ptr()
-						if *dfpp == nil {
-							*dfpp = Float64(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., float64
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toFloat64(); v != 0 {
-						*dst.toFloat64() = v
-					}
-				}
-			}
-		case reflect.Bool:
-			switch {
-			case isSlice: // E.g., []bool
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toBoolSlice()
-					if *sfsp != nil {
-						dfsp := dst.toBoolSlice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []bool{}
-						}
-					}
-				}
-			case isPointer: // E.g., *bool
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toBoolPtr()
-					if *sfpp != nil {
-						dfpp := dst.toBoolPtr()
-						if *dfpp == nil {
-							*dfpp = Bool(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., bool
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toBool(); v {
-						*dst.toBool() = v
-					}
-				}
-			}
-		case reflect.String:
-			switch {
-			case isSlice: // E.g., []string
-				mfi.merge = func(dst, src pointer) {
-					sfsp := src.toStringSlice()
-					if *sfsp != nil {
-						dfsp := dst.toStringSlice()
-						*dfsp = append(*dfsp, *sfsp...)
-						if *dfsp == nil {
-							*dfsp = []string{}
-						}
-					}
-				}
-			case isPointer: // E.g., *string
-				mfi.merge = func(dst, src pointer) {
-					sfpp := src.toStringPtr()
-					if *sfpp != nil {
-						dfpp := dst.toStringPtr()
-						if *dfpp == nil {
-							*dfpp = String(**sfpp)
-						} else {
-							**dfpp = **sfpp
-						}
-					}
-				}
-			default: // E.g., string
-				mfi.merge = func(dst, src pointer) {
-					if v := *src.toString(); v != "" {
-						*dst.toString() = v
-					}
-				}
-			}
-		case reflect.Slice:
-			isProto3 := props.Prop[i].proto3
-			switch {
-			case isPointer:
-				panic("bad pointer in byte slice case in " + tf.Name())
-			case tf.Elem().Kind() != reflect.Uint8:
-				panic("bad element kind in byte slice case in " + tf.Name())
-			case isSlice: // E.g., [][]byte
-				mfi.merge = func(dst, src pointer) {
-					sbsp := src.toBytesSlice()
-					if *sbsp != nil {
-						dbsp := dst.toBytesSlice()
-						for _, sb := range *sbsp {
-							if sb == nil {
-								*dbsp = append(*dbsp, nil)
-							} else {
-								*dbsp = append(*dbsp, append([]byte{}, sb...))
-							}
-						}
-						if *dbsp == nil {
-							*dbsp = [][]byte{}
-						}
-					}
-				}
-			default: // E.g., []byte
-				mfi.merge = func(dst, src pointer) {
-					sbp := src.toBytes()
-					if *sbp != nil {
-						dbp := dst.toBytes()
-						if !isProto3 || len(*sbp) > 0 {
-							*dbp = append([]byte{}, *sbp...)
-						}
-					}
-				}
-			}
-		case reflect.Struct:
-			switch {
-			case !isPointer:
-				panic(fmt.Sprintf("message field %s without pointer", tf))
-			case isSlice: // E.g., []*pb.T
-				mi := getMergeInfo(tf)
-				mfi.merge = func(dst, src pointer) {
-					sps := src.getPointerSlice()
-					if sps != nil {
-						dps := dst.getPointerSlice()
-						for _, sp := range sps {
-							var dp pointer
-							if !sp.isNil() {
-								dp = valToPointer(reflect.New(tf))
-								mi.merge(dp, sp)
-							}
-							dps = append(dps, dp)
-						}
-						if dps == nil {
-							dps = []pointer{}
-						}
-						dst.setPointerSlice(dps)
-					}
-				}
-			default: // E.g., *pb.T
-				mi := getMergeInfo(tf)
-				mfi.merge = func(dst, src pointer) {
-					sp := src.getPointer()
-					if !sp.isNil() {
-						dp := dst.getPointer()
-						if dp.isNil() {
-							dp = valToPointer(reflect.New(tf))
-							dst.setPointer(dp)
-						}
-						mi.merge(dp, sp)
-					}
-				}
-			}
-		case reflect.Map:
-			switch {
-			case isPointer || isSlice:
-				panic("bad pointer or slice in map case in " + tf.Name())
-			default: // E.g., map[K]V
-				mfi.merge = func(dst, src pointer) {
-					sm := src.asPointerTo(tf).Elem()
-					if sm.Len() == 0 {
-						return
-					}
-					dm := dst.asPointerTo(tf).Elem()
-					if dm.IsNil() {
-						dm.Set(reflect.MakeMap(tf))
-					}
-
-					switch tf.Elem().Kind() {
-					case reflect.Ptr: // Proto struct (e.g., *T)
-						for _, key := range sm.MapKeys() {
-							val := sm.MapIndex(key)
-							val = reflect.ValueOf(Clone(val.Interface().(Message)))
-							dm.SetMapIndex(key, val)
-						}
-					case reflect.Slice: // E.g. Bytes type (e.g., []byte)
-						for _, key := range sm.MapKeys() {
-							val := sm.MapIndex(key)
-							val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
-							dm.SetMapIndex(key, val)
-						}
-					default: // Basic type (e.g., string)
-						for _, key := range sm.MapKeys() {
-							val := sm.MapIndex(key)
-							dm.SetMapIndex(key, val)
-						}
-					}
-				}
-			}
-		case reflect.Interface:
-			// Must be oneof field.
-			switch {
-			case isPointer || isSlice:
-				panic("bad pointer or slice in interface case in " + tf.Name())
-			default: // E.g., interface{}
-				// TODO: Make this faster?
-				mfi.merge = func(dst, src pointer) {
-					su := src.asPointerTo(tf).Elem()
-					if !su.IsNil() {
-						du := dst.asPointerTo(tf).Elem()
-						typ := su.Elem().Type()
-						if du.IsNil() || du.Elem().Type() != typ {
-							du.Set(reflect.New(typ.Elem())) // Initialize interface if empty
-						}
-						sv := su.Elem().Elem().Field(0)
-						if sv.Kind() == reflect.Ptr && sv.IsNil() {
-							return
-						}
-						dv := du.Elem().Elem().Field(0)
-						if dv.Kind() == reflect.Ptr && dv.IsNil() {
-							dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty
-						}
-						switch sv.Type().Kind() {
-						case reflect.Ptr: // Proto struct (e.g., *T)
-							Merge(dv.Interface().(Message), sv.Interface().(Message))
-						case reflect.Slice: // E.g. Bytes type (e.g., []byte)
-							dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...)))
-						default: // Basic type (e.g., string)
-							dv.Set(sv)
-						}
-					}
-				}
-			}
-		default:
-			panic(fmt.Sprintf("merger not found for type:%s", tf))
-		}
-		mi.fields = append(mi.fields, mfi)
-	}
-
-	mi.unrecognized = invalidField
-	if f, ok := t.FieldByName("XXX_unrecognized"); ok {
-		if f.Type != reflect.TypeOf([]byte{}) {
-			panic("expected XXX_unrecognized to be of type []byte")
-		}
-		mi.unrecognized = toField(&f)
-	}
-
-	atomic.StoreInt32(&mi.initialized, 1)
-}

+ 0 - 2051
vendor/github.com/golang/protobuf/proto/table_unmarshal.go

@@ -1,2051 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
-	"errors"
-	"fmt"
-	"io"
-	"math"
-	"reflect"
-	"strconv"
-	"strings"
-	"sync"
-	"sync/atomic"
-	"unicode/utf8"
-)
-
-// Unmarshal is the entry point from the generated .pb.go files.
-// This function is not intended to be used by non-generated code.
-// This function is not subject to any compatibility guarantee.
-// msg contains a pointer to a protocol buffer struct.
-// b is the data to be unmarshaled into the protocol buffer.
-// a is a pointer to a place to store cached unmarshal information.
-func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error {
-	// Load the unmarshal information for this message type.
-	// The atomic load ensures memory consistency.
-	u := atomicLoadUnmarshalInfo(&a.unmarshal)
-	if u == nil {
-		// Slow path: find unmarshal info for msg, update a with it.
-		u = getUnmarshalInfo(reflect.TypeOf(msg).Elem())
-		atomicStoreUnmarshalInfo(&a.unmarshal, u)
-	}
-	// Then do the unmarshaling.
-	err := u.unmarshal(toPointer(&msg), b)
-	return err
-}
-
-type unmarshalInfo struct {
-	typ reflect.Type // type of the protobuf struct
-
-	// 0 = only typ field is initialized
-	// 1 = completely initialized
-	initialized     int32
-	lock            sync.Mutex                    // prevents double initialization
-	dense           []unmarshalFieldInfo          // fields indexed by tag #
-	sparse          map[uint64]unmarshalFieldInfo // fields indexed by tag #
-	reqFields       []string                      // names of required fields
-	reqMask         uint64                        // 1<<len(reqFields)-1
-	unrecognized    field                         // offset of []byte to put unrecognized data (or invalidField if we should throw it away)
-	extensions      field                         // offset of extensions field (of type proto.XXX_InternalExtensions), or invalidField if it does not exist
-	oldExtensions   field                         // offset of old-form extensions field (of type map[int]Extension)
-	extensionRanges []ExtensionRange              // if non-nil, implies extensions field is valid
-	isMessageSet    bool                          // if true, implies extensions field is valid
-}
-
-// An unmarshaler takes a stream of bytes and a pointer to a field of a message.
-// It decodes the field, stores it at f, and returns the unused bytes.
-// w is the wire encoding.
-// b is the data after the tag and wire encoding have been read.
-type unmarshaler func(b []byte, f pointer, w int) ([]byte, error)
-
-type unmarshalFieldInfo struct {
-	// location of the field in the proto message structure.
-	field field
-
-	// function to unmarshal the data for the field.
-	unmarshal unmarshaler
-
-	// if a required field, contains a single set bit at this field's index in the required field list.
-	reqMask uint64
-
-	name string // name of the field, for error reporting
-}
-
-var (
-	unmarshalInfoMap  = map[reflect.Type]*unmarshalInfo{}
-	unmarshalInfoLock sync.Mutex
-)
-
-// getUnmarshalInfo returns the data structure which can be
-// subsequently used to unmarshal a message of the given type.
-// t is the type of the message (note: not pointer to message).
-func getUnmarshalInfo(t reflect.Type) *unmarshalInfo {
-	// It would be correct to return a new unmarshalInfo
-	// unconditionally. We would end up allocating one
-	// per occurrence of that type as a message or submessage.
-	// We use a cache here just to reduce memory usage.
-	unmarshalInfoLock.Lock()
-	defer unmarshalInfoLock.Unlock()
-	u := unmarshalInfoMap[t]
-	if u == nil {
-		u = &unmarshalInfo{typ: t}
-		// Note: we just set the type here. The rest of the fields
-		// will be initialized on first use.
-		unmarshalInfoMap[t] = u
-	}
-	return u
-}
-
-// unmarshal does the main work of unmarshaling a message.
-// u provides type information used to unmarshal the message.
-// m is a pointer to a protocol buffer message.
-// b is a byte stream to unmarshal into m.
-// This is top routine used when recursively unmarshaling submessages.
-func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
-	if atomic.LoadInt32(&u.initialized) == 0 {
-		u.computeUnmarshalInfo()
-	}
-	if u.isMessageSet {
-		return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions())
-	}
-	var reqMask uint64 // bitmask of required fields we've seen.
-	var errLater error
-	for len(b) > 0 {
-		// Read tag and wire type.
-		// Special case 1 and 2 byte varints.
-		var x uint64
-		if b[0] < 128 {
-			x = uint64(b[0])
-			b = b[1:]
-		} else if len(b) >= 2 && b[1] < 128 {
-			x = uint64(b[0]&0x7f) + uint64(b[1])<<7
-			b = b[2:]
-		} else {
-			var n int
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-		}
-		tag := x >> 3
-		wire := int(x) & 7
-
-		// Dispatch on the tag to one of the unmarshal* functions below.
-		var f unmarshalFieldInfo
-		if tag < uint64(len(u.dense)) {
-			f = u.dense[tag]
-		} else {
-			f = u.sparse[tag]
-		}
-		if fn := f.unmarshal; fn != nil {
-			var err error
-			b, err = fn(b, m.offset(f.field), wire)
-			if err == nil {
-				reqMask |= f.reqMask
-				continue
-			}
-			if r, ok := err.(*RequiredNotSetError); ok {
-				// Remember this error, but keep parsing. We need to produce
-				// a full parse even if a required field is missing.
-				if errLater == nil {
-					errLater = r
-				}
-				reqMask |= f.reqMask
-				continue
-			}
-			if err != errInternalBadWireType {
-				if err == errInvalidUTF8 {
-					if errLater == nil {
-						fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
-						errLater = &invalidUTF8Error{fullName}
-					}
-					continue
-				}
-				return err
-			}
-			// Fragments with bad wire type are treated as unknown fields.
-		}
-
-		// Unknown tag.
-		if !u.unrecognized.IsValid() {
-			// Don't keep unrecognized data; just skip it.
-			var err error
-			b, err = skipField(b, wire)
-			if err != nil {
-				return err
-			}
-			continue
-		}
-		// Keep unrecognized data around.
-		// maybe in extensions, maybe in the unrecognized field.
-		z := m.offset(u.unrecognized).toBytes()
-		var emap map[int32]Extension
-		var e Extension
-		for _, r := range u.extensionRanges {
-			if uint64(r.Start) <= tag && tag <= uint64(r.End) {
-				if u.extensions.IsValid() {
-					mp := m.offset(u.extensions).toExtensions()
-					emap = mp.extensionsWrite()
-					e = emap[int32(tag)]
-					z = &e.enc
-					break
-				}
-				if u.oldExtensions.IsValid() {
-					p := m.offset(u.oldExtensions).toOldExtensions()
-					emap = *p
-					if emap == nil {
-						emap = map[int32]Extension{}
-						*p = emap
-					}
-					e = emap[int32(tag)]
-					z = &e.enc
-					break
-				}
-				panic("no extensions field available")
-			}
-		}
-
-		// Use wire type to skip data.
-		var err error
-		b0 := b
-		b, err = skipField(b, wire)
-		if err != nil {
-			return err
-		}
-		*z = encodeVarint(*z, tag<<3|uint64(wire))
-		*z = append(*z, b0[:len(b0)-len(b)]...)
-
-		if emap != nil {
-			emap[int32(tag)] = e
-		}
-	}
-	if reqMask != u.reqMask && errLater == nil {
-		// A required field of this message is missing.
-		for _, n := range u.reqFields {
-			if reqMask&1 == 0 {
-				errLater = &RequiredNotSetError{n}
-			}
-			reqMask >>= 1
-		}
-	}
-	return errLater
-}
-
-// computeUnmarshalInfo fills in u with information for use
-// in unmarshaling protocol buffers of type u.typ.
-func (u *unmarshalInfo) computeUnmarshalInfo() {
-	u.lock.Lock()
-	defer u.lock.Unlock()
-	if u.initialized != 0 {
-		return
-	}
-	t := u.typ
-	n := t.NumField()
-
-	// Set up the "not found" value for the unrecognized byte buffer.
-	// This is the default for proto3.
-	u.unrecognized = invalidField
-	u.extensions = invalidField
-	u.oldExtensions = invalidField
-
-	// List of the generated type and offset for each oneof field.
-	type oneofField struct {
-		ityp  reflect.Type // interface type of oneof field
-		field field        // offset in containing message
-	}
-	var oneofFields []oneofField
-
-	for i := 0; i < n; i++ {
-		f := t.Field(i)
-		if f.Name == "XXX_unrecognized" {
-			// The byte slice used to hold unrecognized input is special.
-			if f.Type != reflect.TypeOf(([]byte)(nil)) {
-				panic("bad type for XXX_unrecognized field: " + f.Type.Name())
-			}
-			u.unrecognized = toField(&f)
-			continue
-		}
-		if f.Name == "XXX_InternalExtensions" {
-			// Ditto here.
-			if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) {
-				panic("bad type for XXX_InternalExtensions field: " + f.Type.Name())
-			}
-			u.extensions = toField(&f)
-			if f.Tag.Get("protobuf_messageset") == "1" {
-				u.isMessageSet = true
-			}
-			continue
-		}
-		if f.Name == "XXX_extensions" {
-			// An older form of the extensions field.
-			if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) {
-				panic("bad type for XXX_extensions field: " + f.Type.Name())
-			}
-			u.oldExtensions = toField(&f)
-			continue
-		}
-		if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" {
-			continue
-		}
-
-		oneof := f.Tag.Get("protobuf_oneof")
-		if oneof != "" {
-			oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)})
-			// The rest of oneof processing happens below.
-			continue
-		}
-
-		tags := f.Tag.Get("protobuf")
-		tagArray := strings.Split(tags, ",")
-		if len(tagArray) < 2 {
-			panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags)
-		}
-		tag, err := strconv.Atoi(tagArray[1])
-		if err != nil {
-			panic("protobuf tag field not an integer: " + tagArray[1])
-		}
-
-		name := ""
-		for _, tag := range tagArray[3:] {
-			if strings.HasPrefix(tag, "name=") {
-				name = tag[5:]
-			}
-		}
-
-		// Extract unmarshaling function from the field (its type and tags).
-		unmarshal := fieldUnmarshaler(&f)
-
-		// Required field?
-		var reqMask uint64
-		if tagArray[2] == "req" {
-			bit := len(u.reqFields)
-			u.reqFields = append(u.reqFields, name)
-			reqMask = uint64(1) << uint(bit)
-			// TODO: if we have more than 64 required fields, we end up
-			// not verifying that all required fields are present.
-			// Fix this, perhaps using a count of required fields?
-		}
-
-		// Store the info in the correct slot in the message.
-		u.setTag(tag, toField(&f), unmarshal, reqMask, name)
-	}
-
-	// Find any types associated with oneof fields.
-	// TODO: XXX_OneofFuncs returns more info than we need.  Get rid of some of it?
-	fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs")
-	if fn.IsValid() {
-		res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{}
-		for i := res.Len() - 1; i >= 0; i-- {
-			v := res.Index(i)                             // interface{}
-			tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X
-			typ := tptr.Elem()                            // Msg_X
-
-			f := typ.Field(0) // oneof implementers have one field
-			baseUnmarshal := fieldUnmarshaler(&f)
-			tags := strings.Split(f.Tag.Get("protobuf"), ",")
-			fieldNum, err := strconv.Atoi(tags[1])
-			if err != nil {
-				panic("protobuf tag field not an integer: " + tags[1])
-			}
-			var name string
-			for _, tag := range tags {
-				if strings.HasPrefix(tag, "name=") {
-					name = strings.TrimPrefix(tag, "name=")
-					break
-				}
-			}
-
-			// Find the oneof field that this struct implements.
-			// Might take O(n^2) to process all of the oneofs, but who cares.
-			for _, of := range oneofFields {
-				if tptr.Implements(of.ityp) {
-					// We have found the corresponding interface for this struct.
-					// That lets us know where this struct should be stored
-					// when we encounter it during unmarshaling.
-					unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal)
-					u.setTag(fieldNum, of.field, unmarshal, 0, name)
-				}
-			}
-		}
-	}
-
-	// Get extension ranges, if any.
-	fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
-	if fn.IsValid() {
-		if !u.extensions.IsValid() && !u.oldExtensions.IsValid() {
-			panic("a message with extensions, but no extensions field in " + t.Name())
-		}
-		u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange)
-	}
-
-	// Explicitly disallow tag 0. This will ensure we flag an error
-	// when decoding a buffer of all zeros. Without this code, we
-	// would decode and skip an all-zero buffer of even length.
-	// [0 0] is [tag=0/wiretype=varint varint-encoded-0].
-	u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) {
-		return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w)
-	}, 0, "")
-
-	// Set mask for required field check.
-	u.reqMask = uint64(1)<<uint(len(u.reqFields)) - 1
-
-	atomic.StoreInt32(&u.initialized, 1)
-}
-
-// setTag stores the unmarshal information for the given tag.
-// tag = tag # for field
-// field/unmarshal = unmarshal info for that field.
-// reqMask = if required, bitmask for field position in required field list. 0 otherwise.
-// name = short name of the field.
-func (u *unmarshalInfo) setTag(tag int, field field, unmarshal unmarshaler, reqMask uint64, name string) {
-	i := unmarshalFieldInfo{field: field, unmarshal: unmarshal, reqMask: reqMask, name: name}
-	n := u.typ.NumField()
-	if tag >= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here?
-		for len(u.dense) <= tag {
-			u.dense = append(u.dense, unmarshalFieldInfo{})
-		}
-		u.dense[tag] = i
-		return
-	}
-	if u.sparse == nil {
-		u.sparse = map[uint64]unmarshalFieldInfo{}
-	}
-	u.sparse[uint64(tag)] = i
-}
-
-// fieldUnmarshaler returns an unmarshaler for the given field.
-func fieldUnmarshaler(f *reflect.StructField) unmarshaler {
-	if f.Type.Kind() == reflect.Map {
-		return makeUnmarshalMap(f)
-	}
-	return typeUnmarshaler(f.Type, f.Tag.Get("protobuf"))
-}
-
-// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair.
-func typeUnmarshaler(t reflect.Type, tags string) unmarshaler {
-	tagArray := strings.Split(tags, ",")
-	encoding := tagArray[0]
-	name := "unknown"
-	proto3 := false
-	validateUTF8 := true
-	for _, tag := range tagArray[3:] {
-		if strings.HasPrefix(tag, "name=") {
-			name = tag[5:]
-		}
-		if tag == "proto3" {
-			proto3 = true
-		}
-	}
-	validateUTF8 = validateUTF8 && proto3
-
-	// Figure out packaging (pointer, slice, or both)
-	slice := false
-	pointer := false
-	if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
-		slice = true
-		t = t.Elem()
-	}
-	if t.Kind() == reflect.Ptr {
-		pointer = true
-		t = t.Elem()
-	}
-
-	// We'll never have both pointer and slice for basic types.
-	if pointer && slice && t.Kind() != reflect.Struct {
-		panic("both pointer and slice for basic type in " + t.Name())
-	}
-
-	switch t.Kind() {
-	case reflect.Bool:
-		if pointer {
-			return unmarshalBoolPtr
-		}
-		if slice {
-			return unmarshalBoolSlice
-		}
-		return unmarshalBoolValue
-	case reflect.Int32:
-		switch encoding {
-		case "fixed32":
-			if pointer {
-				return unmarshalFixedS32Ptr
-			}
-			if slice {
-				return unmarshalFixedS32Slice
-			}
-			return unmarshalFixedS32Value
-		case "varint":
-			// this could be int32 or enum
-			if pointer {
-				return unmarshalInt32Ptr
-			}
-			if slice {
-				return unmarshalInt32Slice
-			}
-			return unmarshalInt32Value
-		case "zigzag32":
-			if pointer {
-				return unmarshalSint32Ptr
-			}
-			if slice {
-				return unmarshalSint32Slice
-			}
-			return unmarshalSint32Value
-		}
-	case reflect.Int64:
-		switch encoding {
-		case "fixed64":
-			if pointer {
-				return unmarshalFixedS64Ptr
-			}
-			if slice {
-				return unmarshalFixedS64Slice
-			}
-			return unmarshalFixedS64Value
-		case "varint":
-			if pointer {
-				return unmarshalInt64Ptr
-			}
-			if slice {
-				return unmarshalInt64Slice
-			}
-			return unmarshalInt64Value
-		case "zigzag64":
-			if pointer {
-				return unmarshalSint64Ptr
-			}
-			if slice {
-				return unmarshalSint64Slice
-			}
-			return unmarshalSint64Value
-		}
-	case reflect.Uint32:
-		switch encoding {
-		case "fixed32":
-			if pointer {
-				return unmarshalFixed32Ptr
-			}
-			if slice {
-				return unmarshalFixed32Slice
-			}
-			return unmarshalFixed32Value
-		case "varint":
-			if pointer {
-				return unmarshalUint32Ptr
-			}
-			if slice {
-				return unmarshalUint32Slice
-			}
-			return unmarshalUint32Value
-		}
-	case reflect.Uint64:
-		switch encoding {
-		case "fixed64":
-			if pointer {
-				return unmarshalFixed64Ptr
-			}
-			if slice {
-				return unmarshalFixed64Slice
-			}
-			return unmarshalFixed64Value
-		case "varint":
-			if pointer {
-				return unmarshalUint64Ptr
-			}
-			if slice {
-				return unmarshalUint64Slice
-			}
-			return unmarshalUint64Value
-		}
-	case reflect.Float32:
-		if pointer {
-			return unmarshalFloat32Ptr
-		}
-		if slice {
-			return unmarshalFloat32Slice
-		}
-		return unmarshalFloat32Value
-	case reflect.Float64:
-		if pointer {
-			return unmarshalFloat64Ptr
-		}
-		if slice {
-			return unmarshalFloat64Slice
-		}
-		return unmarshalFloat64Value
-	case reflect.Map:
-		panic("map type in typeUnmarshaler in " + t.Name())
-	case reflect.Slice:
-		if pointer {
-			panic("bad pointer in slice case in " + t.Name())
-		}
-		if slice {
-			return unmarshalBytesSlice
-		}
-		return unmarshalBytesValue
-	case reflect.String:
-		if validateUTF8 {
-			if pointer {
-				return unmarshalUTF8StringPtr
-			}
-			if slice {
-				return unmarshalUTF8StringSlice
-			}
-			return unmarshalUTF8StringValue
-		}
-		if pointer {
-			return unmarshalStringPtr
-		}
-		if slice {
-			return unmarshalStringSlice
-		}
-		return unmarshalStringValue
-	case reflect.Struct:
-		// message or group field
-		if !pointer {
-			panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding))
-		}
-		switch encoding {
-		case "bytes":
-			if slice {
-				return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name)
-			}
-			return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name)
-		case "group":
-			if slice {
-				return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name)
-			}
-			return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name)
-		}
-	}
-	panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding))
-}
-
-// Below are all the unmarshalers for individual fields of various types.
-
-func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int64(x)
-	*f.toInt64() = v
-	return b, nil
-}
-
-func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int64(x)
-	*f.toInt64Ptr() = &v
-	return b, nil
-}
-
-func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-			v := int64(x)
-			s := f.toInt64Slice()
-			*s = append(*s, v)
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int64(x)
-	s := f.toInt64Slice()
-	*s = append(*s, v)
-	return b, nil
-}
-
-func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int64(x>>1) ^ int64(x)<<63>>63
-	*f.toInt64() = v
-	return b, nil
-}
-
-func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int64(x>>1) ^ int64(x)<<63>>63
-	*f.toInt64Ptr() = &v
-	return b, nil
-}
-
-func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-			v := int64(x>>1) ^ int64(x)<<63>>63
-			s := f.toInt64Slice()
-			*s = append(*s, v)
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int64(x>>1) ^ int64(x)<<63>>63
-	s := f.toInt64Slice()
-	*s = append(*s, v)
-	return b, nil
-}
-
-func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := uint64(x)
-	*f.toUint64() = v
-	return b, nil
-}
-
-func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := uint64(x)
-	*f.toUint64Ptr() = &v
-	return b, nil
-}
-
-func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-			v := uint64(x)
-			s := f.toUint64Slice()
-			*s = append(*s, v)
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := uint64(x)
-	s := f.toUint64Slice()
-	*s = append(*s, v)
-	return b, nil
-}
-
-func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int32(x)
-	*f.toInt32() = v
-	return b, nil
-}
-
-func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int32(x)
-	f.setInt32Ptr(v)
-	return b, nil
-}
-
-func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-			v := int32(x)
-			f.appendInt32Slice(v)
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int32(x)
-	f.appendInt32Slice(v)
-	return b, nil
-}
-
-func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int32(x>>1) ^ int32(x)<<31>>31
-	*f.toInt32() = v
-	return b, nil
-}
-
-func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int32(x>>1) ^ int32(x)<<31>>31
-	f.setInt32Ptr(v)
-	return b, nil
-}
-
-func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-			v := int32(x>>1) ^ int32(x)<<31>>31
-			f.appendInt32Slice(v)
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := int32(x>>1) ^ int32(x)<<31>>31
-	f.appendInt32Slice(v)
-	return b, nil
-}
-
-func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := uint32(x)
-	*f.toUint32() = v
-	return b, nil
-}
-
-func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := uint32(x)
-	*f.toUint32Ptr() = &v
-	return b, nil
-}
-
-func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			b = b[n:]
-			v := uint32(x)
-			s := f.toUint32Slice()
-			*s = append(*s, v)
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	v := uint32(x)
-	s := f.toUint32Slice()
-	*s = append(*s, v)
-	return b, nil
-}
-
-func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
-	*f.toUint64() = v
-	return b[8:], nil
-}
-
-func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
-	*f.toUint64Ptr() = &v
-	return b[8:], nil
-}
-
-func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			if len(b) < 8 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
-			s := f.toUint64Slice()
-			*s = append(*s, v)
-			b = b[8:]
-		}
-		return res, nil
-	}
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
-	s := f.toUint64Slice()
-	*s = append(*s, v)
-	return b[8:], nil
-}
-
-func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
-	*f.toInt64() = v
-	return b[8:], nil
-}
-
-func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
-	*f.toInt64Ptr() = &v
-	return b[8:], nil
-}
-
-func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			if len(b) < 8 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
-			s := f.toInt64Slice()
-			*s = append(*s, v)
-			b = b[8:]
-		}
-		return res, nil
-	}
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
-	s := f.toInt64Slice()
-	*s = append(*s, v)
-	return b[8:], nil
-}
-
-func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
-	*f.toUint32() = v
-	return b[4:], nil
-}
-
-func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
-	*f.toUint32Ptr() = &v
-	return b[4:], nil
-}
-
-func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			if len(b) < 4 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
-			s := f.toUint32Slice()
-			*s = append(*s, v)
-			b = b[4:]
-		}
-		return res, nil
-	}
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
-	s := f.toUint32Slice()
-	*s = append(*s, v)
-	return b[4:], nil
-}
-
-func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
-	*f.toInt32() = v
-	return b[4:], nil
-}
-
-func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
-	f.setInt32Ptr(v)
-	return b[4:], nil
-}
-
-func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			if len(b) < 4 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
-			f.appendInt32Slice(v)
-			b = b[4:]
-		}
-		return res, nil
-	}
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
-	f.appendInt32Slice(v)
-	return b[4:], nil
-}
-
-func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	// Note: any length varint is allowed, even though any sane
-	// encoder will use one byte.
-	// See https://github.com/golang/protobuf/issues/76
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	// TODO: check if x>1? Tests seem to indicate no.
-	v := x != 0
-	*f.toBool() = v
-	return b[n:], nil
-}
-
-func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := x != 0
-	*f.toBoolPtr() = &v
-	return b[n:], nil
-}
-
-func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			x, n = decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := x != 0
-			s := f.toBoolSlice()
-			*s = append(*s, v)
-			b = b[n:]
-		}
-		return res, nil
-	}
-	if w != WireVarint {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := x != 0
-	s := f.toBoolSlice()
-	*s = append(*s, v)
-	return b[n:], nil
-}
-
-func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
-	*f.toFloat64() = v
-	return b[8:], nil
-}
-
-func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
-	*f.toFloat64Ptr() = &v
-	return b[8:], nil
-}
-
-func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			if len(b) < 8 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
-			s := f.toFloat64Slice()
-			*s = append(*s, v)
-			b = b[8:]
-		}
-		return res, nil
-	}
-	if w != WireFixed64 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 8 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
-	s := f.toFloat64Slice()
-	*s = append(*s, v)
-	return b[8:], nil
-}
-
-func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
-	*f.toFloat32() = v
-	return b[4:], nil
-}
-
-func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
-	*f.toFloat32Ptr() = &v
-	return b[4:], nil
-}
-
-func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) {
-	if w == WireBytes { // packed
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		res := b[x:]
-		b = b[:x]
-		for len(b) > 0 {
-			if len(b) < 4 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
-			s := f.toFloat32Slice()
-			*s = append(*s, v)
-			b = b[4:]
-		}
-		return res, nil
-	}
-	if w != WireFixed32 {
-		return b, errInternalBadWireType
-	}
-	if len(b) < 4 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
-	s := f.toFloat32Slice()
-	*s = append(*s, v)
-	return b[4:], nil
-}
-
-func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := string(b[:x])
-	*f.toString() = v
-	return b[x:], nil
-}
-
-func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := string(b[:x])
-	*f.toStringPtr() = &v
-	return b[x:], nil
-}
-
-func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := string(b[:x])
-	s := f.toStringSlice()
-	*s = append(*s, v)
-	return b[x:], nil
-}
-
-func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := string(b[:x])
-	*f.toString() = v
-	if !utf8.ValidString(v) {
-		return b[x:], errInvalidUTF8
-	}
-	return b[x:], nil
-}
-
-func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := string(b[:x])
-	*f.toStringPtr() = &v
-	if !utf8.ValidString(v) {
-		return b[x:], errInvalidUTF8
-	}
-	return b[x:], nil
-}
-
-func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := string(b[:x])
-	s := f.toStringSlice()
-	*s = append(*s, v)
-	if !utf8.ValidString(v) {
-		return b[x:], errInvalidUTF8
-	}
-	return b[x:], nil
-}
-
-var emptyBuf [0]byte
-
-func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	// The use of append here is a trick which avoids the zeroing
-	// that would be required if we used a make/copy pair.
-	// We append to emptyBuf instead of nil because we want
-	// a non-nil result even when the length is 0.
-	v := append(emptyBuf[:], b[:x]...)
-	*f.toBytes() = v
-	return b[x:], nil
-}
-
-func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) {
-	if w != WireBytes {
-		return b, errInternalBadWireType
-	}
-	x, n := decodeVarint(b)
-	if n == 0 {
-		return nil, io.ErrUnexpectedEOF
-	}
-	b = b[n:]
-	if x > uint64(len(b)) {
-		return nil, io.ErrUnexpectedEOF
-	}
-	v := append(emptyBuf[:], b[:x]...)
-	s := f.toBytesSlice()
-	*s = append(*s, v)
-	return b[x:], nil
-}
-
-func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler {
-	return func(b []byte, f pointer, w int) ([]byte, error) {
-		if w != WireBytes {
-			return b, errInternalBadWireType
-		}
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		// First read the message field to see if something is there.
-		// The semantics of multiple submessages are weird.  Instead of
-		// the last one winning (as it is for all other fields), multiple
-		// submessages are merged.
-		v := f.getPointer()
-		if v.isNil() {
-			v = valToPointer(reflect.New(sub.typ))
-			f.setPointer(v)
-		}
-		err := sub.unmarshal(v, b[:x])
-		if err != nil {
-			if r, ok := err.(*RequiredNotSetError); ok {
-				r.field = name + "." + r.field
-			} else {
-				return nil, err
-			}
-		}
-		return b[x:], err
-	}
-}
-
-func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler {
-	return func(b []byte, f pointer, w int) ([]byte, error) {
-		if w != WireBytes {
-			return b, errInternalBadWireType
-		}
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		v := valToPointer(reflect.New(sub.typ))
-		err := sub.unmarshal(v, b[:x])
-		if err != nil {
-			if r, ok := err.(*RequiredNotSetError); ok {
-				r.field = name + "." + r.field
-			} else {
-				return nil, err
-			}
-		}
-		f.appendPointer(v)
-		return b[x:], err
-	}
-}
-
-func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler {
-	return func(b []byte, f pointer, w int) ([]byte, error) {
-		if w != WireStartGroup {
-			return b, errInternalBadWireType
-		}
-		x, y := findEndGroup(b)
-		if x < 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		v := f.getPointer()
-		if v.isNil() {
-			v = valToPointer(reflect.New(sub.typ))
-			f.setPointer(v)
-		}
-		err := sub.unmarshal(v, b[:x])
-		if err != nil {
-			if r, ok := err.(*RequiredNotSetError); ok {
-				r.field = name + "." + r.field
-			} else {
-				return nil, err
-			}
-		}
-		return b[y:], err
-	}
-}
-
-func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler {
-	return func(b []byte, f pointer, w int) ([]byte, error) {
-		if w != WireStartGroup {
-			return b, errInternalBadWireType
-		}
-		x, y := findEndGroup(b)
-		if x < 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		v := valToPointer(reflect.New(sub.typ))
-		err := sub.unmarshal(v, b[:x])
-		if err != nil {
-			if r, ok := err.(*RequiredNotSetError); ok {
-				r.field = name + "." + r.field
-			} else {
-				return nil, err
-			}
-		}
-		f.appendPointer(v)
-		return b[y:], err
-	}
-}
-
-func makeUnmarshalMap(f *reflect.StructField) unmarshaler {
-	t := f.Type
-	kt := t.Key()
-	vt := t.Elem()
-	unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key"))
-	unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val"))
-	return func(b []byte, f pointer, w int) ([]byte, error) {
-		// The map entry is a submessage. Figure out how big it is.
-		if w != WireBytes {
-			return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes)
-		}
-		x, n := decodeVarint(b)
-		if n == 0 {
-			return nil, io.ErrUnexpectedEOF
-		}
-		b = b[n:]
-		if x > uint64(len(b)) {
-			return nil, io.ErrUnexpectedEOF
-		}
-		r := b[x:] // unused data to return
-		b = b[:x]  // data for map entry
-
-		// Note: we could use #keys * #values ~= 200 functions
-		// to do map decoding without reflection. Probably not worth it.
-		// Maps will be somewhat slow. Oh well.
-
-		// Read key and value from data.
-		var nerr nonFatal
-		k := reflect.New(kt)
-		v := reflect.New(vt)
-		for len(b) > 0 {
-			x, n := decodeVarint(b)
-			if n == 0 {
-				return nil, io.ErrUnexpectedEOF
-			}
-			wire := int(x) & 7
-			b = b[n:]
-
-			var err error
-			switch x >> 3 {
-			case 1:
-				b, err = unmarshalKey(b, valToPointer(k), wire)
-			case 2:
-				b, err = unmarshalVal(b, valToPointer(v), wire)
-			default:
-				err = errInternalBadWireType // skip unknown tag
-			}
-
-			if nerr.Merge(err) {
-				continue
-			}
-			if err != errInternalBadWireType {
-				return nil, err
-			}
-
-			// Skip past unknown fields.
-			b, err = skipField(b, wire)
-			if err != nil {
-				return nil, err
-			}
-		}
-
-		// Get map, allocate if needed.
-		m := f.asPointerTo(t).Elem() // an addressable map[K]T
-		if m.IsNil() {
-			m.Set(reflect.MakeMap(t))
-		}
-
-		// Insert into map.
-		m.SetMapIndex(k.Elem(), v.Elem())
-
-		return r, nerr.E
-	}
-}
-
-// makeUnmarshalOneof makes an unmarshaler for oneof fields.
-// for:
-// message Msg {
-//   oneof F {
-//     int64 X = 1;
-//     float64 Y = 2;
-//   }
-// }
-// typ is the type of the concrete entry for a oneof case (e.g. Msg_X).
-// ityp is the interface type of the oneof field (e.g. isMsg_F).
-// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64).
-// Note that this function will be called once for each case in the oneof.
-func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler {
-	sf := typ.Field(0)
-	field0 := toField(&sf)
-	return func(b []byte, f pointer, w int) ([]byte, error) {
-		// Allocate holder for value.
-		v := reflect.New(typ)
-
-		// Unmarshal data into holder.
-		// We unmarshal into the first field of the holder object.
-		var err error
-		var nerr nonFatal
-		b, err = unmarshal(b, valToPointer(v).offset(field0), w)
-		if !nerr.Merge(err) {
-			return nil, err
-		}
-
-		// Write pointer to holder into target field.
-		f.asPointerTo(ityp).Elem().Set(v)
-
-		return b, nerr.E
-	}
-}
-
-// Error used by decode internally.
-var errInternalBadWireType = errors.New("proto: internal error: bad wiretype")
-
-// skipField skips past a field of type wire and returns the remaining bytes.
-func skipField(b []byte, wire int) ([]byte, error) {
-	switch wire {
-	case WireVarint:
-		_, k := decodeVarint(b)
-		if k == 0 {
-			return b, io.ErrUnexpectedEOF
-		}
-		b = b[k:]
-	case WireFixed32:
-		if len(b) < 4 {
-			return b, io.ErrUnexpectedEOF
-		}
-		b = b[4:]
-	case WireFixed64:
-		if len(b) < 8 {
-			return b, io.ErrUnexpectedEOF
-		}
-		b = b[8:]
-	case WireBytes:
-		m, k := decodeVarint(b)
-		if k == 0 || uint64(len(b)-k) < m {
-			return b, io.ErrUnexpectedEOF
-		}
-		b = b[uint64(k)+m:]
-	case WireStartGroup:
-		_, i := findEndGroup(b)
-		if i == -1 {
-			return b, io.ErrUnexpectedEOF
-		}
-		b = b[i:]
-	default:
-		return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire)
-	}
-	return b, nil
-}
-
-// findEndGroup finds the index of the next EndGroup tag.
-// Groups may be nested, so the "next" EndGroup tag is the first
-// unpaired EndGroup.
-// findEndGroup returns the indexes of the start and end of the EndGroup tag.
-// Returns (-1,-1) if it can't find one.
-func findEndGroup(b []byte) (int, int) {
-	depth := 1
-	i := 0
-	for {
-		x, n := decodeVarint(b[i:])
-		if n == 0 {
-			return -1, -1
-		}
-		j := i
-		i += n
-		switch x & 7 {
-		case WireVarint:
-			_, k := decodeVarint(b[i:])
-			if k == 0 {
-				return -1, -1
-			}
-			i += k
-		case WireFixed32:
-			if len(b)-4 < i {
-				return -1, -1
-			}
-			i += 4
-		case WireFixed64:
-			if len(b)-8 < i {
-				return -1, -1
-			}
-			i += 8
-		case WireBytes:
-			m, k := decodeVarint(b[i:])
-			if k == 0 {
-				return -1, -1
-			}
-			i += k
-			if uint64(len(b)-i) < m {
-				return -1, -1
-			}
-			i += int(m)
-		case WireStartGroup:
-			depth++
-		case WireEndGroup:
-			depth--
-			if depth == 0 {
-				return j, i
-			}
-		default:
-			return -1, -1
-		}
-	}
-}
-
-// encodeVarint appends a varint-encoded integer to b and returns the result.
-func encodeVarint(b []byte, x uint64) []byte {
-	for x >= 1<<7 {
-		b = append(b, byte(x&0x7f|0x80))
-		x >>= 7
-	}
-	return append(b, byte(x))
-}
-
-// decodeVarint reads a varint-encoded integer from b.
-// Returns the decoded integer and the number of bytes read.
-// If there is an error, it returns 0,0.
-func decodeVarint(b []byte) (uint64, int) {
-	var x, y uint64
-	if len(b) <= 0 {
-		goto bad
-	}
-	x = uint64(b[0])
-	if x < 0x80 {
-		return x, 1
-	}
-	x -= 0x80
-
-	if len(b) <= 1 {
-		goto bad
-	}
-	y = uint64(b[1])
-	x += y << 7
-	if y < 0x80 {
-		return x, 2
-	}
-	x -= 0x80 << 7
-
-	if len(b) <= 2 {
-		goto bad
-	}
-	y = uint64(b[2])
-	x += y << 14
-	if y < 0x80 {
-		return x, 3
-	}
-	x -= 0x80 << 14
-
-	if len(b) <= 3 {
-		goto bad
-	}
-	y = uint64(b[3])
-	x += y << 21
-	if y < 0x80 {
-		return x, 4
-	}
-	x -= 0x80 << 21
-
-	if len(b) <= 4 {
-		goto bad
-	}
-	y = uint64(b[4])
-	x += y << 28
-	if y < 0x80 {
-		return x, 5
-	}
-	x -= 0x80 << 28
-
-	if len(b) <= 5 {
-		goto bad
-	}
-	y = uint64(b[5])
-	x += y << 35
-	if y < 0x80 {
-		return x, 6
-	}
-	x -= 0x80 << 35
-
-	if len(b) <= 6 {
-		goto bad
-	}
-	y = uint64(b[6])
-	x += y << 42
-	if y < 0x80 {
-		return x, 7
-	}
-	x -= 0x80 << 42
-
-	if len(b) <= 7 {
-		goto bad
-	}
-	y = uint64(b[7])
-	x += y << 49
-	if y < 0x80 {
-		return x, 8
-	}
-	x -= 0x80 << 49
-
-	if len(b) <= 8 {
-		goto bad
-	}
-	y = uint64(b[8])
-	x += y << 56
-	if y < 0x80 {
-		return x, 9
-	}
-	x -= 0x80 << 56
-
-	if len(b) <= 9 {
-		goto bad
-	}
-	y = uint64(b[9])
-	x += y << 63
-	if y < 2 {
-		return x, 10
-	}
-
-bad:
-	return 0, 0
-}

+ 0 - 843
vendor/github.com/golang/protobuf/proto/text.go

@@ -1,843 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-// Functions for writing the text protocol buffer format.
-
-import (
-	"bufio"
-	"bytes"
-	"encoding"
-	"errors"
-	"fmt"
-	"io"
-	"log"
-	"math"
-	"reflect"
-	"sort"
-	"strings"
-)
-
-var (
-	newline         = []byte("\n")
-	spaces          = []byte("                                        ")
-	endBraceNewline = []byte("}\n")
-	backslashN      = []byte{'\\', 'n'}
-	backslashR      = []byte{'\\', 'r'}
-	backslashT      = []byte{'\\', 't'}
-	backslashDQ     = []byte{'\\', '"'}
-	backslashBS     = []byte{'\\', '\\'}
-	posInf          = []byte("inf")
-	negInf          = []byte("-inf")
-	nan             = []byte("nan")
-)
-
-type writer interface {
-	io.Writer
-	WriteByte(byte) error
-}
-
-// textWriter is an io.Writer that tracks its indentation level.
-type textWriter struct {
-	ind      int
-	complete bool // if the current position is a complete line
-	compact  bool // whether to write out as a one-liner
-	w        writer
-}
-
-func (w *textWriter) WriteString(s string) (n int, err error) {
-	if !strings.Contains(s, "\n") {
-		if !w.compact && w.complete {
-			w.writeIndent()
-		}
-		w.complete = false
-		return io.WriteString(w.w, s)
-	}
-	// WriteString is typically called without newlines, so this
-	// codepath and its copy are rare.  We copy to avoid
-	// duplicating all of Write's logic here.
-	return w.Write([]byte(s))
-}
-
-func (w *textWriter) Write(p []byte) (n int, err error) {
-	newlines := bytes.Count(p, newline)
-	if newlines == 0 {
-		if !w.compact && w.complete {
-			w.writeIndent()
-		}
-		n, err = w.w.Write(p)
-		w.complete = false
-		return n, err
-	}
-
-	frags := bytes.SplitN(p, newline, newlines+1)
-	if w.compact {
-		for i, frag := range frags {
-			if i > 0 {
-				if err := w.w.WriteByte(' '); err != nil {
-					return n, err
-				}
-				n++
-			}
-			nn, err := w.w.Write(frag)
-			n += nn
-			if err != nil {
-				return n, err
-			}
-		}
-		return n, nil
-	}
-
-	for i, frag := range frags {
-		if w.complete {
-			w.writeIndent()
-		}
-		nn, err := w.w.Write(frag)
-		n += nn
-		if err != nil {
-			return n, err
-		}
-		if i+1 < len(frags) {
-			if err := w.w.WriteByte('\n'); err != nil {
-				return n, err
-			}
-			n++
-		}
-	}
-	w.complete = len(frags[len(frags)-1]) == 0
-	return n, nil
-}
-
-func (w *textWriter) WriteByte(c byte) error {
-	if w.compact && c == '\n' {
-		c = ' '
-	}
-	if !w.compact && w.complete {
-		w.writeIndent()
-	}
-	err := w.w.WriteByte(c)
-	w.complete = c == '\n'
-	return err
-}
-
-func (w *textWriter) indent() { w.ind++ }
-
-func (w *textWriter) unindent() {
-	if w.ind == 0 {
-		log.Print("proto: textWriter unindented too far")
-		return
-	}
-	w.ind--
-}
-
-func writeName(w *textWriter, props *Properties) error {
-	if _, err := w.WriteString(props.OrigName); err != nil {
-		return err
-	}
-	if props.Wire != "group" {
-		return w.WriteByte(':')
-	}
-	return nil
-}
-
-func requiresQuotes(u string) bool {
-	// When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted.
-	for _, ch := range u {
-		switch {
-		case ch == '.' || ch == '/' || ch == '_':
-			continue
-		case '0' <= ch && ch <= '9':
-			continue
-		case 'A' <= ch && ch <= 'Z':
-			continue
-		case 'a' <= ch && ch <= 'z':
-			continue
-		default:
-			return true
-		}
-	}
-	return false
-}
-
-// isAny reports whether sv is a google.protobuf.Any message
-func isAny(sv reflect.Value) bool {
-	type wkt interface {
-		XXX_WellKnownType() string
-	}
-	t, ok := sv.Addr().Interface().(wkt)
-	return ok && t.XXX_WellKnownType() == "Any"
-}
-
-// writeProto3Any writes an expanded google.protobuf.Any message.
-//
-// It returns (false, nil) if sv value can't be unmarshaled (e.g. because
-// required messages are not linked in).
-//
-// It returns (true, error) when sv was written in expanded format or an error
-// was encountered.
-func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) {
-	turl := sv.FieldByName("TypeUrl")
-	val := sv.FieldByName("Value")
-	if !turl.IsValid() || !val.IsValid() {
-		return true, errors.New("proto: invalid google.protobuf.Any message")
-	}
-
-	b, ok := val.Interface().([]byte)
-	if !ok {
-		return true, errors.New("proto: invalid google.protobuf.Any message")
-	}
-
-	parts := strings.Split(turl.String(), "/")
-	mt := MessageType(parts[len(parts)-1])
-	if mt == nil {
-		return false, nil
-	}
-	m := reflect.New(mt.Elem())
-	if err := Unmarshal(b, m.Interface().(Message)); err != nil {
-		return false, nil
-	}
-	w.Write([]byte("["))
-	u := turl.String()
-	if requiresQuotes(u) {
-		writeString(w, u)
-	} else {
-		w.Write([]byte(u))
-	}
-	if w.compact {
-		w.Write([]byte("]:<"))
-	} else {
-		w.Write([]byte("]: <\n"))
-		w.ind++
-	}
-	if err := tm.writeStruct(w, m.Elem()); err != nil {
-		return true, err
-	}
-	if w.compact {
-		w.Write([]byte("> "))
-	} else {
-		w.ind--
-		w.Write([]byte(">\n"))
-	}
-	return true, nil
-}
-
-func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
-	if tm.ExpandAny && isAny(sv) {
-		if canExpand, err := tm.writeProto3Any(w, sv); canExpand {
-			return err
-		}
-	}
-	st := sv.Type()
-	sprops := GetProperties(st)
-	for i := 0; i < sv.NumField(); i++ {
-		fv := sv.Field(i)
-		props := sprops.Prop[i]
-		name := st.Field(i).Name
-
-		if name == "XXX_NoUnkeyedLiteral" {
-			continue
-		}
-
-		if strings.HasPrefix(name, "XXX_") {
-			// There are two XXX_ fields:
-			//   XXX_unrecognized []byte
-			//   XXX_extensions   map[int32]proto.Extension
-			// The first is handled here;
-			// the second is handled at the bottom of this function.
-			if name == "XXX_unrecognized" && !fv.IsNil() {
-				if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil {
-					return err
-				}
-			}
-			continue
-		}
-		if fv.Kind() == reflect.Ptr && fv.IsNil() {
-			// Field not filled in. This could be an optional field or
-			// a required field that wasn't filled in. Either way, there
-			// isn't anything we can show for it.
-			continue
-		}
-		if fv.Kind() == reflect.Slice && fv.IsNil() {
-			// Repeated field that is empty, or a bytes field that is unused.
-			continue
-		}
-
-		if props.Repeated && fv.Kind() == reflect.Slice {
-			// Repeated field.
-			for j := 0; j < fv.Len(); j++ {
-				if err := writeName(w, props); err != nil {
-					return err
-				}
-				if !w.compact {
-					if err := w.WriteByte(' '); err != nil {
-						return err
-					}
-				}
-				v := fv.Index(j)
-				if v.Kind() == reflect.Ptr && v.IsNil() {
-					// A nil message in a repeated field is not valid,
-					// but we can handle that more gracefully than panicking.
-					if _, err := w.Write([]byte("<nil>\n")); err != nil {
-						return err
-					}
-					continue
-				}
-				if err := tm.writeAny(w, v, props); err != nil {
-					return err
-				}
-				if err := w.WriteByte('\n'); err != nil {
-					return err
-				}
-			}
-			continue
-		}
-		if fv.Kind() == reflect.Map {
-			// Map fields are rendered as a repeated struct with key/value fields.
-			keys := fv.MapKeys()
-			sort.Sort(mapKeys(keys))
-			for _, key := range keys {
-				val := fv.MapIndex(key)
-				if err := writeName(w, props); err != nil {
-					return err
-				}
-				if !w.compact {
-					if err := w.WriteByte(' '); err != nil {
-						return err
-					}
-				}
-				// open struct
-				if err := w.WriteByte('<'); err != nil {
-					return err
-				}
-				if !w.compact {
-					if err := w.WriteByte('\n'); err != nil {
-						return err
-					}
-				}
-				w.indent()
-				// key
-				if _, err := w.WriteString("key:"); err != nil {
-					return err
-				}
-				if !w.compact {
-					if err := w.WriteByte(' '); err != nil {
-						return err
-					}
-				}
-				if err := tm.writeAny(w, key, props.MapKeyProp); err != nil {
-					return err
-				}
-				if err := w.WriteByte('\n'); err != nil {
-					return err
-				}
-				// nil values aren't legal, but we can avoid panicking because of them.
-				if val.Kind() != reflect.Ptr || !val.IsNil() {
-					// value
-					if _, err := w.WriteString("value:"); err != nil {
-						return err
-					}
-					if !w.compact {
-						if err := w.WriteByte(' '); err != nil {
-							return err
-						}
-					}
-					if err := tm.writeAny(w, val, props.MapValProp); err != nil {
-						return err
-					}
-					if err := w.WriteByte('\n'); err != nil {
-						return err
-					}
-				}
-				// close struct
-				w.unindent()
-				if err := w.WriteByte('>'); err != nil {
-					return err
-				}
-				if err := w.WriteByte('\n'); err != nil {
-					return err
-				}
-			}
-			continue
-		}
-		if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 {
-			// empty bytes field
-			continue
-		}
-		if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice {
-			// proto3 non-repeated scalar field; skip if zero value
-			if isProto3Zero(fv) {
-				continue
-			}
-		}
-
-		if fv.Kind() == reflect.Interface {
-			// Check if it is a oneof.
-			if st.Field(i).Tag.Get("protobuf_oneof") != "" {
-				// fv is nil, or holds a pointer to generated struct.
-				// That generated struct has exactly one field,
-				// which has a protobuf struct tag.
-				if fv.IsNil() {
-					continue
-				}
-				inner := fv.Elem().Elem() // interface -> *T -> T
-				tag := inner.Type().Field(0).Tag.Get("protobuf")
-				props = new(Properties) // Overwrite the outer props var, but not its pointee.
-				props.Parse(tag)
-				// Write the value in the oneof, not the oneof itself.
-				fv = inner.Field(0)
-
-				// Special case to cope with malformed messages gracefully:
-				// If the value in the oneof is a nil pointer, don't panic
-				// in writeAny.
-				if fv.Kind() == reflect.Ptr && fv.IsNil() {
-					// Use errors.New so writeAny won't render quotes.
-					msg := errors.New("/* nil */")
-					fv = reflect.ValueOf(&msg).Elem()
-				}
-			}
-		}
-
-		if err := writeName(w, props); err != nil {
-			return err
-		}
-		if !w.compact {
-			if err := w.WriteByte(' '); err != nil {
-				return err
-			}
-		}
-
-		// Enums have a String method, so writeAny will work fine.
-		if err := tm.writeAny(w, fv, props); err != nil {
-			return err
-		}
-
-		if err := w.WriteByte('\n'); err != nil {
-			return err
-		}
-	}
-
-	// Extensions (the XXX_extensions field).
-	pv := sv.Addr()
-	if _, err := extendable(pv.Interface()); err == nil {
-		if err := tm.writeExtensions(w, pv); err != nil {
-			return err
-		}
-	}
-
-	return nil
-}
-
-// writeAny writes an arbitrary field.
-func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
-	v = reflect.Indirect(v)
-
-	// Floats have special cases.
-	if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {
-		x := v.Float()
-		var b []byte
-		switch {
-		case math.IsInf(x, 1):
-			b = posInf
-		case math.IsInf(x, -1):
-			b = negInf
-		case math.IsNaN(x):
-			b = nan
-		}
-		if b != nil {
-			_, err := w.Write(b)
-			return err
-		}
-		// Other values are handled below.
-	}
-
-	// We don't attempt to serialise every possible value type; only those
-	// that can occur in protocol buffers.
-	switch v.Kind() {
-	case reflect.Slice:
-		// Should only be a []byte; repeated fields are handled in writeStruct.
-		if err := writeString(w, string(v.Bytes())); err != nil {
-			return err
-		}
-	case reflect.String:
-		if err := writeString(w, v.String()); err != nil {
-			return err
-		}
-	case reflect.Struct:
-		// Required/optional group/message.
-		var bra, ket byte = '<', '>'
-		if props != nil && props.Wire == "group" {
-			bra, ket = '{', '}'
-		}
-		if err := w.WriteByte(bra); err != nil {
-			return err
-		}
-		if !w.compact {
-			if err := w.WriteByte('\n'); err != nil {
-				return err
-			}
-		}
-		w.indent()
-		if v.CanAddr() {
-			// Calling v.Interface on a struct causes the reflect package to
-			// copy the entire struct. This is racy with the new Marshaler
-			// since we atomically update the XXX_sizecache.
-			//
-			// Thus, we retrieve a pointer to the struct if possible to avoid
-			// a race since v.Interface on the pointer doesn't copy the struct.
-			//
-			// If v is not addressable, then we are not worried about a race
-			// since it implies that the binary Marshaler cannot possibly be
-			// mutating this value.
-			v = v.Addr()
-		}
-		if etm, ok := v.Interface().(encoding.TextMarshaler); ok {
-			text, err := etm.MarshalText()
-			if err != nil {
-				return err
-			}
-			if _, err = w.Write(text); err != nil {
-				return err
-			}
-		} else {
-			if v.Kind() == reflect.Ptr {
-				v = v.Elem()
-			}
-			if err := tm.writeStruct(w, v); err != nil {
-				return err
-			}
-		}
-		w.unindent()
-		if err := w.WriteByte(ket); err != nil {
-			return err
-		}
-	default:
-		_, err := fmt.Fprint(w, v.Interface())
-		return err
-	}
-	return nil
-}
-
-// equivalent to C's isprint.
-func isprint(c byte) bool {
-	return c >= 0x20 && c < 0x7f
-}
-
-// writeString writes a string in the protocol buffer text format.
-// It is similar to strconv.Quote except we don't use Go escape sequences,
-// we treat the string as a byte sequence, and we use octal escapes.
-// These differences are to maintain interoperability with the other
-// languages' implementations of the text format.
-func writeString(w *textWriter, s string) error {
-	// use WriteByte here to get any needed indent
-	if err := w.WriteByte('"'); err != nil {
-		return err
-	}
-	// Loop over the bytes, not the runes.
-	for i := 0; i < len(s); i++ {
-		var err error
-		// Divergence from C++: we don't escape apostrophes.
-		// There's no need to escape them, and the C++ parser
-		// copes with a naked apostrophe.
-		switch c := s[i]; c {
-		case '\n':
-			_, err = w.w.Write(backslashN)
-		case '\r':
-			_, err = w.w.Write(backslashR)
-		case '\t':
-			_, err = w.w.Write(backslashT)
-		case '"':
-			_, err = w.w.Write(backslashDQ)
-		case '\\':
-			_, err = w.w.Write(backslashBS)
-		default:
-			if isprint(c) {
-				err = w.w.WriteByte(c)
-			} else {
-				_, err = fmt.Fprintf(w.w, "\\%03o", c)
-			}
-		}
-		if err != nil {
-			return err
-		}
-	}
-	return w.WriteByte('"')
-}
-
-func writeUnknownStruct(w *textWriter, data []byte) (err error) {
-	if !w.compact {
-		if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil {
-			return err
-		}
-	}
-	b := NewBuffer(data)
-	for b.index < len(b.buf) {
-		x, err := b.DecodeVarint()
-		if err != nil {
-			_, err := fmt.Fprintf(w, "/* %v */\n", err)
-			return err
-		}
-		wire, tag := x&7, x>>3
-		if wire == WireEndGroup {
-			w.unindent()
-			if _, err := w.Write(endBraceNewline); err != nil {
-				return err
-			}
-			continue
-		}
-		if _, err := fmt.Fprint(w, tag); err != nil {
-			return err
-		}
-		if wire != WireStartGroup {
-			if err := w.WriteByte(':'); err != nil {
-				return err
-			}
-		}
-		if !w.compact || wire == WireStartGroup {
-			if err := w.WriteByte(' '); err != nil {
-				return err
-			}
-		}
-		switch wire {
-		case WireBytes:
-			buf, e := b.DecodeRawBytes(false)
-			if e == nil {
-				_, err = fmt.Fprintf(w, "%q", buf)
-			} else {
-				_, err = fmt.Fprintf(w, "/* %v */", e)
-			}
-		case WireFixed32:
-			x, err = b.DecodeFixed32()
-			err = writeUnknownInt(w, x, err)
-		case WireFixed64:
-			x, err = b.DecodeFixed64()
-			err = writeUnknownInt(w, x, err)
-		case WireStartGroup:
-			err = w.WriteByte('{')
-			w.indent()
-		case WireVarint:
-			x, err = b.DecodeVarint()
-			err = writeUnknownInt(w, x, err)
-		default:
-			_, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire)
-		}
-		if err != nil {
-			return err
-		}
-		if err = w.WriteByte('\n'); err != nil {
-			return err
-		}
-	}
-	return nil
-}
-
-func writeUnknownInt(w *textWriter, x uint64, err error) error {
-	if err == nil {
-		_, err = fmt.Fprint(w, x)
-	} else {
-		_, err = fmt.Fprintf(w, "/* %v */", err)
-	}
-	return err
-}
-
-type int32Slice []int32
-
-func (s int32Slice) Len() int           { return len(s) }
-func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
-func (s int32Slice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
-
-// writeExtensions writes all the extensions in pv.
-// pv is assumed to be a pointer to a protocol message struct that is extendable.
-func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error {
-	emap := extensionMaps[pv.Type().Elem()]
-	ep, _ := extendable(pv.Interface())
-
-	// Order the extensions by ID.
-	// This isn't strictly necessary, but it will give us
-	// canonical output, which will also make testing easier.
-	m, mu := ep.extensionsRead()
-	if m == nil {
-		return nil
-	}
-	mu.Lock()
-	ids := make([]int32, 0, len(m))
-	for id := range m {
-		ids = append(ids, id)
-	}
-	sort.Sort(int32Slice(ids))
-	mu.Unlock()
-
-	for _, extNum := range ids {
-		ext := m[extNum]
-		var desc *ExtensionDesc
-		if emap != nil {
-			desc = emap[extNum]
-		}
-		if desc == nil {
-			// Unknown extension.
-			if err := writeUnknownStruct(w, ext.enc); err != nil {
-				return err
-			}
-			continue
-		}
-
-		pb, err := GetExtension(ep, desc)
-		if err != nil {
-			return fmt.Errorf("failed getting extension: %v", err)
-		}
-
-		// Repeated extensions will appear as a slice.
-		if !desc.repeated() {
-			if err := tm.writeExtension(w, desc.Name, pb); err != nil {
-				return err
-			}
-		} else {
-			v := reflect.ValueOf(pb)
-			for i := 0; i < v.Len(); i++ {
-				if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil {
-					return err
-				}
-			}
-		}
-	}
-	return nil
-}
-
-func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error {
-	if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil {
-		return err
-	}
-	if !w.compact {
-		if err := w.WriteByte(' '); err != nil {
-			return err
-		}
-	}
-	if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil {
-		return err
-	}
-	if err := w.WriteByte('\n'); err != nil {
-		return err
-	}
-	return nil
-}
-
-func (w *textWriter) writeIndent() {
-	if !w.complete {
-		return
-	}
-	remain := w.ind * 2
-	for remain > 0 {
-		n := remain
-		if n > len(spaces) {
-			n = len(spaces)
-		}
-		w.w.Write(spaces[:n])
-		remain -= n
-	}
-	w.complete = false
-}
-
-// TextMarshaler is a configurable text format marshaler.
-type TextMarshaler struct {
-	Compact   bool // use compact text format (one line).
-	ExpandAny bool // expand google.protobuf.Any messages of known types
-}
-
-// Marshal writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error {
-	val := reflect.ValueOf(pb)
-	if pb == nil || val.IsNil() {
-		w.Write([]byte("<nil>"))
-		return nil
-	}
-	var bw *bufio.Writer
-	ww, ok := w.(writer)
-	if !ok {
-		bw = bufio.NewWriter(w)
-		ww = bw
-	}
-	aw := &textWriter{
-		w:        ww,
-		complete: true,
-		compact:  tm.Compact,
-	}
-
-	if etm, ok := pb.(encoding.TextMarshaler); ok {
-		text, err := etm.MarshalText()
-		if err != nil {
-			return err
-		}
-		if _, err = aw.Write(text); err != nil {
-			return err
-		}
-		if bw != nil {
-			return bw.Flush()
-		}
-		return nil
-	}
-	// Dereference the received pointer so we don't have outer < and >.
-	v := reflect.Indirect(val)
-	if err := tm.writeStruct(aw, v); err != nil {
-		return err
-	}
-	if bw != nil {
-		return bw.Flush()
-	}
-	return nil
-}
-
-// Text is the same as Marshal, but returns the string directly.
-func (tm *TextMarshaler) Text(pb Message) string {
-	var buf bytes.Buffer
-	tm.Marshal(&buf, pb)
-	return buf.String()
-}
-
-var (
-	defaultTextMarshaler = TextMarshaler{}
-	compactTextMarshaler = TextMarshaler{Compact: true}
-)
-
-// TODO: consider removing some of the Marshal functions below.
-
-// MarshalText writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }
-
-// MarshalTextString is the same as MarshalText, but returns the string directly.
-func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }
-
-// CompactText writes a given protocol buffer in compact text format (one line).
-func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }
-
-// CompactTextString is the same as CompactText, but returns the string directly.
-func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }

+ 0 - 880
vendor/github.com/golang/protobuf/proto/text_parser.go

@@ -1,880 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-// Functions for parsing the Text protocol buffer format.
-// TODO: message sets.
-
-import (
-	"encoding"
-	"errors"
-	"fmt"
-	"reflect"
-	"strconv"
-	"strings"
-	"unicode/utf8"
-)
-
-// Error string emitted when deserializing Any and fields are already set
-const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set"
-
-type ParseError struct {
-	Message string
-	Line    int // 1-based line number
-	Offset  int // 0-based byte offset from start of input
-}
-
-func (p *ParseError) Error() string {
-	if p.Line == 1 {
-		// show offset only for first line
-		return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message)
-	}
-	return fmt.Sprintf("line %d: %v", p.Line, p.Message)
-}
-
-type token struct {
-	value    string
-	err      *ParseError
-	line     int    // line number
-	offset   int    // byte number from start of input, not start of line
-	unquoted string // the unquoted version of value, if it was a quoted string
-}
-
-func (t *token) String() string {
-	if t.err == nil {
-		return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset)
-	}
-	return fmt.Sprintf("parse error: %v", t.err)
-}
-
-type textParser struct {
-	s            string // remaining input
-	done         bool   // whether the parsing is finished (success or error)
-	backed       bool   // whether back() was called
-	offset, line int
-	cur          token
-}
-
-func newTextParser(s string) *textParser {
-	p := new(textParser)
-	p.s = s
-	p.line = 1
-	p.cur.line = 1
-	return p
-}
-
-func (p *textParser) errorf(format string, a ...interface{}) *ParseError {
-	pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}
-	p.cur.err = pe
-	p.done = true
-	return pe
-}
-
-// Numbers and identifiers are matched by [-+._A-Za-z0-9]
-func isIdentOrNumberChar(c byte) bool {
-	switch {
-	case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':
-		return true
-	case '0' <= c && c <= '9':
-		return true
-	}
-	switch c {
-	case '-', '+', '.', '_':
-		return true
-	}
-	return false
-}
-
-func isWhitespace(c byte) bool {
-	switch c {
-	case ' ', '\t', '\n', '\r':
-		return true
-	}
-	return false
-}
-
-func isQuote(c byte) bool {
-	switch c {
-	case '"', '\'':
-		return true
-	}
-	return false
-}
-
-func (p *textParser) skipWhitespace() {
-	i := 0
-	for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {
-		if p.s[i] == '#' {
-			// comment; skip to end of line or input
-			for i < len(p.s) && p.s[i] != '\n' {
-				i++
-			}
-			if i == len(p.s) {
-				break
-			}
-		}
-		if p.s[i] == '\n' {
-			p.line++
-		}
-		i++
-	}
-	p.offset += i
-	p.s = p.s[i:len(p.s)]
-	if len(p.s) == 0 {
-		p.done = true
-	}
-}
-
-func (p *textParser) advance() {
-	// Skip whitespace
-	p.skipWhitespace()
-	if p.done {
-		return
-	}
-
-	// Start of non-whitespace
-	p.cur.err = nil
-	p.cur.offset, p.cur.line = p.offset, p.line
-	p.cur.unquoted = ""
-	switch p.s[0] {
-	case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/':
-		// Single symbol
-		p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]
-	case '"', '\'':
-		// Quoted string
-		i := 1
-		for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' {
-			if p.s[i] == '\\' && i+1 < len(p.s) {
-				// skip escaped char
-				i++
-			}
-			i++
-		}
-		if i >= len(p.s) || p.s[i] != p.s[0] {
-			p.errorf("unmatched quote")
-			return
-		}
-		unq, err := unquoteC(p.s[1:i], rune(p.s[0]))
-		if err != nil {
-			p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err)
-			return
-		}
-		p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]
-		p.cur.unquoted = unq
-	default:
-		i := 0
-		for i < len(p.s) && isIdentOrNumberChar(p.s[i]) {
-			i++
-		}
-		if i == 0 {
-			p.errorf("unexpected byte %#x", p.s[0])
-			return
-		}
-		p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]
-	}
-	p.offset += len(p.cur.value)
-}
-
-var (
-	errBadUTF8 = errors.New("proto: bad UTF-8")
-)
-
-func unquoteC(s string, quote rune) (string, error) {
-	// This is based on C++'s tokenizer.cc.
-	// Despite its name, this is *not* parsing C syntax.
-	// For instance, "\0" is an invalid quoted string.
-
-	// Avoid allocation in trivial cases.
-	simple := true
-	for _, r := range s {
-		if r == '\\' || r == quote {
-			simple = false
-			break
-		}
-	}
-	if simple {
-		return s, nil
-	}
-
-	buf := make([]byte, 0, 3*len(s)/2)
-	for len(s) > 0 {
-		r, n := utf8.DecodeRuneInString(s)
-		if r == utf8.RuneError && n == 1 {
-			return "", errBadUTF8
-		}
-		s = s[n:]
-		if r != '\\' {
-			if r < utf8.RuneSelf {
-				buf = append(buf, byte(r))
-			} else {
-				buf = append(buf, string(r)...)
-			}
-			continue
-		}
-
-		ch, tail, err := unescape(s)
-		if err != nil {
-			return "", err
-		}
-		buf = append(buf, ch...)
-		s = tail
-	}
-	return string(buf), nil
-}
-
-func unescape(s string) (ch string, tail string, err error) {
-	r, n := utf8.DecodeRuneInString(s)
-	if r == utf8.RuneError && n == 1 {
-		return "", "", errBadUTF8
-	}
-	s = s[n:]
-	switch r {
-	case 'a':
-		return "\a", s, nil
-	case 'b':
-		return "\b", s, nil
-	case 'f':
-		return "\f", s, nil
-	case 'n':
-		return "\n", s, nil
-	case 'r':
-		return "\r", s, nil
-	case 't':
-		return "\t", s, nil
-	case 'v':
-		return "\v", s, nil
-	case '?':
-		return "?", s, nil // trigraph workaround
-	case '\'', '"', '\\':
-		return string(r), s, nil
-	case '0', '1', '2', '3', '4', '5', '6', '7':
-		if len(s) < 2 {
-			return "", "", fmt.Errorf(`\%c requires 2 following digits`, r)
-		}
-		ss := string(r) + s[:2]
-		s = s[2:]
-		i, err := strconv.ParseUint(ss, 8, 8)
-		if err != nil {
-			return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss)
-		}
-		return string([]byte{byte(i)}), s, nil
-	case 'x', 'X', 'u', 'U':
-		var n int
-		switch r {
-		case 'x', 'X':
-			n = 2
-		case 'u':
-			n = 4
-		case 'U':
-			n = 8
-		}
-		if len(s) < n {
-			return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n)
-		}
-		ss := s[:n]
-		s = s[n:]
-		i, err := strconv.ParseUint(ss, 16, 64)
-		if err != nil {
-			return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss)
-		}
-		if r == 'x' || r == 'X' {
-			return string([]byte{byte(i)}), s, nil
-		}
-		if i > utf8.MaxRune {
-			return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss)
-		}
-		return string(i), s, nil
-	}
-	return "", "", fmt.Errorf(`unknown escape \%c`, r)
-}
-
-// Back off the parser by one token. Can only be done between calls to next().
-// It makes the next advance() a no-op.
-func (p *textParser) back() { p.backed = true }
-
-// Advances the parser and returns the new current token.
-func (p *textParser) next() *token {
-	if p.backed || p.done {
-		p.backed = false
-		return &p.cur
-	}
-	p.advance()
-	if p.done {
-		p.cur.value = ""
-	} else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
-		// Look for multiple quoted strings separated by whitespace,
-		// and concatenate them.
-		cat := p.cur
-		for {
-			p.skipWhitespace()
-			if p.done || !isQuote(p.s[0]) {
-				break
-			}
-			p.advance()
-			if p.cur.err != nil {
-				return &p.cur
-			}
-			cat.value += " " + p.cur.value
-			cat.unquoted += p.cur.unquoted
-		}
-		p.done = false // parser may have seen EOF, but we want to return cat
-		p.cur = cat
-	}
-	return &p.cur
-}
-
-func (p *textParser) consumeToken(s string) error {
-	tok := p.next()
-	if tok.err != nil {
-		return tok.err
-	}
-	if tok.value != s {
-		p.back()
-		return p.errorf("expected %q, found %q", s, tok.value)
-	}
-	return nil
-}
-
-// Return a RequiredNotSetError indicating which required field was not set.
-func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError {
-	st := sv.Type()
-	sprops := GetProperties(st)
-	for i := 0; i < st.NumField(); i++ {
-		if !isNil(sv.Field(i)) {
-			continue
-		}
-
-		props := sprops.Prop[i]
-		if props.Required {
-			return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)}
-		}
-	}
-	return &RequiredNotSetError{fmt.Sprintf("%v.<unknown field name>", st)} // should not happen
-}
-
-// Returns the index in the struct for the named field, as well as the parsed tag properties.
-func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {
-	i, ok := sprops.decoderOrigNames[name]
-	if ok {
-		return i, sprops.Prop[i], true
-	}
-	return -1, nil, false
-}
-
-// Consume a ':' from the input stream (if the next token is a colon),
-// returning an error if a colon is needed but not present.
-func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError {
-	tok := p.next()
-	if tok.err != nil {
-		return tok.err
-	}
-	if tok.value != ":" {
-		// Colon is optional when the field is a group or message.
-		needColon := true
-		switch props.Wire {
-		case "group":
-			needColon = false
-		case "bytes":
-			// A "bytes" field is either a message, a string, or a repeated field;
-			// those three become *T, *string and []T respectively, so we can check for
-			// this field being a pointer to a non-string.
-			if typ.Kind() == reflect.Ptr {
-				// *T or *string
-				if typ.Elem().Kind() == reflect.String {
-					break
-				}
-			} else if typ.Kind() == reflect.Slice {
-				// []T or []*T
-				if typ.Elem().Kind() != reflect.Ptr {
-					break
-				}
-			} else if typ.Kind() == reflect.String {
-				// The proto3 exception is for a string field,
-				// which requires a colon.
-				break
-			}
-			needColon = false
-		}
-		if needColon {
-			return p.errorf("expected ':', found %q", tok.value)
-		}
-		p.back()
-	}
-	return nil
-}
-
-func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
-	st := sv.Type()
-	sprops := GetProperties(st)
-	reqCount := sprops.reqCount
-	var reqFieldErr error
-	fieldSet := make(map[string]bool)
-	// A struct is a sequence of "name: value", terminated by one of
-	// '>' or '}', or the end of the input.  A name may also be
-	// "[extension]" or "[type/url]".
-	//
-	// The whole struct can also be an expanded Any message, like:
-	// [type/url] < ... struct contents ... >
-	for {
-		tok := p.next()
-		if tok.err != nil {
-			return tok.err
-		}
-		if tok.value == terminator {
-			break
-		}
-		if tok.value == "[" {
-			// Looks like an extension or an Any.
-			//
-			// TODO: Check whether we need to handle
-			// namespace rooted names (e.g. ".something.Foo").
-			extName, err := p.consumeExtName()
-			if err != nil {
-				return err
-			}
-
-			if s := strings.LastIndex(extName, "/"); s >= 0 {
-				// If it contains a slash, it's an Any type URL.
-				messageName := extName[s+1:]
-				mt := MessageType(messageName)
-				if mt == nil {
-					return p.errorf("unrecognized message %q in google.protobuf.Any", messageName)
-				}
-				tok = p.next()
-				if tok.err != nil {
-					return tok.err
-				}
-				// consume an optional colon
-				if tok.value == ":" {
-					tok = p.next()
-					if tok.err != nil {
-						return tok.err
-					}
-				}
-				var terminator string
-				switch tok.value {
-				case "<":
-					terminator = ">"
-				case "{":
-					terminator = "}"
-				default:
-					return p.errorf("expected '{' or '<', found %q", tok.value)
-				}
-				v := reflect.New(mt.Elem())
-				if pe := p.readStruct(v.Elem(), terminator); pe != nil {
-					return pe
-				}
-				b, err := Marshal(v.Interface().(Message))
-				if err != nil {
-					return p.errorf("failed to marshal message of type %q: %v", messageName, err)
-				}
-				if fieldSet["type_url"] {
-					return p.errorf(anyRepeatedlyUnpacked, "type_url")
-				}
-				if fieldSet["value"] {
-					return p.errorf(anyRepeatedlyUnpacked, "value")
-				}
-				sv.FieldByName("TypeUrl").SetString(extName)
-				sv.FieldByName("Value").SetBytes(b)
-				fieldSet["type_url"] = true
-				fieldSet["value"] = true
-				continue
-			}
-
-			var desc *ExtensionDesc
-			// This could be faster, but it's functional.
-			// TODO: Do something smarter than a linear scan.
-			for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) {
-				if d.Name == extName {
-					desc = d
-					break
-				}
-			}
-			if desc == nil {
-				return p.errorf("unrecognized extension %q", extName)
-			}
-
-			props := &Properties{}
-			props.Parse(desc.Tag)
-
-			typ := reflect.TypeOf(desc.ExtensionType)
-			if err := p.checkForColon(props, typ); err != nil {
-				return err
-			}
-
-			rep := desc.repeated()
-
-			// Read the extension structure, and set it in
-			// the value we're constructing.
-			var ext reflect.Value
-			if !rep {
-				ext = reflect.New(typ).Elem()
-			} else {
-				ext = reflect.New(typ.Elem()).Elem()
-			}
-			if err := p.readAny(ext, props); err != nil {
-				if _, ok := err.(*RequiredNotSetError); !ok {
-					return err
-				}
-				reqFieldErr = err
-			}
-			ep := sv.Addr().Interface().(Message)
-			if !rep {
-				SetExtension(ep, desc, ext.Interface())
-			} else {
-				old, err := GetExtension(ep, desc)
-				var sl reflect.Value
-				if err == nil {
-					sl = reflect.ValueOf(old) // existing slice
-				} else {
-					sl = reflect.MakeSlice(typ, 0, 1)
-				}
-				sl = reflect.Append(sl, ext)
-				SetExtension(ep, desc, sl.Interface())
-			}
-			if err := p.consumeOptionalSeparator(); err != nil {
-				return err
-			}
-			continue
-		}
-
-		// This is a normal, non-extension field.
-		name := tok.value
-		var dst reflect.Value
-		fi, props, ok := structFieldByName(sprops, name)
-		if ok {
-			dst = sv.Field(fi)
-		} else if oop, ok := sprops.OneofTypes[name]; ok {
-			// It is a oneof.
-			props = oop.Prop
-			nv := reflect.New(oop.Type.Elem())
-			dst = nv.Elem().Field(0)
-			field := sv.Field(oop.Field)
-			if !field.IsNil() {
-				return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name)
-			}
-			field.Set(nv)
-		}
-		if !dst.IsValid() {
-			return p.errorf("unknown field name %q in %v", name, st)
-		}
-
-		if dst.Kind() == reflect.Map {
-			// Consume any colon.
-			if err := p.checkForColon(props, dst.Type()); err != nil {
-				return err
-			}
-
-			// Construct the map if it doesn't already exist.
-			if dst.IsNil() {
-				dst.Set(reflect.MakeMap(dst.Type()))
-			}
-			key := reflect.New(dst.Type().Key()).Elem()
-			val := reflect.New(dst.Type().Elem()).Elem()
-
-			// The map entry should be this sequence of tokens:
-			//	< key : KEY value : VALUE >
-			// However, implementations may omit key or value, and technically
-			// we should support them in any order.  See b/28924776 for a time
-			// this went wrong.
-
-			tok := p.next()
-			var terminator string
-			switch tok.value {
-			case "<":
-				terminator = ">"
-			case "{":
-				terminator = "}"
-			default:
-				return p.errorf("expected '{' or '<', found %q", tok.value)
-			}
-			for {
-				tok := p.next()
-				if tok.err != nil {
-					return tok.err
-				}
-				if tok.value == terminator {
-					break
-				}
-				switch tok.value {
-				case "key":
-					if err := p.consumeToken(":"); err != nil {
-						return err
-					}
-					if err := p.readAny(key, props.MapKeyProp); err != nil {
-						return err
-					}
-					if err := p.consumeOptionalSeparator(); err != nil {
-						return err
-					}
-				case "value":
-					if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil {
-						return err
-					}
-					if err := p.readAny(val, props.MapValProp); err != nil {
-						return err
-					}
-					if err := p.consumeOptionalSeparator(); err != nil {
-						return err
-					}
-				default:
-					p.back()
-					return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value)
-				}
-			}
-
-			dst.SetMapIndex(key, val)
-			continue
-		}
-
-		// Check that it's not already set if it's not a repeated field.
-		if !props.Repeated && fieldSet[name] {
-			return p.errorf("non-repeated field %q was repeated", name)
-		}
-
-		if err := p.checkForColon(props, dst.Type()); err != nil {
-			return err
-		}
-
-		// Parse into the field.
-		fieldSet[name] = true
-		if err := p.readAny(dst, props); err != nil {
-			if _, ok := err.(*RequiredNotSetError); !ok {
-				return err
-			}
-			reqFieldErr = err
-		}
-		if props.Required {
-			reqCount--
-		}
-
-		if err := p.consumeOptionalSeparator(); err != nil {
-			return err
-		}
-
-	}
-
-	if reqCount > 0 {
-		return p.missingRequiredFieldError(sv)
-	}
-	return reqFieldErr
-}
-
-// consumeExtName consumes extension name or expanded Any type URL and the
-// following ']'. It returns the name or URL consumed.
-func (p *textParser) consumeExtName() (string, error) {
-	tok := p.next()
-	if tok.err != nil {
-		return "", tok.err
-	}
-
-	// If extension name or type url is quoted, it's a single token.
-	if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {
-		name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))
-		if err != nil {
-			return "", err
-		}
-		return name, p.consumeToken("]")
-	}
-
-	// Consume everything up to "]"
-	var parts []string
-	for tok.value != "]" {
-		parts = append(parts, tok.value)
-		tok = p.next()
-		if tok.err != nil {
-			return "", p.errorf("unrecognized type_url or extension name: %s", tok.err)
-		}
-		if p.done && tok.value != "]" {
-			return "", p.errorf("unclosed type_url or extension name")
-		}
-	}
-	return strings.Join(parts, ""), nil
-}
-
-// consumeOptionalSeparator consumes an optional semicolon or comma.
-// It is used in readStruct to provide backward compatibility.
-func (p *textParser) consumeOptionalSeparator() error {
-	tok := p.next()
-	if tok.err != nil {
-		return tok.err
-	}
-	if tok.value != ";" && tok.value != "," {
-		p.back()
-	}
-	return nil
-}
-
-func (p *textParser) readAny(v reflect.Value, props *Properties) error {
-	tok := p.next()
-	if tok.err != nil {
-		return tok.err
-	}
-	if tok.value == "" {
-		return p.errorf("unexpected EOF")
-	}
-
-	switch fv := v; fv.Kind() {
-	case reflect.Slice:
-		at := v.Type()
-		if at.Elem().Kind() == reflect.Uint8 {
-			// Special case for []byte
-			if tok.value[0] != '"' && tok.value[0] != '\'' {
-				// Deliberately written out here, as the error after
-				// this switch statement would write "invalid []byte: ...",
-				// which is not as user-friendly.
-				return p.errorf("invalid string: %v", tok.value)
-			}
-			bytes := []byte(tok.unquoted)
-			fv.Set(reflect.ValueOf(bytes))
-			return nil
-		}
-		// Repeated field.
-		if tok.value == "[" {
-			// Repeated field with list notation, like [1,2,3].
-			for {
-				fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
-				err := p.readAny(fv.Index(fv.Len()-1), props)
-				if err != nil {
-					return err
-				}
-				tok := p.next()
-				if tok.err != nil {
-					return tok.err
-				}
-				if tok.value == "]" {
-					break
-				}
-				if tok.value != "," {
-					return p.errorf("Expected ']' or ',' found %q", tok.value)
-				}
-			}
-			return nil
-		}
-		// One value of the repeated field.
-		p.back()
-		fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
-		return p.readAny(fv.Index(fv.Len()-1), props)
-	case reflect.Bool:
-		// true/1/t/True or false/f/0/False.
-		switch tok.value {
-		case "true", "1", "t", "True":
-			fv.SetBool(true)
-			return nil
-		case "false", "0", "f", "False":
-			fv.SetBool(false)
-			return nil
-		}
-	case reflect.Float32, reflect.Float64:
-		v := tok.value
-		// Ignore 'f' for compatibility with output generated by C++, but don't
-		// remove 'f' when the value is "-inf" or "inf".
-		if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" {
-			v = v[:len(v)-1]
-		}
-		if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {
-			fv.SetFloat(f)
-			return nil
-		}
-	case reflect.Int32:
-		if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {
-			fv.SetInt(x)
-			return nil
-		}
-
-		if len(props.Enum) == 0 {
-			break
-		}
-		m, ok := enumValueMaps[props.Enum]
-		if !ok {
-			break
-		}
-		x, ok := m[tok.value]
-		if !ok {
-			break
-		}
-		fv.SetInt(int64(x))
-		return nil
-	case reflect.Int64:
-		if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {
-			fv.SetInt(x)
-			return nil
-		}
-
-	case reflect.Ptr:
-		// A basic field (indirected through pointer), or a repeated message/group
-		p.back()
-		fv.Set(reflect.New(fv.Type().Elem()))
-		return p.readAny(fv.Elem(), props)
-	case reflect.String:
-		if tok.value[0] == '"' || tok.value[0] == '\'' {
-			fv.SetString(tok.unquoted)
-			return nil
-		}
-	case reflect.Struct:
-		var terminator string
-		switch tok.value {
-		case "{":
-			terminator = "}"
-		case "<":
-			terminator = ">"
-		default:
-			return p.errorf("expected '{' or '<', found %q", tok.value)
-		}
-		// TODO: Handle nested messages which implement encoding.TextUnmarshaler.
-		return p.readStruct(fv, terminator)
-	case reflect.Uint32:
-		if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {
-			fv.SetUint(uint64(x))
-			return nil
-		}
-	case reflect.Uint64:
-		if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {
-			fv.SetUint(x)
-			return nil
-		}
-	}
-	return p.errorf("invalid %v: %v", v.Type(), tok.value)
-}
-
-// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb
-// before starting to unmarshal, so any existing data in pb is always removed.
-// If a required field is not set and no other error occurs,
-// UnmarshalText returns *RequiredNotSetError.
-func UnmarshalText(s string, pb Message) error {
-	if um, ok := pb.(encoding.TextUnmarshaler); ok {
-		return um.UnmarshalText([]byte(s))
-	}
-	pb.Reset()
-	v := reflect.ValueOf(pb)
-	return newTextParser(s).readStruct(v.Elem(), "")
-}

+ 0 - 19
vendor/github.com/gorilla/context/.travis.yml

@@ -1,19 +0,0 @@
-language: go
-sudo: false
-
-matrix:
-  include:
-    - go: 1.3
-    - go: 1.4
-    - go: 1.5
-    - go: 1.6
-    - go: 1.7
-    - go: tip
-  allow_failures:
-    - go: tip
-
-script:
-  - go get -t -v ./...
-  - diff -u <(echo -n) <(gofmt -d .)
-  - go vet $(go list ./... | grep -v /vendor/)
-  - go test -v -race ./...

+ 0 - 27
vendor/github.com/gorilla/context/LICENSE

@@ -1,27 +0,0 @@
-Copyright (c) 2012 Rodrigo Moraes. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-	 * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-	 * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-	 * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 10
vendor/github.com/gorilla/context/README.md

@@ -1,10 +0,0 @@
-context
-=======
-[![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context)
-
-gorilla/context is a general purpose registry for global request variables.
-
-> Note: gorilla/context, having been born well before `context.Context` existed, does not play well
-> with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`.
-
-Read the full documentation here: http://www.gorillatoolkit.org/pkg/context

+ 0 - 143
vendor/github.com/gorilla/context/context.go

@@ -1,143 +0,0 @@
-// Copyright 2012 The Gorilla 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 context
-
-import (
-	"net/http"
-	"sync"
-	"time"
-)
-
-var (
-	mutex sync.RWMutex
-	data  = make(map[*http.Request]map[interface{}]interface{})
-	datat = make(map[*http.Request]int64)
-)
-
-// Set stores a value for a given key in a given request.
-func Set(r *http.Request, key, val interface{}) {
-	mutex.Lock()
-	if data[r] == nil {
-		data[r] = make(map[interface{}]interface{})
-		datat[r] = time.Now().Unix()
-	}
-	data[r][key] = val
-	mutex.Unlock()
-}
-
-// Get returns a value stored for a given key in a given request.
-func Get(r *http.Request, key interface{}) interface{} {
-	mutex.RLock()
-	if ctx := data[r]; ctx != nil {
-		value := ctx[key]
-		mutex.RUnlock()
-		return value
-	}
-	mutex.RUnlock()
-	return nil
-}
-
-// GetOk returns stored value and presence state like multi-value return of map access.
-func GetOk(r *http.Request, key interface{}) (interface{}, bool) {
-	mutex.RLock()
-	if _, ok := data[r]; ok {
-		value, ok := data[r][key]
-		mutex.RUnlock()
-		return value, ok
-	}
-	mutex.RUnlock()
-	return nil, false
-}
-
-// GetAll returns all stored values for the request as a map. Nil is returned for invalid requests.
-func GetAll(r *http.Request) map[interface{}]interface{} {
-	mutex.RLock()
-	if context, ok := data[r]; ok {
-		result := make(map[interface{}]interface{}, len(context))
-		for k, v := range context {
-			result[k] = v
-		}
-		mutex.RUnlock()
-		return result
-	}
-	mutex.RUnlock()
-	return nil
-}
-
-// GetAllOk returns all stored values for the request as a map and a boolean value that indicates if
-// the request was registered.
-func GetAllOk(r *http.Request) (map[interface{}]interface{}, bool) {
-	mutex.RLock()
-	context, ok := data[r]
-	result := make(map[interface{}]interface{}, len(context))
-	for k, v := range context {
-		result[k] = v
-	}
-	mutex.RUnlock()
-	return result, ok
-}
-
-// Delete removes a value stored for a given key in a given request.
-func Delete(r *http.Request, key interface{}) {
-	mutex.Lock()
-	if data[r] != nil {
-		delete(data[r], key)
-	}
-	mutex.Unlock()
-}
-
-// Clear removes all values stored for a given request.
-//
-// This is usually called by a handler wrapper to clean up request
-// variables at the end of a request lifetime. See ClearHandler().
-func Clear(r *http.Request) {
-	mutex.Lock()
-	clear(r)
-	mutex.Unlock()
-}
-
-// clear is Clear without the lock.
-func clear(r *http.Request) {
-	delete(data, r)
-	delete(datat, r)
-}
-
-// Purge removes request data stored for longer than maxAge, in seconds.
-// It returns the amount of requests removed.
-//
-// If maxAge <= 0, all request data is removed.
-//
-// This is only used for sanity check: in case context cleaning was not
-// properly set some request data can be kept forever, consuming an increasing
-// amount of memory. In case this is detected, Purge() must be called
-// periodically until the problem is fixed.
-func Purge(maxAge int) int {
-	mutex.Lock()
-	count := 0
-	if maxAge <= 0 {
-		count = len(data)
-		data = make(map[*http.Request]map[interface{}]interface{})
-		datat = make(map[*http.Request]int64)
-	} else {
-		min := time.Now().Unix() - int64(maxAge)
-		for r := range data {
-			if datat[r] < min {
-				clear(r)
-				count++
-			}
-		}
-	}
-	mutex.Unlock()
-	return count
-}
-
-// ClearHandler wraps an http.Handler and clears request values at the end
-// of a request lifetime.
-func ClearHandler(h http.Handler) http.Handler {
-	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-		defer Clear(r)
-		h.ServeHTTP(w, r)
-	})
-}

+ 0 - 88
vendor/github.com/gorilla/context/doc.go

@@ -1,88 +0,0 @@
-// Copyright 2012 The Gorilla 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 context stores values shared during a request lifetime.
-
-Note: gorilla/context, having been born well before `context.Context` existed,
-does not play well > with the shallow copying of the request that
-[`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext)
-(added to net/http Go 1.7 onwards) performs. You should either use *just*
-gorilla/context, or moving forward, the new `http.Request.Context()`.
-
-For example, a router can set variables extracted from the URL and later
-application handlers can access those values, or it can be used to store
-sessions values to be saved at the end of a request. There are several
-others common uses.
-
-The idea was posted by Brad Fitzpatrick to the go-nuts mailing list:
-
-	http://groups.google.com/group/golang-nuts/msg/e2d679d303aa5d53
-
-Here's the basic usage: first define the keys that you will need. The key
-type is interface{} so a key can be of any type that supports equality.
-Here we define a key using a custom int type to avoid name collisions:
-
-	package foo
-
-	import (
-		"github.com/gorilla/context"
-	)
-
-	type key int
-
-	const MyKey key = 0
-
-Then set a variable. Variables are bound to an http.Request object, so you
-need a request instance to set a value:
-
-	context.Set(r, MyKey, "bar")
-
-The application can later access the variable using the same key you provided:
-
-	func MyHandler(w http.ResponseWriter, r *http.Request) {
-		// val is "bar".
-		val := context.Get(r, foo.MyKey)
-
-		// returns ("bar", true)
-		val, ok := context.GetOk(r, foo.MyKey)
-		// ...
-	}
-
-And that's all about the basic usage. We discuss some other ideas below.
-
-Any type can be stored in the context. To enforce a given type, make the key
-private and wrap Get() and Set() to accept and return values of a specific
-type:
-
-	type key int
-
-	const mykey key = 0
-
-	// GetMyKey returns a value for this package from the request values.
-	func GetMyKey(r *http.Request) SomeType {
-		if rv := context.Get(r, mykey); rv != nil {
-			return rv.(SomeType)
-		}
-		return nil
-	}
-
-	// SetMyKey sets a value for this package in the request values.
-	func SetMyKey(r *http.Request, val SomeType) {
-		context.Set(r, mykey, val)
-	}
-
-Variables must be cleared at the end of a request, to remove all values
-that were stored. This can be done in an http.Handler, after a request was
-served. Just call Clear() passing the request:
-
-	context.Clear(r)
-
-...or use ClearHandler(), which conveniently wraps an http.Handler to clear
-variables at the end of a request lifetime.
-
-The Routers from the packages gorilla/mux and gorilla/pat call Clear()
-so if you are using either of them you don't need to clear the context manually.
-*/
-package context

+ 0 - 23
vendor/github.com/gorilla/mux/.travis.yml

@@ -1,23 +0,0 @@
-language: go
-sudo: false
-
-matrix:
-  include:
-    - go: 1.5.x
-    - go: 1.6.x
-    - go: 1.7.x
-    - go: 1.8.x
-    - go: 1.9.x
-    - go: 1.10.x
-    - go: tip
-  allow_failures:
-    - go: tip
-
-install:
-  - # Skip
-
-script:
-  - go get -t -v ./...
-  - diff -u <(echo -n) <(gofmt -d .)
-  - go tool vet .
-  - go test -v -race ./...

+ 0 - 11
vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md

@@ -1,11 +0,0 @@
-**What version of Go are you running?** (Paste the output of `go version`)
-
-
-**What version of gorilla/mux are you at?** (Paste the output of `git rev-parse HEAD` inside `$GOPATH/src/github.com/gorilla/mux`)
-
-
-**Describe your problem** (and what you have tried so far)
-
-
-**Paste a minimal, runnable, reproduction of your issue below** (use backticks to format it)
-

+ 0 - 27
vendor/github.com/gorilla/mux/LICENSE

@@ -1,27 +0,0 @@
-Copyright (c) 2012 Rodrigo Moraes. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-	 * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-	 * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-	 * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 649
vendor/github.com/gorilla/mux/README.md

@@ -1,649 +0,0 @@
-# gorilla/mux
-
-[![GoDoc](https://godoc.org/github.com/gorilla/mux?status.svg)](https://godoc.org/github.com/gorilla/mux)
-[![Build Status](https://travis-ci.org/gorilla/mux.svg?branch=master)](https://travis-ci.org/gorilla/mux)
-[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/mux/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/mux?badge)
-
-![Gorilla Logo](http://www.gorillatoolkit.org/static/images/gorilla-icon-64.png)
-
-http://www.gorillatoolkit.org/pkg/mux
-
-Package `gorilla/mux` implements a request router and dispatcher for matching incoming requests to
-their respective handler.
-
-The name mux stands for "HTTP request multiplexer". Like the standard `http.ServeMux`, `mux.Router` matches incoming requests against a list of registered routes and calls a handler for the route that matches the URL or other conditions. The main features are:
-
-* It implements the `http.Handler` interface so it is compatible with the standard `http.ServeMux`.
-* Requests can be matched based on URL host, path, path prefix, schemes, header and query values, HTTP methods or using custom matchers.
-* URL hosts, paths and query values can have variables with an optional regular expression.
-* Registered URLs can be built, or "reversed", which helps maintaining references to resources.
-* Routes can be used as subrouters: nested routes are only tested if the parent route matches. This is useful to define groups of routes that share common conditions like a host, a path prefix or other repeated attributes. As a bonus, this optimizes request matching.
-
----
-
-* [Install](#install)
-* [Examples](#examples)
-* [Matching Routes](#matching-routes)
-* [Static Files](#static-files)
-* [Registered URLs](#registered-urls)
-* [Walking Routes](#walking-routes)
-* [Graceful Shutdown](#graceful-shutdown)
-* [Middleware](#middleware)
-* [Testing Handlers](#testing-handlers)
-* [Full Example](#full-example)
-
----
-
-## Install
-
-With a [correctly configured](https://golang.org/doc/install#testing) Go toolchain:
-
-```sh
-go get -u github.com/gorilla/mux
-```
-
-## Examples
-
-Let's start registering a couple of URL paths and handlers:
-
-```go
-func main() {
-    r := mux.NewRouter()
-    r.HandleFunc("/", HomeHandler)
-    r.HandleFunc("/products", ProductsHandler)
-    r.HandleFunc("/articles", ArticlesHandler)
-    http.Handle("/", r)
-}
-```
-
-Here we register three routes mapping URL paths to handlers. This is equivalent to how `http.HandleFunc()` works: if an incoming request URL matches one of the paths, the corresponding handler is called passing (`http.ResponseWriter`, `*http.Request`) as parameters.
-
-Paths can have variables. They are defined using the format `{name}` or `{name:pattern}`. If a regular expression pattern is not defined, the matched variable will be anything until the next slash. For example:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/products/{key}", ProductHandler)
-r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler)
-r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-```
-
-The names are used to create a map of route variables which can be retrieved calling `mux.Vars()`:
-
-```go
-func ArticlesCategoryHandler(w http.ResponseWriter, r *http.Request) {
-    vars := mux.Vars(r)
-    w.WriteHeader(http.StatusOK)
-    fmt.Fprintf(w, "Category: %v\n", vars["category"])
-}
-```
-
-And this is all you need to know about the basic usage. More advanced options are explained below.
-
-### Matching Routes
-
-Routes can also be restricted to a domain or subdomain. Just define a host pattern to be matched. They can also have variables:
-
-```go
-r := mux.NewRouter()
-// Only matches if domain is "www.example.com".
-r.Host("www.example.com")
-// Matches a dynamic subdomain.
-r.Host("{subdomain:[a-z]+}.domain.com")
-```
-
-There are several other matchers that can be added. To match path prefixes:
-
-```go
-r.PathPrefix("/products/")
-```
-
-...or HTTP methods:
-
-```go
-r.Methods("GET", "POST")
-```
-
-...or URL schemes:
-
-```go
-r.Schemes("https")
-```
-
-...or header values:
-
-```go
-r.Headers("X-Requested-With", "XMLHttpRequest")
-```
-
-...or query values:
-
-```go
-r.Queries("key", "value")
-```
-
-...or to use a custom matcher function:
-
-```go
-r.MatcherFunc(func(r *http.Request, rm *RouteMatch) bool {
-    return r.ProtoMajor == 0
-})
-```
-
-...and finally, it is possible to combine several matchers in a single route:
-
-```go
-r.HandleFunc("/products", ProductsHandler).
-  Host("www.example.com").
-  Methods("GET").
-  Schemes("http")
-```
-
-Routes are tested in the order they were added to the router. If two routes match, the first one wins:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/specific", specificHandler)
-r.PathPrefix("/").Handler(catchAllHandler)
-```
-
-Setting the same matching conditions again and again can be boring, so we have a way to group several routes that share the same requirements. We call it "subrouting".
-
-For example, let's say we have several URLs that should only match when the host is `www.example.com`. Create a route for that host and get a "subrouter" from it:
-
-```go
-r := mux.NewRouter()
-s := r.Host("www.example.com").Subrouter()
-```
-
-Then register routes in the subrouter:
-
-```go
-s.HandleFunc("/products/", ProductsHandler)
-s.HandleFunc("/products/{key}", ProductHandler)
-s.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-```
-
-The three URL paths we registered above will only be tested if the domain is `www.example.com`, because the subrouter is tested first. This is not only convenient, but also optimizes request matching. You can create subrouters combining any attribute matchers accepted by a route.
-
-Subrouters can be used to create domain or path "namespaces": you define subrouters in a central place and then parts of the app can register its paths relatively to a given subrouter.
-
-There's one more thing about subroutes. When a subrouter has a path prefix, the inner routes use it as base for their paths:
-
-```go
-r := mux.NewRouter()
-s := r.PathPrefix("/products").Subrouter()
-// "/products/"
-s.HandleFunc("/", ProductsHandler)
-// "/products/{key}/"
-s.HandleFunc("/{key}/", ProductHandler)
-// "/products/{key}/details"
-s.HandleFunc("/{key}/details", ProductDetailsHandler)
-```
-
-
-### Static Files
-
-Note that the path provided to `PathPrefix()` represents a "wildcard": calling
-`PathPrefix("/static/").Handler(...)` means that the handler will be passed any
-request that matches "/static/\*". This makes it easy to serve static files with mux:
-
-```go
-func main() {
-    var dir string
-
-    flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir")
-    flag.Parse()
-    r := mux.NewRouter()
-
-    // This will serve files under http://localhost:8000/static/<filename>
-    r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))))
-
-    srv := &http.Server{
-        Handler:      r,
-        Addr:         "127.0.0.1:8000",
-        // Good practice: enforce timeouts for servers you create!
-        WriteTimeout: 15 * time.Second,
-        ReadTimeout:  15 * time.Second,
-    }
-
-    log.Fatal(srv.ListenAndServe())
-}
-```
-
-### Registered URLs
-
-Now let's see how to build registered URLs.
-
-Routes can be named. All routes that define a name can have their URLs built, or "reversed". We define a name calling `Name()` on a route. For example:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-  Name("article")
-```
-
-To build a URL, get the route and call the `URL()` method, passing a sequence of key/value pairs for the route variables. For the previous route, we would do:
-
-```go
-url, err := r.Get("article").URL("category", "technology", "id", "42")
-```
-
-...and the result will be a `url.URL` with the following path:
-
-```
-"/articles/technology/42"
-```
-
-This also works for host and query value variables:
-
-```go
-r := mux.NewRouter()
-r.Host("{subdomain}.domain.com").
-  Path("/articles/{category}/{id:[0-9]+}").
-  Queries("filter", "{filter}").
-  HandlerFunc(ArticleHandler).
-  Name("article")
-
-// url.String() will be "http://news.domain.com/articles/technology/42?filter=gorilla"
-url, err := r.Get("article").URL("subdomain", "news",
-                                 "category", "technology",
-                                 "id", "42",
-                                 "filter", "gorilla")
-```
-
-All variables defined in the route are required, and their values must conform to the corresponding patterns. These requirements guarantee that a generated URL will always match a registered route -- the only exception is for explicitly defined "build-only" routes which never match.
-
-Regex support also exists for matching Headers within a route. For example, we could do:
-
-```go
-r.HeadersRegexp("Content-Type", "application/(text|json)")
-```
-
-...and the route will match both requests with a Content-Type of `application/json` as well as `application/text`
-
-There's also a way to build only the URL host or path for a route: use the methods `URLHost()` or `URLPath()` instead. For the previous route, we would do:
-
-```go
-// "http://news.domain.com/"
-host, err := r.Get("article").URLHost("subdomain", "news")
-
-// "/articles/technology/42"
-path, err := r.Get("article").URLPath("category", "technology", "id", "42")
-```
-
-And if you use subrouters, host and path defined separately can be built as well:
-
-```go
-r := mux.NewRouter()
-s := r.Host("{subdomain}.domain.com").Subrouter()
-s.Path("/articles/{category}/{id:[0-9]+}").
-  HandlerFunc(ArticleHandler).
-  Name("article")
-
-// "http://news.domain.com/articles/technology/42"
-url, err := r.Get("article").URL("subdomain", "news",
-                                 "category", "technology",
-                                 "id", "42")
-```
-
-### Walking Routes
-
-The `Walk` function on `mux.Router` can be used to visit all of the routes that are registered on a router. For example,
-the following prints all of the registered routes:
-
-```go
-package main
-
-import (
-	"fmt"
-	"net/http"
-	"strings"
-
-	"github.com/gorilla/mux"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
-	return
-}
-
-func main() {
-	r := mux.NewRouter()
-	r.HandleFunc("/", handler)
-	r.HandleFunc("/products", handler).Methods("POST")
-	r.HandleFunc("/articles", handler).Methods("GET")
-	r.HandleFunc("/articles/{id}", handler).Methods("GET", "PUT")
-	r.HandleFunc("/authors", handler).Queries("surname", "{surname}")
-	err := r.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
-		pathTemplate, err := route.GetPathTemplate()
-		if err == nil {
-			fmt.Println("ROUTE:", pathTemplate)
-		}
-		pathRegexp, err := route.GetPathRegexp()
-		if err == nil {
-			fmt.Println("Path regexp:", pathRegexp)
-		}
-		queriesTemplates, err := route.GetQueriesTemplates()
-		if err == nil {
-			fmt.Println("Queries templates:", strings.Join(queriesTemplates, ","))
-		}
-		queriesRegexps, err := route.GetQueriesRegexp()
-		if err == nil {
-			fmt.Println("Queries regexps:", strings.Join(queriesRegexps, ","))
-		}
-		methods, err := route.GetMethods()
-		if err == nil {
-			fmt.Println("Methods:", strings.Join(methods, ","))
-		}
-		fmt.Println()
-		return nil
-	})
-
-	if err != nil {
-		fmt.Println(err)
-	}
-
-	http.Handle("/", r)
-}
-```
-
-### Graceful Shutdown
-
-Go 1.8 introduced the ability to [gracefully shutdown](https://golang.org/doc/go1.8#http_shutdown) a `*http.Server`. Here's how to do that alongside `mux`:
-
-```go
-package main
-
-import (
-    "context"
-    "flag"
-    "log"
-    "net/http"
-    "os"
-    "os/signal"
-    "time"
-
-    "github.com/gorilla/mux"
-)
-
-func main() {
-    var wait time.Duration
-    flag.DurationVar(&wait, "graceful-timeout", time.Second * 15, "the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m")
-    flag.Parse()
-
-    r := mux.NewRouter()
-    // Add your routes as needed
-
-    srv := &http.Server{
-        Addr:         "0.0.0.0:8080",
-        // Good practice to set timeouts to avoid Slowloris attacks.
-        WriteTimeout: time.Second * 15,
-        ReadTimeout:  time.Second * 15,
-        IdleTimeout:  time.Second * 60,
-        Handler: r, // Pass our instance of gorilla/mux in.
-    }
-
-    // Run our server in a goroutine so that it doesn't block.
-    go func() {
-        if err := srv.ListenAndServe(); err != nil {
-            log.Println(err)
-        }
-    }()
-
-    c := make(chan os.Signal, 1)
-    // We'll accept graceful shutdowns when quit via SIGINT (Ctrl+C)
-    // SIGKILL, SIGQUIT or SIGTERM (Ctrl+/) will not be caught.
-    signal.Notify(c, os.Interrupt)
-
-    // Block until we receive our signal.
-    <-c
-
-    // Create a deadline to wait for.
-    ctx, cancel := context.WithTimeout(context.Background(), wait)
-    defer cancel()
-    // Doesn't block if no connections, but will otherwise wait
-    // until the timeout deadline.
-    srv.Shutdown(ctx)
-    // Optionally, you could run srv.Shutdown in a goroutine and block on
-    // <-ctx.Done() if your application should wait for other services
-    // to finalize based on context cancellation.
-    log.Println("shutting down")
-    os.Exit(0)
-}
-```
-
-### Middleware
-
-Mux supports the addition of middlewares to a [Router](https://godoc.org/github.com/gorilla/mux#Router), which are executed in the order they are added if a match is found, including its subrouters.
-Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or `ResponseWriter` hijacking.
-
-Mux middlewares are defined using the de facto standard type:
-
-```go
-type MiddlewareFunc func(http.Handler) http.Handler
-```
-
-Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc. This takes advantage of closures being able access variables from the context where they are created, while retaining the signature enforced by the receivers.
-
-A very basic middleware which logs the URI of the request being handled could be written as:
-
-```go
-func loggingMiddleware(next http.Handler) http.Handler {
-    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-        // Do stuff here
-        log.Println(r.RequestURI)
-        // Call the next handler, which can be another middleware in the chain, or the final handler.
-        next.ServeHTTP(w, r)
-    })
-}
-```
-
-Middlewares can be added to a router using `Router.Use()`:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/", handler)
-r.Use(loggingMiddleware)
-```
-
-A more complex authentication middleware, which maps session token to users, could be written as:
-
-```go
-// Define our struct
-type authenticationMiddleware struct {
-	tokenUsers map[string]string
-}
-
-// Initialize it somewhere
-func (amw *authenticationMiddleware) Populate() {
-	amw.tokenUsers["00000000"] = "user0"
-	amw.tokenUsers["aaaaaaaa"] = "userA"
-	amw.tokenUsers["05f717e5"] = "randomUser"
-	amw.tokenUsers["deadbeef"] = "user0"
-}
-
-// Middleware function, which will be called for each request
-func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler {
-    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-        token := r.Header.Get("X-Session-Token")
-
-        if user, found := amw.tokenUsers[token]; found {
-        	// We found the token in our map
-        	log.Printf("Authenticated user %s\n", user)
-        	// Pass down the request to the next middleware (or final handler)
-        	next.ServeHTTP(w, r)
-        } else {
-        	// Write an error and stop the handler chain
-        	http.Error(w, "Forbidden", http.StatusForbidden)
-        }
-    })
-}
-```
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/", handler)
-
-amw := authenticationMiddleware{}
-amw.Populate()
-
-r.Use(amw.Middleware)
-```
-
-Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. Middlewares _should_ write to `ResponseWriter` if they _are_ going to terminate the request, and they _should not_ write to `ResponseWriter` if they _are not_ going to terminate it.
-
-### Testing Handlers
-
-Testing handlers in a Go web application is straightforward, and _mux_ doesn't complicate this any further. Given two files: `endpoints.go` and `endpoints_test.go`, here's how we'd test an application using _mux_.
-
-First, our simple HTTP handler:
-
-```go
-// endpoints.go
-package main
-
-func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
-    // A very simple health check.
-    w.WriteHeader(http.StatusOK)
-    w.Header().Set("Content-Type", "application/json")
-
-    // In the future we could report back on the status of our DB, or our cache
-    // (e.g. Redis) by performing a simple PING, and include them in the response.
-    io.WriteString(w, `{"alive": true}`)
-}
-
-func main() {
-    r := mux.NewRouter()
-    r.HandleFunc("/health", HealthCheckHandler)
-
-    log.Fatal(http.ListenAndServe("localhost:8080", r))
-}
-```
-
-Our test code:
-
-```go
-// endpoints_test.go
-package main
-
-import (
-    "net/http"
-    "net/http/httptest"
-    "testing"
-)
-
-func TestHealthCheckHandler(t *testing.T) {
-    // Create a request to pass to our handler. We don't have any query parameters for now, so we'll
-    // pass 'nil' as the third parameter.
-    req, err := http.NewRequest("GET", "/health", nil)
-    if err != nil {
-        t.Fatal(err)
-    }
-
-    // We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response.
-    rr := httptest.NewRecorder()
-    handler := http.HandlerFunc(HealthCheckHandler)
-
-    // Our handlers satisfy http.Handler, so we can call their ServeHTTP method
-    // directly and pass in our Request and ResponseRecorder.
-    handler.ServeHTTP(rr, req)
-
-    // Check the status code is what we expect.
-    if status := rr.Code; status != http.StatusOK {
-        t.Errorf("handler returned wrong status code: got %v want %v",
-            status, http.StatusOK)
-    }
-
-    // Check the response body is what we expect.
-    expected := `{"alive": true}`
-    if rr.Body.String() != expected {
-        t.Errorf("handler returned unexpected body: got %v want %v",
-            rr.Body.String(), expected)
-    }
-}
-```
-
-In the case that our routes have [variables](#examples), we can pass those in the request. We could write
-[table-driven tests](https://dave.cheney.net/2013/06/09/writing-table-driven-tests-in-go) to test multiple
-possible route variables as needed.
-
-```go
-// endpoints.go
-func main() {
-    r := mux.NewRouter()
-    // A route with a route variable:
-    r.HandleFunc("/metrics/{type}", MetricsHandler)
-
-    log.Fatal(http.ListenAndServe("localhost:8080", r))
-}
-```
-
-Our test file, with a table-driven test of `routeVariables`:
-
-```go
-// endpoints_test.go
-func TestMetricsHandler(t *testing.T) {
-    tt := []struct{
-        routeVariable string
-        shouldPass bool
-    }{
-        {"goroutines", true},
-        {"heap", true},
-        {"counters", true},
-        {"queries", true},
-        {"adhadaeqm3k", false},
-    }
-
-    for _, tc := range tt {
-        path := fmt.Sprintf("/metrics/%s", tc.routeVariable)
-        req, err := http.NewRequest("GET", path, nil)
-        if err != nil {
-            t.Fatal(err)
-        }
-
-        rr := httptest.NewRecorder()
-	
-	// Need to create a router that we can pass the request through so that the vars will be added to the context
-	router := mux.NewRouter()
-        router.HandleFunc("/metrics/{type}", MetricsHandler)
-        router.ServeHTTP(rr, req)
-
-        // In this case, our MetricsHandler returns a non-200 response
-        // for a route variable it doesn't know about.
-        if rr.Code == http.StatusOK && !tc.shouldPass {
-            t.Errorf("handler should have failed on routeVariable %s: got %v want %v",
-                tc.routeVariable, rr.Code, http.StatusOK)
-        }
-    }
-}
-```
-
-## Full Example
-
-Here's a complete, runnable example of a small `mux` based server:
-
-```go
-package main
-
-import (
-    "net/http"
-    "log"
-    "github.com/gorilla/mux"
-)
-
-func YourHandler(w http.ResponseWriter, r *http.Request) {
-    w.Write([]byte("Gorilla!\n"))
-}
-
-func main() {
-    r := mux.NewRouter()
-    // Routes consist of a path and a handler function.
-    r.HandleFunc("/", YourHandler)
-
-    // Bind to a port and pass our router in
-    log.Fatal(http.ListenAndServe(":8000", r))
-}
-```
-
-## License
-
-BSD licensed. See the LICENSE file for details.

+ 0 - 26
vendor/github.com/gorilla/mux/context_gorilla.go

@@ -1,26 +0,0 @@
-// +build !go1.7
-
-package mux
-
-import (
-	"net/http"
-
-	"github.com/gorilla/context"
-)
-
-func contextGet(r *http.Request, key interface{}) interface{} {
-	return context.Get(r, key)
-}
-
-func contextSet(r *http.Request, key, val interface{}) *http.Request {
-	if val == nil {
-		return r
-	}
-
-	context.Set(r, key, val)
-	return r
-}
-
-func contextClear(r *http.Request) {
-	context.Clear(r)
-}

+ 0 - 24
vendor/github.com/gorilla/mux/context_native.go

@@ -1,24 +0,0 @@
-// +build go1.7
-
-package mux
-
-import (
-	"context"
-	"net/http"
-)
-
-func contextGet(r *http.Request, key interface{}) interface{} {
-	return r.Context().Value(key)
-}
-
-func contextSet(r *http.Request, key, val interface{}) *http.Request {
-	if val == nil {
-		return r
-	}
-
-	return r.WithContext(context.WithValue(r.Context(), key, val))
-}
-
-func contextClear(r *http.Request) {
-	return
-}

+ 0 - 306
vendor/github.com/gorilla/mux/doc.go

@@ -1,306 +0,0 @@
-// Copyright 2012 The Gorilla 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 mux implements a request router and dispatcher.
-
-The name mux stands for "HTTP request multiplexer". Like the standard
-http.ServeMux, mux.Router matches incoming requests against a list of
-registered routes and calls a handler for the route that matches the URL
-or other conditions. The main features are:
-
-	* Requests can be matched based on URL host, path, path prefix, schemes,
-	  header and query values, HTTP methods or using custom matchers.
-	* URL hosts, paths and query values can have variables with an optional
-	  regular expression.
-	* Registered URLs can be built, or "reversed", which helps maintaining
-	  references to resources.
-	* Routes can be used as subrouters: nested routes are only tested if the
-	  parent route matches. This is useful to define groups of routes that
-	  share common conditions like a host, a path prefix or other repeated
-	  attributes. As a bonus, this optimizes request matching.
-	* It implements the http.Handler interface so it is compatible with the
-	  standard http.ServeMux.
-
-Let's start registering a couple of URL paths and handlers:
-
-	func main() {
-		r := mux.NewRouter()
-		r.HandleFunc("/", HomeHandler)
-		r.HandleFunc("/products", ProductsHandler)
-		r.HandleFunc("/articles", ArticlesHandler)
-		http.Handle("/", r)
-	}
-
-Here we register three routes mapping URL paths to handlers. This is
-equivalent to how http.HandleFunc() works: if an incoming request URL matches
-one of the paths, the corresponding handler is called passing
-(http.ResponseWriter, *http.Request) as parameters.
-
-Paths can have variables. They are defined using the format {name} or
-{name:pattern}. If a regular expression pattern is not defined, the matched
-variable will be anything until the next slash. For example:
-
-	r := mux.NewRouter()
-	r.HandleFunc("/products/{key}", ProductHandler)
-	r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler)
-	r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-
-Groups can be used inside patterns, as long as they are non-capturing (?:re). For example:
-
-	r.HandleFunc("/articles/{category}/{sort:(?:asc|desc|new)}", ArticlesCategoryHandler)
-
-The names are used to create a map of route variables which can be retrieved
-calling mux.Vars():
-
-	vars := mux.Vars(request)
-	category := vars["category"]
-
-Note that if any capturing groups are present, mux will panic() during parsing. To prevent
-this, convert any capturing groups to non-capturing, e.g. change "/{sort:(asc|desc)}" to
-"/{sort:(?:asc|desc)}". This is a change from prior versions which behaved unpredictably
-when capturing groups were present.
-
-And this is all you need to know about the basic usage. More advanced options
-are explained below.
-
-Routes can also be restricted to a domain or subdomain. Just define a host
-pattern to be matched. They can also have variables:
-
-	r := mux.NewRouter()
-	// Only matches if domain is "www.example.com".
-	r.Host("www.example.com")
-	// Matches a dynamic subdomain.
-	r.Host("{subdomain:[a-z]+}.domain.com")
-
-There are several other matchers that can be added. To match path prefixes:
-
-	r.PathPrefix("/products/")
-
-...or HTTP methods:
-
-	r.Methods("GET", "POST")
-
-...or URL schemes:
-
-	r.Schemes("https")
-
-...or header values:
-
-	r.Headers("X-Requested-With", "XMLHttpRequest")
-
-...or query values:
-
-	r.Queries("key", "value")
-
-...or to use a custom matcher function:
-
-	r.MatcherFunc(func(r *http.Request, rm *RouteMatch) bool {
-		return r.ProtoMajor == 0
-	})
-
-...and finally, it is possible to combine several matchers in a single route:
-
-	r.HandleFunc("/products", ProductsHandler).
-	  Host("www.example.com").
-	  Methods("GET").
-	  Schemes("http")
-
-Setting the same matching conditions again and again can be boring, so we have
-a way to group several routes that share the same requirements.
-We call it "subrouting".
-
-For example, let's say we have several URLs that should only match when the
-host is "www.example.com". Create a route for that host and get a "subrouter"
-from it:
-
-	r := mux.NewRouter()
-	s := r.Host("www.example.com").Subrouter()
-
-Then register routes in the subrouter:
-
-	s.HandleFunc("/products/", ProductsHandler)
-	s.HandleFunc("/products/{key}", ProductHandler)
-	s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)
-
-The three URL paths we registered above will only be tested if the domain is
-"www.example.com", because the subrouter is tested first. This is not
-only convenient, but also optimizes request matching. You can create
-subrouters combining any attribute matchers accepted by a route.
-
-Subrouters can be used to create domain or path "namespaces": you define
-subrouters in a central place and then parts of the app can register its
-paths relatively to a given subrouter.
-
-There's one more thing about subroutes. When a subrouter has a path prefix,
-the inner routes use it as base for their paths:
-
-	r := mux.NewRouter()
-	s := r.PathPrefix("/products").Subrouter()
-	// "/products/"
-	s.HandleFunc("/", ProductsHandler)
-	// "/products/{key}/"
-	s.HandleFunc("/{key}/", ProductHandler)
-	// "/products/{key}/details"
-	s.HandleFunc("/{key}/details", ProductDetailsHandler)
-
-Note that the path provided to PathPrefix() represents a "wildcard": calling
-PathPrefix("/static/").Handler(...) means that the handler will be passed any
-request that matches "/static/*". This makes it easy to serve static files with mux:
-
-	func main() {
-		var dir string
-
-		flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir")
-		flag.Parse()
-		r := mux.NewRouter()
-
-		// This will serve files under http://localhost:8000/static/<filename>
-		r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))))
-
-		srv := &http.Server{
-			Handler:      r,
-			Addr:         "127.0.0.1:8000",
-			// Good practice: enforce timeouts for servers you create!
-			WriteTimeout: 15 * time.Second,
-			ReadTimeout:  15 * time.Second,
-		}
-
-		log.Fatal(srv.ListenAndServe())
-	}
-
-Now let's see how to build registered URLs.
-
-Routes can be named. All routes that define a name can have their URLs built,
-or "reversed". We define a name calling Name() on a route. For example:
-
-	r := mux.NewRouter()
-	r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-	  Name("article")
-
-To build a URL, get the route and call the URL() method, passing a sequence of
-key/value pairs for the route variables. For the previous route, we would do:
-
-	url, err := r.Get("article").URL("category", "technology", "id", "42")
-
-...and the result will be a url.URL with the following path:
-
-	"/articles/technology/42"
-
-This also works for host and query value variables:
-
-	r := mux.NewRouter()
-	r.Host("{subdomain}.domain.com").
-	  Path("/articles/{category}/{id:[0-9]+}").
-	  Queries("filter", "{filter}").
-	  HandlerFunc(ArticleHandler).
-	  Name("article")
-
-	// url.String() will be "http://news.domain.com/articles/technology/42?filter=gorilla"
-	url, err := r.Get("article").URL("subdomain", "news",
-	                                 "category", "technology",
-	                                 "id", "42",
-	                                 "filter", "gorilla")
-
-All variables defined in the route are required, and their values must
-conform to the corresponding patterns. These requirements guarantee that a
-generated URL will always match a registered route -- the only exception is
-for explicitly defined "build-only" routes which never match.
-
-Regex support also exists for matching Headers within a route. For example, we could do:
-
-	r.HeadersRegexp("Content-Type", "application/(text|json)")
-
-...and the route will match both requests with a Content-Type of `application/json` as well as
-`application/text`
-
-There's also a way to build only the URL host or path for a route:
-use the methods URLHost() or URLPath() instead. For the previous route,
-we would do:
-
-	// "http://news.domain.com/"
-	host, err := r.Get("article").URLHost("subdomain", "news")
-
-	// "/articles/technology/42"
-	path, err := r.Get("article").URLPath("category", "technology", "id", "42")
-
-And if you use subrouters, host and path defined separately can be built
-as well:
-
-	r := mux.NewRouter()
-	s := r.Host("{subdomain}.domain.com").Subrouter()
-	s.Path("/articles/{category}/{id:[0-9]+}").
-	  HandlerFunc(ArticleHandler).
-	  Name("article")
-
-	// "http://news.domain.com/articles/technology/42"
-	url, err := r.Get("article").URL("subdomain", "news",
-	                                 "category", "technology",
-	                                 "id", "42")
-
-Mux supports the addition of middlewares to a Router, which are executed in the order they are added if a match is found, including its subrouters. Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or ResponseWriter hijacking.
-
-	type MiddlewareFunc func(http.Handler) http.Handler
-
-Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc (closures can access variables from the context where they are created).
-
-A very basic middleware which logs the URI of the request being handled could be written as:
-
-	func simpleMw(next http.Handler) http.Handler {
-		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-			// Do stuff here
-			log.Println(r.RequestURI)
-			// Call the next handler, which can be another middleware in the chain, or the final handler.
-			next.ServeHTTP(w, r)
-		})
-	}
-
-Middlewares can be added to a router using `Router.Use()`:
-
-	r := mux.NewRouter()
-	r.HandleFunc("/", handler)
-	r.Use(simpleMw)
-
-A more complex authentication middleware, which maps session token to users, could be written as:
-
-	// Define our struct
-	type authenticationMiddleware struct {
-		tokenUsers map[string]string
-	}
-
-	// Initialize it somewhere
-	func (amw *authenticationMiddleware) Populate() {
-		amw.tokenUsers["00000000"] = "user0"
-		amw.tokenUsers["aaaaaaaa"] = "userA"
-		amw.tokenUsers["05f717e5"] = "randomUser"
-		amw.tokenUsers["deadbeef"] = "user0"
-	}
-
-	// Middleware function, which will be called for each request
-	func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler {
-		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-			token := r.Header.Get("X-Session-Token")
-
-			if user, found := amw.tokenUsers[token]; found {
-				// We found the token in our map
-				log.Printf("Authenticated user %s\n", user)
-				next.ServeHTTP(w, r)
-			} else {
-				http.Error(w, "Forbidden", http.StatusForbidden)
-			}
-		})
-	}
-
-	r := mux.NewRouter()
-	r.HandleFunc("/", handler)
-
-	amw := authenticationMiddleware{}
-	amw.Populate()
-
-	r.Use(amw.Middleware)
-
-Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to.
-
-*/
-package mux

+ 0 - 72
vendor/github.com/gorilla/mux/middleware.go

@@ -1,72 +0,0 @@
-package mux
-
-import (
-	"net/http"
-	"strings"
-)
-
-// MiddlewareFunc is a function which receives an http.Handler and returns another http.Handler.
-// Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed
-// to it, and then calls the handler passed as parameter to the MiddlewareFunc.
-type MiddlewareFunc func(http.Handler) http.Handler
-
-// middleware interface is anything which implements a MiddlewareFunc named Middleware.
-type middleware interface {
-	Middleware(handler http.Handler) http.Handler
-}
-
-// Middleware allows MiddlewareFunc to implement the middleware interface.
-func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {
-	return mw(handler)
-}
-
-// Use appends a MiddlewareFunc to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
-func (r *Router) Use(mwf ...MiddlewareFunc) {
-	for _, fn := range mwf {
-		r.middlewares = append(r.middlewares, fn)
-	}
-}
-
-// useInterface appends a middleware to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
-func (r *Router) useInterface(mw middleware) {
-	r.middlewares = append(r.middlewares, mw)
-}
-
-// CORSMethodMiddleware sets the Access-Control-Allow-Methods response header
-// on a request, by matching routes based only on paths. It also handles
-// OPTIONS requests, by settings Access-Control-Allow-Methods, and then
-// returning without calling the next http handler.
-func CORSMethodMiddleware(r *Router) MiddlewareFunc {
-	return func(next http.Handler) http.Handler {
-		return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
-			var allMethods []string
-
-			err := r.Walk(func(route *Route, _ *Router, _ []*Route) error {
-				for _, m := range route.matchers {
-					if _, ok := m.(*routeRegexp); ok {
-						if m.Match(req, &RouteMatch{}) {
-							methods, err := route.GetMethods()
-							if err != nil {
-								return err
-							}
-
-							allMethods = append(allMethods, methods...)
-						}
-						break
-					}
-				}
-				return nil
-			})
-
-			if err == nil {
-				w.Header().Set("Access-Control-Allow-Methods", strings.Join(append(allMethods, "OPTIONS"), ","))
-
-				if req.Method == "OPTIONS" {
-					return
-				}
-			}
-
-			next.ServeHTTP(w, req)
-		})
-	}
-}

+ 0 - 588
vendor/github.com/gorilla/mux/mux.go

@@ -1,588 +0,0 @@
-// Copyright 2012 The Gorilla 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 mux
-
-import (
-	"errors"
-	"fmt"
-	"net/http"
-	"path"
-	"regexp"
-)
-
-var (
-	// ErrMethodMismatch is returned when the method in the request does not match
-	// the method defined against the route.
-	ErrMethodMismatch = errors.New("method is not allowed")
-	// ErrNotFound is returned when no route match is found.
-	ErrNotFound = errors.New("no matching route was found")
-)
-
-// NewRouter returns a new router instance.
-func NewRouter() *Router {
-	return &Router{namedRoutes: make(map[string]*Route), KeepContext: false}
-}
-
-// Router registers routes to be matched and dispatches a handler.
-//
-// It implements the http.Handler interface, so it can be registered to serve
-// requests:
-//
-//     var router = mux.NewRouter()
-//
-//     func main() {
-//         http.Handle("/", router)
-//     }
-//
-// Or, for Google App Engine, register it in a init() function:
-//
-//     func init() {
-//         http.Handle("/", router)
-//     }
-//
-// This will send all incoming requests to the router.
-type Router struct {
-	// Configurable Handler to be used when no route matches.
-	NotFoundHandler http.Handler
-
-	// Configurable Handler to be used when the request method does not match the route.
-	MethodNotAllowedHandler http.Handler
-
-	// Parent route, if this is a subrouter.
-	parent parentRoute
-	// Routes to be matched, in order.
-	routes []*Route
-	// Routes by name for URL building.
-	namedRoutes map[string]*Route
-	// See Router.StrictSlash(). This defines the flag for new routes.
-	strictSlash bool
-	// See Router.SkipClean(). This defines the flag for new routes.
-	skipClean bool
-	// If true, do not clear the request context after handling the request.
-	// This has no effect when go1.7+ is used, since the context is stored
-	// on the request itself.
-	KeepContext bool
-	// see Router.UseEncodedPath(). This defines a flag for all routes.
-	useEncodedPath bool
-	// Slice of middlewares to be called after a match is found
-	middlewares []middleware
-}
-
-// Match attempts to match the given request against the router's registered routes.
-//
-// If the request matches a route of this router or one of its subrouters the Route,
-// Handler, and Vars fields of the the match argument are filled and this function
-// returns true.
-//
-// If the request does not match any of this router's or its subrouters' routes
-// then this function returns false. If available, a reason for the match failure
-// will be filled in the match argument's MatchErr field. If the match failure type
-// (eg: not found) has a registered handler, the handler is assigned to the Handler
-// field of the match argument.
-func (r *Router) Match(req *http.Request, match *RouteMatch) bool {
-	for _, route := range r.routes {
-		if route.Match(req, match) {
-			// Build middleware chain if no error was found
-			if match.MatchErr == nil {
-				for i := len(r.middlewares) - 1; i >= 0; i-- {
-					match.Handler = r.middlewares[i].Middleware(match.Handler)
-				}
-			}
-			return true
-		}
-	}
-
-	if match.MatchErr == ErrMethodMismatch {
-		if r.MethodNotAllowedHandler != nil {
-			match.Handler = r.MethodNotAllowedHandler
-			return true
-		}
-
-		return false
-	}
-
-	// Closest match for a router (includes sub-routers)
-	if r.NotFoundHandler != nil {
-		match.Handler = r.NotFoundHandler
-		match.MatchErr = ErrNotFound
-		return true
-	}
-
-	match.MatchErr = ErrNotFound
-	return false
-}
-
-// ServeHTTP dispatches the handler registered in the matched route.
-//
-// When there is a match, the route variables can be retrieved calling
-// mux.Vars(request).
-func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
-	if !r.skipClean {
-		path := req.URL.Path
-		if r.useEncodedPath {
-			path = req.URL.EscapedPath()
-		}
-		// Clean path to canonical form and redirect.
-		if p := cleanPath(path); p != path {
-
-			// Added 3 lines (Philip Schlump) - It was dropping the query string and #whatever from query.
-			// This matches with fix in go 1.2 r.c. 4 for same problem.  Go Issue:
-			// http://code.google.com/p/go/issues/detail?id=5252
-			url := *req.URL
-			url.Path = p
-			p = url.String()
-
-			w.Header().Set("Location", p)
-			w.WriteHeader(http.StatusMovedPermanently)
-			return
-		}
-	}
-	var match RouteMatch
-	var handler http.Handler
-	if r.Match(req, &match) {
-		handler = match.Handler
-		req = setVars(req, match.Vars)
-		req = setCurrentRoute(req, match.Route)
-	}
-
-	if handler == nil && match.MatchErr == ErrMethodMismatch {
-		handler = methodNotAllowedHandler()
-	}
-
-	if handler == nil {
-		handler = http.NotFoundHandler()
-	}
-
-	if !r.KeepContext {
-		defer contextClear(req)
-	}
-
-	handler.ServeHTTP(w, req)
-}
-
-// Get returns a route registered with the given name.
-func (r *Router) Get(name string) *Route {
-	return r.getNamedRoutes()[name]
-}
-
-// GetRoute returns a route registered with the given name. This method
-// was renamed to Get() and remains here for backwards compatibility.
-func (r *Router) GetRoute(name string) *Route {
-	return r.getNamedRoutes()[name]
-}
-
-// StrictSlash defines the trailing slash behavior for new routes. The initial
-// value is false.
-//
-// When true, if the route path is "/path/", accessing "/path" will perform a redirect
-// to the former and vice versa. In other words, your application will always
-// see the path as specified in the route.
-//
-// When false, if the route path is "/path", accessing "/path/" will not match
-// this route and vice versa.
-//
-// The re-direct is a HTTP 301 (Moved Permanently). Note that when this is set for
-// routes with a non-idempotent method (e.g. POST, PUT), the subsequent re-directed
-// request will be made as a GET by most clients. Use middleware or client settings
-// to modify this behaviour as needed.
-//
-// Special case: when a route sets a path prefix using the PathPrefix() method,
-// strict slash is ignored for that route because the redirect behavior can't
-// be determined from a prefix alone. However, any subrouters created from that
-// route inherit the original StrictSlash setting.
-func (r *Router) StrictSlash(value bool) *Router {
-	r.strictSlash = value
-	return r
-}
-
-// SkipClean defines the path cleaning behaviour for new routes. The initial
-// value is false. Users should be careful about which routes are not cleaned
-//
-// When true, if the route path is "/path//to", it will remain with the double
-// slash. This is helpful if you have a route like: /fetch/http://xkcd.com/534/
-//
-// When false, the path will be cleaned, so /fetch/http://xkcd.com/534/ will
-// become /fetch/http/xkcd.com/534
-func (r *Router) SkipClean(value bool) *Router {
-	r.skipClean = value
-	return r
-}
-
-// UseEncodedPath tells the router to match the encoded original path
-// to the routes.
-// For eg. "/path/foo%2Fbar/to" will match the path "/path/{var}/to".
-//
-// If not called, the router will match the unencoded path to the routes.
-// For eg. "/path/foo%2Fbar/to" will match the path "/path/foo/bar/to"
-func (r *Router) UseEncodedPath() *Router {
-	r.useEncodedPath = true
-	return r
-}
-
-// ----------------------------------------------------------------------------
-// parentRoute
-// ----------------------------------------------------------------------------
-
-func (r *Router) getBuildScheme() string {
-	if r.parent != nil {
-		return r.parent.getBuildScheme()
-	}
-	return ""
-}
-
-// getNamedRoutes returns the map where named routes are registered.
-func (r *Router) getNamedRoutes() map[string]*Route {
-	if r.namedRoutes == nil {
-		if r.parent != nil {
-			r.namedRoutes = r.parent.getNamedRoutes()
-		} else {
-			r.namedRoutes = make(map[string]*Route)
-		}
-	}
-	return r.namedRoutes
-}
-
-// getRegexpGroup returns regexp definitions from the parent route, if any.
-func (r *Router) getRegexpGroup() *routeRegexpGroup {
-	if r.parent != nil {
-		return r.parent.getRegexpGroup()
-	}
-	return nil
-}
-
-func (r *Router) buildVars(m map[string]string) map[string]string {
-	if r.parent != nil {
-		m = r.parent.buildVars(m)
-	}
-	return m
-}
-
-// ----------------------------------------------------------------------------
-// Route factories
-// ----------------------------------------------------------------------------
-
-// NewRoute registers an empty route.
-func (r *Router) NewRoute() *Route {
-	route := &Route{parent: r, strictSlash: r.strictSlash, skipClean: r.skipClean, useEncodedPath: r.useEncodedPath}
-	r.routes = append(r.routes, route)
-	return route
-}
-
-// Handle registers a new route with a matcher for the URL path.
-// See Route.Path() and Route.Handler().
-func (r *Router) Handle(path string, handler http.Handler) *Route {
-	return r.NewRoute().Path(path).Handler(handler)
-}
-
-// HandleFunc registers a new route with a matcher for the URL path.
-// See Route.Path() and Route.HandlerFunc().
-func (r *Router) HandleFunc(path string, f func(http.ResponseWriter,
-	*http.Request)) *Route {
-	return r.NewRoute().Path(path).HandlerFunc(f)
-}
-
-// Headers registers a new route with a matcher for request header values.
-// See Route.Headers().
-func (r *Router) Headers(pairs ...string) *Route {
-	return r.NewRoute().Headers(pairs...)
-}
-
-// Host registers a new route with a matcher for the URL host.
-// See Route.Host().
-func (r *Router) Host(tpl string) *Route {
-	return r.NewRoute().Host(tpl)
-}
-
-// MatcherFunc registers a new route with a custom matcher function.
-// See Route.MatcherFunc().
-func (r *Router) MatcherFunc(f MatcherFunc) *Route {
-	return r.NewRoute().MatcherFunc(f)
-}
-
-// Methods registers a new route with a matcher for HTTP methods.
-// See Route.Methods().
-func (r *Router) Methods(methods ...string) *Route {
-	return r.NewRoute().Methods(methods...)
-}
-
-// Path registers a new route with a matcher for the URL path.
-// See Route.Path().
-func (r *Router) Path(tpl string) *Route {
-	return r.NewRoute().Path(tpl)
-}
-
-// PathPrefix registers a new route with a matcher for the URL path prefix.
-// See Route.PathPrefix().
-func (r *Router) PathPrefix(tpl string) *Route {
-	return r.NewRoute().PathPrefix(tpl)
-}
-
-// Queries registers a new route with a matcher for URL query values.
-// See Route.Queries().
-func (r *Router) Queries(pairs ...string) *Route {
-	return r.NewRoute().Queries(pairs...)
-}
-
-// Schemes registers a new route with a matcher for URL schemes.
-// See Route.Schemes().
-func (r *Router) Schemes(schemes ...string) *Route {
-	return r.NewRoute().Schemes(schemes...)
-}
-
-// BuildVarsFunc registers a new route with a custom function for modifying
-// route variables before building a URL.
-func (r *Router) BuildVarsFunc(f BuildVarsFunc) *Route {
-	return r.NewRoute().BuildVarsFunc(f)
-}
-
-// Walk walks the router and all its sub-routers, calling walkFn for each route
-// in the tree. The routes are walked in the order they were added. Sub-routers
-// are explored depth-first.
-func (r *Router) Walk(walkFn WalkFunc) error {
-	return r.walk(walkFn, []*Route{})
-}
-
-// SkipRouter is used as a return value from WalkFuncs to indicate that the
-// router that walk is about to descend down to should be skipped.
-var SkipRouter = errors.New("skip this router")
-
-// WalkFunc is the type of the function called for each route visited by Walk.
-// At every invocation, it is given the current route, and the current router,
-// and a list of ancestor routes that lead to the current route.
-type WalkFunc func(route *Route, router *Router, ancestors []*Route) error
-
-func (r *Router) walk(walkFn WalkFunc, ancestors []*Route) error {
-	for _, t := range r.routes {
-		err := walkFn(t, r, ancestors)
-		if err == SkipRouter {
-			continue
-		}
-		if err != nil {
-			return err
-		}
-		for _, sr := range t.matchers {
-			if h, ok := sr.(*Router); ok {
-				ancestors = append(ancestors, t)
-				err := h.walk(walkFn, ancestors)
-				if err != nil {
-					return err
-				}
-				ancestors = ancestors[:len(ancestors)-1]
-			}
-		}
-		if h, ok := t.handler.(*Router); ok {
-			ancestors = append(ancestors, t)
-			err := h.walk(walkFn, ancestors)
-			if err != nil {
-				return err
-			}
-			ancestors = ancestors[:len(ancestors)-1]
-		}
-	}
-	return nil
-}
-
-// ----------------------------------------------------------------------------
-// Context
-// ----------------------------------------------------------------------------
-
-// RouteMatch stores information about a matched route.
-type RouteMatch struct {
-	Route   *Route
-	Handler http.Handler
-	Vars    map[string]string
-
-	// MatchErr is set to appropriate matching error
-	// It is set to ErrMethodMismatch if there is a mismatch in
-	// the request method and route method
-	MatchErr error
-}
-
-type contextKey int
-
-const (
-	varsKey contextKey = iota
-	routeKey
-)
-
-// Vars returns the route variables for the current request, if any.
-func Vars(r *http.Request) map[string]string {
-	if rv := contextGet(r, varsKey); rv != nil {
-		return rv.(map[string]string)
-	}
-	return nil
-}
-
-// CurrentRoute returns the matched route for the current request, if any.
-// This only works when called inside the handler of the matched route
-// because the matched route is stored in the request context which is cleared
-// after the handler returns, unless the KeepContext option is set on the
-// Router.
-func CurrentRoute(r *http.Request) *Route {
-	if rv := contextGet(r, routeKey); rv != nil {
-		return rv.(*Route)
-	}
-	return nil
-}
-
-func setVars(r *http.Request, val interface{}) *http.Request {
-	return contextSet(r, varsKey, val)
-}
-
-func setCurrentRoute(r *http.Request, val interface{}) *http.Request {
-	return contextSet(r, routeKey, val)
-}
-
-// ----------------------------------------------------------------------------
-// Helpers
-// ----------------------------------------------------------------------------
-
-// cleanPath returns the canonical path for p, eliminating . and .. elements.
-// Borrowed from the net/http package.
-func cleanPath(p string) string {
-	if p == "" {
-		return "/"
-	}
-	if p[0] != '/' {
-		p = "/" + p
-	}
-	np := path.Clean(p)
-	// path.Clean removes trailing slash except for root;
-	// put the trailing slash back if necessary.
-	if p[len(p)-1] == '/' && np != "/" {
-		np += "/"
-	}
-
-	return np
-}
-
-// uniqueVars returns an error if two slices contain duplicated strings.
-func uniqueVars(s1, s2 []string) error {
-	for _, v1 := range s1 {
-		for _, v2 := range s2 {
-			if v1 == v2 {
-				return fmt.Errorf("mux: duplicated route variable %q", v2)
-			}
-		}
-	}
-	return nil
-}
-
-// checkPairs returns the count of strings passed in, and an error if
-// the count is not an even number.
-func checkPairs(pairs ...string) (int, error) {
-	length := len(pairs)
-	if length%2 != 0 {
-		return length, fmt.Errorf(
-			"mux: number of parameters must be multiple of 2, got %v", pairs)
-	}
-	return length, nil
-}
-
-// mapFromPairsToString converts variadic string parameters to a
-// string to string map.
-func mapFromPairsToString(pairs ...string) (map[string]string, error) {
-	length, err := checkPairs(pairs...)
-	if err != nil {
-		return nil, err
-	}
-	m := make(map[string]string, length/2)
-	for i := 0; i < length; i += 2 {
-		m[pairs[i]] = pairs[i+1]
-	}
-	return m, nil
-}
-
-// mapFromPairsToRegex converts variadic string parameters to a
-// string to regex map.
-func mapFromPairsToRegex(pairs ...string) (map[string]*regexp.Regexp, error) {
-	length, err := checkPairs(pairs...)
-	if err != nil {
-		return nil, err
-	}
-	m := make(map[string]*regexp.Regexp, length/2)
-	for i := 0; i < length; i += 2 {
-		regex, err := regexp.Compile(pairs[i+1])
-		if err != nil {
-			return nil, err
-		}
-		m[pairs[i]] = regex
-	}
-	return m, nil
-}
-
-// matchInArray returns true if the given string value is in the array.
-func matchInArray(arr []string, value string) bool {
-	for _, v := range arr {
-		if v == value {
-			return true
-		}
-	}
-	return false
-}
-
-// matchMapWithString returns true if the given key/value pairs exist in a given map.
-func matchMapWithString(toCheck map[string]string, toMatch map[string][]string, canonicalKey bool) bool {
-	for k, v := range toCheck {
-		// Check if key exists.
-		if canonicalKey {
-			k = http.CanonicalHeaderKey(k)
-		}
-		if values := toMatch[k]; values == nil {
-			return false
-		} else if v != "" {
-			// If value was defined as an empty string we only check that the
-			// key exists. Otherwise we also check for equality.
-			valueExists := false
-			for _, value := range values {
-				if v == value {
-					valueExists = true
-					break
-				}
-			}
-			if !valueExists {
-				return false
-			}
-		}
-	}
-	return true
-}
-
-// matchMapWithRegex returns true if the given key/value pairs exist in a given map compiled against
-// the given regex
-func matchMapWithRegex(toCheck map[string]*regexp.Regexp, toMatch map[string][]string, canonicalKey bool) bool {
-	for k, v := range toCheck {
-		// Check if key exists.
-		if canonicalKey {
-			k = http.CanonicalHeaderKey(k)
-		}
-		if values := toMatch[k]; values == nil {
-			return false
-		} else if v != nil {
-			// If value was defined as an empty string we only check that the
-			// key exists. Otherwise we also check for equality.
-			valueExists := false
-			for _, value := range values {
-				if v.MatchString(value) {
-					valueExists = true
-					break
-				}
-			}
-			if !valueExists {
-				return false
-			}
-		}
-	}
-	return true
-}
-
-// methodNotAllowed replies to the request with an HTTP status code 405.
-func methodNotAllowed(w http.ResponseWriter, r *http.Request) {
-	w.WriteHeader(http.StatusMethodNotAllowed)
-}
-
-// methodNotAllowedHandler returns a simple request handler
-// that replies to each request with a status code 405.
-func methodNotAllowedHandler() http.Handler { return http.HandlerFunc(methodNotAllowed) }

+ 0 - 332
vendor/github.com/gorilla/mux/regexp.go

@@ -1,332 +0,0 @@
-// Copyright 2012 The Gorilla 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 mux
-
-import (
-	"bytes"
-	"fmt"
-	"net/http"
-	"net/url"
-	"regexp"
-	"strconv"
-	"strings"
-)
-
-type routeRegexpOptions struct {
-	strictSlash    bool
-	useEncodedPath bool
-}
-
-type regexpType int
-
-const (
-	regexpTypePath   regexpType = 0
-	regexpTypeHost   regexpType = 1
-	regexpTypePrefix regexpType = 2
-	regexpTypeQuery  regexpType = 3
-)
-
-// newRouteRegexp parses a route template and returns a routeRegexp,
-// used to match a host, a path or a query string.
-//
-// It will extract named variables, assemble a regexp to be matched, create
-// a "reverse" template to build URLs and compile regexps to validate variable
-// values used in URL building.
-//
-// Previously we accepted only Python-like identifiers for variable
-// names ([a-zA-Z_][a-zA-Z0-9_]*), but currently the only restriction is that
-// name and pattern can't be empty, and names can't contain a colon.
-func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*routeRegexp, error) {
-	// Check if it is well-formed.
-	idxs, errBraces := braceIndices(tpl)
-	if errBraces != nil {
-		return nil, errBraces
-	}
-	// Backup the original.
-	template := tpl
-	// Now let's parse it.
-	defaultPattern := "[^/]+"
-	if typ == regexpTypeQuery {
-		defaultPattern = ".*"
-	} else if typ == regexpTypeHost {
-		defaultPattern = "[^.]+"
-	}
-	// Only match strict slash if not matching
-	if typ != regexpTypePath {
-		options.strictSlash = false
-	}
-	// Set a flag for strictSlash.
-	endSlash := false
-	if options.strictSlash && strings.HasSuffix(tpl, "/") {
-		tpl = tpl[:len(tpl)-1]
-		endSlash = true
-	}
-	varsN := make([]string, len(idxs)/2)
-	varsR := make([]*regexp.Regexp, len(idxs)/2)
-	pattern := bytes.NewBufferString("")
-	pattern.WriteByte('^')
-	reverse := bytes.NewBufferString("")
-	var end int
-	var err error
-	for i := 0; i < len(idxs); i += 2 {
-		// Set all values we are interested in.
-		raw := tpl[end:idxs[i]]
-		end = idxs[i+1]
-		parts := strings.SplitN(tpl[idxs[i]+1:end-1], ":", 2)
-		name := parts[0]
-		patt := defaultPattern
-		if len(parts) == 2 {
-			patt = parts[1]
-		}
-		// Name or pattern can't be empty.
-		if name == "" || patt == "" {
-			return nil, fmt.Errorf("mux: missing name or pattern in %q",
-				tpl[idxs[i]:end])
-		}
-		// Build the regexp pattern.
-		fmt.Fprintf(pattern, "%s(?P<%s>%s)", regexp.QuoteMeta(raw), varGroupName(i/2), patt)
-
-		// Build the reverse template.
-		fmt.Fprintf(reverse, "%s%%s", raw)
-
-		// Append variable name and compiled pattern.
-		varsN[i/2] = name
-		varsR[i/2], err = regexp.Compile(fmt.Sprintf("^%s$", patt))
-		if err != nil {
-			return nil, err
-		}
-	}
-	// Add the remaining.
-	raw := tpl[end:]
-	pattern.WriteString(regexp.QuoteMeta(raw))
-	if options.strictSlash {
-		pattern.WriteString("[/]?")
-	}
-	if typ == regexpTypeQuery {
-		// Add the default pattern if the query value is empty
-		if queryVal := strings.SplitN(template, "=", 2)[1]; queryVal == "" {
-			pattern.WriteString(defaultPattern)
-		}
-	}
-	if typ != regexpTypePrefix {
-		pattern.WriteByte('$')
-	}
-	reverse.WriteString(raw)
-	if endSlash {
-		reverse.WriteByte('/')
-	}
-	// Compile full regexp.
-	reg, errCompile := regexp.Compile(pattern.String())
-	if errCompile != nil {
-		return nil, errCompile
-	}
-
-	// Check for capturing groups which used to work in older versions
-	if reg.NumSubexp() != len(idxs)/2 {
-		panic(fmt.Sprintf("route %s contains capture groups in its regexp. ", template) +
-			"Only non-capturing groups are accepted: e.g. (?:pattern) instead of (pattern)")
-	}
-
-	// Done!
-	return &routeRegexp{
-		template:   template,
-		regexpType: typ,
-		options:    options,
-		regexp:     reg,
-		reverse:    reverse.String(),
-		varsN:      varsN,
-		varsR:      varsR,
-	}, nil
-}
-
-// routeRegexp stores a regexp to match a host or path and information to
-// collect and validate route variables.
-type routeRegexp struct {
-	// The unmodified template.
-	template string
-	// The type of match
-	regexpType regexpType
-	// Options for matching
-	options routeRegexpOptions
-	// Expanded regexp.
-	regexp *regexp.Regexp
-	// Reverse template.
-	reverse string
-	// Variable names.
-	varsN []string
-	// Variable regexps (validators).
-	varsR []*regexp.Regexp
-}
-
-// Match matches the regexp against the URL host or path.
-func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
-	if r.regexpType != regexpTypeHost {
-		if r.regexpType == regexpTypeQuery {
-			return r.matchQueryString(req)
-		}
-		path := req.URL.Path
-		if r.options.useEncodedPath {
-			path = req.URL.EscapedPath()
-		}
-		return r.regexp.MatchString(path)
-	}
-
-	return r.regexp.MatchString(getHost(req))
-}
-
-// url builds a URL part using the given values.
-func (r *routeRegexp) url(values map[string]string) (string, error) {
-	urlValues := make([]interface{}, len(r.varsN))
-	for k, v := range r.varsN {
-		value, ok := values[v]
-		if !ok {
-			return "", fmt.Errorf("mux: missing route variable %q", v)
-		}
-		if r.regexpType == regexpTypeQuery {
-			value = url.QueryEscape(value)
-		}
-		urlValues[k] = value
-	}
-	rv := fmt.Sprintf(r.reverse, urlValues...)
-	if !r.regexp.MatchString(rv) {
-		// The URL is checked against the full regexp, instead of checking
-		// individual variables. This is faster but to provide a good error
-		// message, we check individual regexps if the URL doesn't match.
-		for k, v := range r.varsN {
-			if !r.varsR[k].MatchString(values[v]) {
-				return "", fmt.Errorf(
-					"mux: variable %q doesn't match, expected %q", values[v],
-					r.varsR[k].String())
-			}
-		}
-	}
-	return rv, nil
-}
-
-// getURLQuery returns a single query parameter from a request URL.
-// For a URL with foo=bar&baz=ding, we return only the relevant key
-// value pair for the routeRegexp.
-func (r *routeRegexp) getURLQuery(req *http.Request) string {
-	if r.regexpType != regexpTypeQuery {
-		return ""
-	}
-	templateKey := strings.SplitN(r.template, "=", 2)[0]
-	for key, vals := range req.URL.Query() {
-		if key == templateKey && len(vals) > 0 {
-			return key + "=" + vals[0]
-		}
-	}
-	return ""
-}
-
-func (r *routeRegexp) matchQueryString(req *http.Request) bool {
-	return r.regexp.MatchString(r.getURLQuery(req))
-}
-
-// braceIndices returns the first level curly brace indices from a string.
-// It returns an error in case of unbalanced braces.
-func braceIndices(s string) ([]int, error) {
-	var level, idx int
-	var idxs []int
-	for i := 0; i < len(s); i++ {
-		switch s[i] {
-		case '{':
-			if level++; level == 1 {
-				idx = i
-			}
-		case '}':
-			if level--; level == 0 {
-				idxs = append(idxs, idx, i+1)
-			} else if level < 0 {
-				return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
-			}
-		}
-	}
-	if level != 0 {
-		return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
-	}
-	return idxs, nil
-}
-
-// varGroupName builds a capturing group name for the indexed variable.
-func varGroupName(idx int) string {
-	return "v" + strconv.Itoa(idx)
-}
-
-// ----------------------------------------------------------------------------
-// routeRegexpGroup
-// ----------------------------------------------------------------------------
-
-// routeRegexpGroup groups the route matchers that carry variables.
-type routeRegexpGroup struct {
-	host    *routeRegexp
-	path    *routeRegexp
-	queries []*routeRegexp
-}
-
-// setMatch extracts the variables from the URL once a route matches.
-func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) {
-	// Store host variables.
-	if v.host != nil {
-		host := getHost(req)
-		matches := v.host.regexp.FindStringSubmatchIndex(host)
-		if len(matches) > 0 {
-			extractVars(host, matches, v.host.varsN, m.Vars)
-		}
-	}
-	path := req.URL.Path
-	if r.useEncodedPath {
-		path = req.URL.EscapedPath()
-	}
-	// Store path variables.
-	if v.path != nil {
-		matches := v.path.regexp.FindStringSubmatchIndex(path)
-		if len(matches) > 0 {
-			extractVars(path, matches, v.path.varsN, m.Vars)
-			// Check if we should redirect.
-			if v.path.options.strictSlash {
-				p1 := strings.HasSuffix(path, "/")
-				p2 := strings.HasSuffix(v.path.template, "/")
-				if p1 != p2 {
-					u, _ := url.Parse(req.URL.String())
-					if p1 {
-						u.Path = u.Path[:len(u.Path)-1]
-					} else {
-						u.Path += "/"
-					}
-					m.Handler = http.RedirectHandler(u.String(), 301)
-				}
-			}
-		}
-	}
-	// Store query string variables.
-	for _, q := range v.queries {
-		queryURL := q.getURLQuery(req)
-		matches := q.regexp.FindStringSubmatchIndex(queryURL)
-		if len(matches) > 0 {
-			extractVars(queryURL, matches, q.varsN, m.Vars)
-		}
-	}
-}
-
-// getHost tries its best to return the request host.
-func getHost(r *http.Request) string {
-	if r.URL.IsAbs() {
-		return r.URL.Host
-	}
-	host := r.Host
-	// Slice off any port information.
-	if i := strings.Index(host, ":"); i != -1 {
-		host = host[:i]
-	}
-	return host
-
-}
-
-func extractVars(input string, matches []int, names []string, output map[string]string) {
-	for i, name := range names {
-		output[name] = input[matches[2*i+2]:matches[2*i+3]]
-	}
-}

+ 0 - 763
vendor/github.com/gorilla/mux/route.go

@@ -1,763 +0,0 @@
-// Copyright 2012 The Gorilla 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 mux
-
-import (
-	"errors"
-	"fmt"
-	"net/http"
-	"net/url"
-	"regexp"
-	"strings"
-)
-
-// Route stores information to match a request and build URLs.
-type Route struct {
-	// Parent where the route was registered (a Router).
-	parent parentRoute
-	// Request handler for the route.
-	handler http.Handler
-	// List of matchers.
-	matchers []matcher
-	// Manager for the variables from host and path.
-	regexp *routeRegexpGroup
-	// If true, when the path pattern is "/path/", accessing "/path" will
-	// redirect to the former and vice versa.
-	strictSlash bool
-	// If true, when the path pattern is "/path//to", accessing "/path//to"
-	// will not redirect
-	skipClean bool
-	// If true, "/path/foo%2Fbar/to" will match the path "/path/{var}/to"
-	useEncodedPath bool
-	// The scheme used when building URLs.
-	buildScheme string
-	// If true, this route never matches: it is only used to build URLs.
-	buildOnly bool
-	// The name used to build URLs.
-	name string
-	// Error resulted from building a route.
-	err error
-
-	buildVarsFunc BuildVarsFunc
-}
-
-// SkipClean reports whether path cleaning is enabled for this route via
-// Router.SkipClean.
-func (r *Route) SkipClean() bool {
-	return r.skipClean
-}
-
-// Match matches the route against the request.
-func (r *Route) Match(req *http.Request, match *RouteMatch) bool {
-	if r.buildOnly || r.err != nil {
-		return false
-	}
-
-	var matchErr error
-
-	// Match everything.
-	for _, m := range r.matchers {
-		if matched := m.Match(req, match); !matched {
-			if _, ok := m.(methodMatcher); ok {
-				matchErr = ErrMethodMismatch
-				continue
-			}
-			matchErr = nil
-			return false
-		}
-	}
-
-	if matchErr != nil {
-		match.MatchErr = matchErr
-		return false
-	}
-
-	if match.MatchErr == ErrMethodMismatch {
-		// We found a route which matches request method, clear MatchErr
-		match.MatchErr = nil
-		// Then override the mis-matched handler
-		match.Handler = r.handler
-	}
-
-	// Yay, we have a match. Let's collect some info about it.
-	if match.Route == nil {
-		match.Route = r
-	}
-	if match.Handler == nil {
-		match.Handler = r.handler
-	}
-	if match.Vars == nil {
-		match.Vars = make(map[string]string)
-	}
-
-	// Set variables.
-	if r.regexp != nil {
-		r.regexp.setMatch(req, match, r)
-	}
-	return true
-}
-
-// ----------------------------------------------------------------------------
-// Route attributes
-// ----------------------------------------------------------------------------
-
-// GetError returns an error resulted from building the route, if any.
-func (r *Route) GetError() error {
-	return r.err
-}
-
-// BuildOnly sets the route to never match: it is only used to build URLs.
-func (r *Route) BuildOnly() *Route {
-	r.buildOnly = true
-	return r
-}
-
-// Handler --------------------------------------------------------------------
-
-// Handler sets a handler for the route.
-func (r *Route) Handler(handler http.Handler) *Route {
-	if r.err == nil {
-		r.handler = handler
-	}
-	return r
-}
-
-// HandlerFunc sets a handler function for the route.
-func (r *Route) HandlerFunc(f func(http.ResponseWriter, *http.Request)) *Route {
-	return r.Handler(http.HandlerFunc(f))
-}
-
-// GetHandler returns the handler for the route, if any.
-func (r *Route) GetHandler() http.Handler {
-	return r.handler
-}
-
-// Name -----------------------------------------------------------------------
-
-// Name sets the name for the route, used to build URLs.
-// If the name was registered already it will be overwritten.
-func (r *Route) Name(name string) *Route {
-	if r.name != "" {
-		r.err = fmt.Errorf("mux: route already has name %q, can't set %q",
-			r.name, name)
-	}
-	if r.err == nil {
-		r.name = name
-		r.getNamedRoutes()[name] = r
-	}
-	return r
-}
-
-// GetName returns the name for the route, if any.
-func (r *Route) GetName() string {
-	return r.name
-}
-
-// ----------------------------------------------------------------------------
-// Matchers
-// ----------------------------------------------------------------------------
-
-// matcher types try to match a request.
-type matcher interface {
-	Match(*http.Request, *RouteMatch) bool
-}
-
-// addMatcher adds a matcher to the route.
-func (r *Route) addMatcher(m matcher) *Route {
-	if r.err == nil {
-		r.matchers = append(r.matchers, m)
-	}
-	return r
-}
-
-// addRegexpMatcher adds a host or path matcher and builder to a route.
-func (r *Route) addRegexpMatcher(tpl string, typ regexpType) error {
-	if r.err != nil {
-		return r.err
-	}
-	r.regexp = r.getRegexpGroup()
-	if typ == regexpTypePath || typ == regexpTypePrefix {
-		if len(tpl) > 0 && tpl[0] != '/' {
-			return fmt.Errorf("mux: path must start with a slash, got %q", tpl)
-		}
-		if r.regexp.path != nil {
-			tpl = strings.TrimRight(r.regexp.path.template, "/") + tpl
-		}
-	}
-	rr, err := newRouteRegexp(tpl, typ, routeRegexpOptions{
-		strictSlash:    r.strictSlash,
-		useEncodedPath: r.useEncodedPath,
-	})
-	if err != nil {
-		return err
-	}
-	for _, q := range r.regexp.queries {
-		if err = uniqueVars(rr.varsN, q.varsN); err != nil {
-			return err
-		}
-	}
-	if typ == regexpTypeHost {
-		if r.regexp.path != nil {
-			if err = uniqueVars(rr.varsN, r.regexp.path.varsN); err != nil {
-				return err
-			}
-		}
-		r.regexp.host = rr
-	} else {
-		if r.regexp.host != nil {
-			if err = uniqueVars(rr.varsN, r.regexp.host.varsN); err != nil {
-				return err
-			}
-		}
-		if typ == regexpTypeQuery {
-			r.regexp.queries = append(r.regexp.queries, rr)
-		} else {
-			r.regexp.path = rr
-		}
-	}
-	r.addMatcher(rr)
-	return nil
-}
-
-// Headers --------------------------------------------------------------------
-
-// headerMatcher matches the request against header values.
-type headerMatcher map[string]string
-
-func (m headerMatcher) Match(r *http.Request, match *RouteMatch) bool {
-	return matchMapWithString(m, r.Header, true)
-}
-
-// Headers adds a matcher for request header values.
-// It accepts a sequence of key/value pairs to be matched. For example:
-//
-//     r := mux.NewRouter()
-//     r.Headers("Content-Type", "application/json",
-//               "X-Requested-With", "XMLHttpRequest")
-//
-// The above route will only match if both request header values match.
-// If the value is an empty string, it will match any value if the key is set.
-func (r *Route) Headers(pairs ...string) *Route {
-	if r.err == nil {
-		var headers map[string]string
-		headers, r.err = mapFromPairsToString(pairs...)
-		return r.addMatcher(headerMatcher(headers))
-	}
-	return r
-}
-
-// headerRegexMatcher matches the request against the route given a regex for the header
-type headerRegexMatcher map[string]*regexp.Regexp
-
-func (m headerRegexMatcher) Match(r *http.Request, match *RouteMatch) bool {
-	return matchMapWithRegex(m, r.Header, true)
-}
-
-// HeadersRegexp accepts a sequence of key/value pairs, where the value has regex
-// support. For example:
-//
-//     r := mux.NewRouter()
-//     r.HeadersRegexp("Content-Type", "application/(text|json)",
-//               "X-Requested-With", "XMLHttpRequest")
-//
-// The above route will only match if both the request header matches both regular expressions.
-// If the value is an empty string, it will match any value if the key is set.
-// Use the start and end of string anchors (^ and $) to match an exact value.
-func (r *Route) HeadersRegexp(pairs ...string) *Route {
-	if r.err == nil {
-		var headers map[string]*regexp.Regexp
-		headers, r.err = mapFromPairsToRegex(pairs...)
-		return r.addMatcher(headerRegexMatcher(headers))
-	}
-	return r
-}
-
-// Host -----------------------------------------------------------------------
-
-// Host adds a matcher for the URL host.
-// It accepts a template with zero or more URL variables enclosed by {}.
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next dot.
-//
-// - {name:pattern} matches the given regexp pattern.
-//
-// For example:
-//
-//     r := mux.NewRouter()
-//     r.Host("www.example.com")
-//     r.Host("{subdomain}.domain.com")
-//     r.Host("{subdomain:[a-z]+}.domain.com")
-//
-// Variable names must be unique in a given route. They can be retrieved
-// calling mux.Vars(request).
-func (r *Route) Host(tpl string) *Route {
-	r.err = r.addRegexpMatcher(tpl, regexpTypeHost)
-	return r
-}
-
-// MatcherFunc ----------------------------------------------------------------
-
-// MatcherFunc is the function signature used by custom matchers.
-type MatcherFunc func(*http.Request, *RouteMatch) bool
-
-// Match returns the match for a given request.
-func (m MatcherFunc) Match(r *http.Request, match *RouteMatch) bool {
-	return m(r, match)
-}
-
-// MatcherFunc adds a custom function to be used as request matcher.
-func (r *Route) MatcherFunc(f MatcherFunc) *Route {
-	return r.addMatcher(f)
-}
-
-// Methods --------------------------------------------------------------------
-
-// methodMatcher matches the request against HTTP methods.
-type methodMatcher []string
-
-func (m methodMatcher) Match(r *http.Request, match *RouteMatch) bool {
-	return matchInArray(m, r.Method)
-}
-
-// Methods adds a matcher for HTTP methods.
-// It accepts a sequence of one or more methods to be matched, e.g.:
-// "GET", "POST", "PUT".
-func (r *Route) Methods(methods ...string) *Route {
-	for k, v := range methods {
-		methods[k] = strings.ToUpper(v)
-	}
-	return r.addMatcher(methodMatcher(methods))
-}
-
-// Path -----------------------------------------------------------------------
-
-// Path adds a matcher for the URL path.
-// It accepts a template with zero or more URL variables enclosed by {}. The
-// template must start with a "/".
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next slash.
-//
-// - {name:pattern} matches the given regexp pattern.
-//
-// For example:
-//
-//     r := mux.NewRouter()
-//     r.Path("/products/").Handler(ProductsHandler)
-//     r.Path("/products/{key}").Handler(ProductsHandler)
-//     r.Path("/articles/{category}/{id:[0-9]+}").
-//       Handler(ArticleHandler)
-//
-// Variable names must be unique in a given route. They can be retrieved
-// calling mux.Vars(request).
-func (r *Route) Path(tpl string) *Route {
-	r.err = r.addRegexpMatcher(tpl, regexpTypePath)
-	return r
-}
-
-// PathPrefix -----------------------------------------------------------------
-
-// PathPrefix adds a matcher for the URL path prefix. This matches if the given
-// template is a prefix of the full URL path. See Route.Path() for details on
-// the tpl argument.
-//
-// Note that it does not treat slashes specially ("/foobar/" will be matched by
-// the prefix "/foo") so you may want to use a trailing slash here.
-//
-// Also note that the setting of Router.StrictSlash() has no effect on routes
-// with a PathPrefix matcher.
-func (r *Route) PathPrefix(tpl string) *Route {
-	r.err = r.addRegexpMatcher(tpl, regexpTypePrefix)
-	return r
-}
-
-// Query ----------------------------------------------------------------------
-
-// Queries adds a matcher for URL query values.
-// It accepts a sequence of key/value pairs. Values may define variables.
-// For example:
-//
-//     r := mux.NewRouter()
-//     r.Queries("foo", "bar", "id", "{id:[0-9]+}")
-//
-// The above route will only match if the URL contains the defined queries
-// values, e.g.: ?foo=bar&id=42.
-//
-// It the value is an empty string, it will match any value if the key is set.
-//
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next slash.
-//
-// - {name:pattern} matches the given regexp pattern.
-func (r *Route) Queries(pairs ...string) *Route {
-	length := len(pairs)
-	if length%2 != 0 {
-		r.err = fmt.Errorf(
-			"mux: number of parameters must be multiple of 2, got %v", pairs)
-		return nil
-	}
-	for i := 0; i < length; i += 2 {
-		if r.err = r.addRegexpMatcher(pairs[i]+"="+pairs[i+1], regexpTypeQuery); r.err != nil {
-			return r
-		}
-	}
-
-	return r
-}
-
-// Schemes --------------------------------------------------------------------
-
-// schemeMatcher matches the request against URL schemes.
-type schemeMatcher []string
-
-func (m schemeMatcher) Match(r *http.Request, match *RouteMatch) bool {
-	return matchInArray(m, r.URL.Scheme)
-}
-
-// Schemes adds a matcher for URL schemes.
-// It accepts a sequence of schemes to be matched, e.g.: "http", "https".
-func (r *Route) Schemes(schemes ...string) *Route {
-	for k, v := range schemes {
-		schemes[k] = strings.ToLower(v)
-	}
-	if r.buildScheme == "" && len(schemes) > 0 {
-		r.buildScheme = schemes[0]
-	}
-	return r.addMatcher(schemeMatcher(schemes))
-}
-
-// BuildVarsFunc --------------------------------------------------------------
-
-// BuildVarsFunc is the function signature used by custom build variable
-// functions (which can modify route variables before a route's URL is built).
-type BuildVarsFunc func(map[string]string) map[string]string
-
-// BuildVarsFunc adds a custom function to be used to modify build variables
-// before a route's URL is built.
-func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route {
-	r.buildVarsFunc = f
-	return r
-}
-
-// Subrouter ------------------------------------------------------------------
-
-// Subrouter creates a subrouter for the route.
-//
-// It will test the inner routes only if the parent route matched. For example:
-//
-//     r := mux.NewRouter()
-//     s := r.Host("www.example.com").Subrouter()
-//     s.HandleFunc("/products/", ProductsHandler)
-//     s.HandleFunc("/products/{key}", ProductHandler)
-//     s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)
-//
-// Here, the routes registered in the subrouter won't be tested if the host
-// doesn't match.
-func (r *Route) Subrouter() *Router {
-	router := &Router{parent: r, strictSlash: r.strictSlash}
-	r.addMatcher(router)
-	return router
-}
-
-// ----------------------------------------------------------------------------
-// URL building
-// ----------------------------------------------------------------------------
-
-// URL builds a URL for the route.
-//
-// It accepts a sequence of key/value pairs for the route variables. For
-// example, given this route:
-//
-//     r := mux.NewRouter()
-//     r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-//       Name("article")
-//
-// ...a URL for it can be built using:
-//
-//     url, err := r.Get("article").URL("category", "technology", "id", "42")
-//
-// ...which will return an url.URL with the following path:
-//
-//     "/articles/technology/42"
-//
-// This also works for host variables:
-//
-//     r := mux.NewRouter()
-//     r.Host("{subdomain}.domain.com").
-//       HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-//       Name("article")
-//
-//     // url.String() will be "http://news.domain.com/articles/technology/42"
-//     url, err := r.Get("article").URL("subdomain", "news",
-//                                      "category", "technology",
-//                                      "id", "42")
-//
-// All variables defined in the route are required, and their values must
-// conform to the corresponding patterns.
-func (r *Route) URL(pairs ...string) (*url.URL, error) {
-	if r.err != nil {
-		return nil, r.err
-	}
-	if r.regexp == nil {
-		return nil, errors.New("mux: route doesn't have a host or path")
-	}
-	values, err := r.prepareVars(pairs...)
-	if err != nil {
-		return nil, err
-	}
-	var scheme, host, path string
-	queries := make([]string, 0, len(r.regexp.queries))
-	if r.regexp.host != nil {
-		if host, err = r.regexp.host.url(values); err != nil {
-			return nil, err
-		}
-		scheme = "http"
-		if s := r.getBuildScheme(); s != "" {
-			scheme = s
-		}
-	}
-	if r.regexp.path != nil {
-		if path, err = r.regexp.path.url(values); err != nil {
-			return nil, err
-		}
-	}
-	for _, q := range r.regexp.queries {
-		var query string
-		if query, err = q.url(values); err != nil {
-			return nil, err
-		}
-		queries = append(queries, query)
-	}
-	return &url.URL{
-		Scheme:   scheme,
-		Host:     host,
-		Path:     path,
-		RawQuery: strings.Join(queries, "&"),
-	}, nil
-}
-
-// URLHost builds the host part of the URL for a route. See Route.URL().
-//
-// The route must have a host defined.
-func (r *Route) URLHost(pairs ...string) (*url.URL, error) {
-	if r.err != nil {
-		return nil, r.err
-	}
-	if r.regexp == nil || r.regexp.host == nil {
-		return nil, errors.New("mux: route doesn't have a host")
-	}
-	values, err := r.prepareVars(pairs...)
-	if err != nil {
-		return nil, err
-	}
-	host, err := r.regexp.host.url(values)
-	if err != nil {
-		return nil, err
-	}
-	u := &url.URL{
-		Scheme: "http",
-		Host:   host,
-	}
-	if s := r.getBuildScheme(); s != "" {
-		u.Scheme = s
-	}
-	return u, nil
-}
-
-// URLPath builds the path part of the URL for a route. See Route.URL().
-//
-// The route must have a path defined.
-func (r *Route) URLPath(pairs ...string) (*url.URL, error) {
-	if r.err != nil {
-		return nil, r.err
-	}
-	if r.regexp == nil || r.regexp.path == nil {
-		return nil, errors.New("mux: route doesn't have a path")
-	}
-	values, err := r.prepareVars(pairs...)
-	if err != nil {
-		return nil, err
-	}
-	path, err := r.regexp.path.url(values)
-	if err != nil {
-		return nil, err
-	}
-	return &url.URL{
-		Path: path,
-	}, nil
-}
-
-// GetPathTemplate returns the template used to build the
-// route match.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a path.
-func (r *Route) GetPathTemplate() (string, error) {
-	if r.err != nil {
-		return "", r.err
-	}
-	if r.regexp == nil || r.regexp.path == nil {
-		return "", errors.New("mux: route doesn't have a path")
-	}
-	return r.regexp.path.template, nil
-}
-
-// GetPathRegexp returns the expanded regular expression used to match route path.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a path.
-func (r *Route) GetPathRegexp() (string, error) {
-	if r.err != nil {
-		return "", r.err
-	}
-	if r.regexp == nil || r.regexp.path == nil {
-		return "", errors.New("mux: route does not have a path")
-	}
-	return r.regexp.path.regexp.String(), nil
-}
-
-// GetQueriesRegexp returns the expanded regular expressions used to match the
-// route queries.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not have queries.
-func (r *Route) GetQueriesRegexp() ([]string, error) {
-	if r.err != nil {
-		return nil, r.err
-	}
-	if r.regexp == nil || r.regexp.queries == nil {
-		return nil, errors.New("mux: route doesn't have queries")
-	}
-	var queries []string
-	for _, query := range r.regexp.queries {
-		queries = append(queries, query.regexp.String())
-	}
-	return queries, nil
-}
-
-// GetQueriesTemplates returns the templates used to build the
-// query matching.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define queries.
-func (r *Route) GetQueriesTemplates() ([]string, error) {
-	if r.err != nil {
-		return nil, r.err
-	}
-	if r.regexp == nil || r.regexp.queries == nil {
-		return nil, errors.New("mux: route doesn't have queries")
-	}
-	var queries []string
-	for _, query := range r.regexp.queries {
-		queries = append(queries, query.template)
-	}
-	return queries, nil
-}
-
-// GetMethods returns the methods the route matches against
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if route does not have methods.
-func (r *Route) GetMethods() ([]string, error) {
-	if r.err != nil {
-		return nil, r.err
-	}
-	for _, m := range r.matchers {
-		if methods, ok := m.(methodMatcher); ok {
-			return []string(methods), nil
-		}
-	}
-	return nil, errors.New("mux: route doesn't have methods")
-}
-
-// GetHostTemplate returns the template used to build the
-// route match.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a host.
-func (r *Route) GetHostTemplate() (string, error) {
-	if r.err != nil {
-		return "", r.err
-	}
-	if r.regexp == nil || r.regexp.host == nil {
-		return "", errors.New("mux: route doesn't have a host")
-	}
-	return r.regexp.host.template, nil
-}
-
-// prepareVars converts the route variable pairs into a map. If the route has a
-// BuildVarsFunc, it is invoked.
-func (r *Route) prepareVars(pairs ...string) (map[string]string, error) {
-	m, err := mapFromPairsToString(pairs...)
-	if err != nil {
-		return nil, err
-	}
-	return r.buildVars(m), nil
-}
-
-func (r *Route) buildVars(m map[string]string) map[string]string {
-	if r.parent != nil {
-		m = r.parent.buildVars(m)
-	}
-	if r.buildVarsFunc != nil {
-		m = r.buildVarsFunc(m)
-	}
-	return m
-}
-
-// ----------------------------------------------------------------------------
-// parentRoute
-// ----------------------------------------------------------------------------
-
-// parentRoute allows routes to know about parent host and path definitions.
-type parentRoute interface {
-	getBuildScheme() string
-	getNamedRoutes() map[string]*Route
-	getRegexpGroup() *routeRegexpGroup
-	buildVars(map[string]string) map[string]string
-}
-
-func (r *Route) getBuildScheme() string {
-	if r.buildScheme != "" {
-		return r.buildScheme
-	}
-	if r.parent != nil {
-		return r.parent.getBuildScheme()
-	}
-	return ""
-}
-
-// getNamedRoutes returns the map where named routes are registered.
-func (r *Route) getNamedRoutes() map[string]*Route {
-	if r.parent == nil {
-		// During tests router is not always set.
-		r.parent = NewRouter()
-	}
-	return r.parent.getNamedRoutes()
-}
-
-// getRegexpGroup returns regexp definitions from this route.
-func (r *Route) getRegexpGroup() *routeRegexpGroup {
-	if r.regexp == nil {
-		if r.parent == nil {
-			// During tests router is not always set.
-			r.parent = NewRouter()
-		}
-		regexp := r.parent.getRegexpGroup()
-		if regexp == nil {
-			r.regexp = new(routeRegexpGroup)
-		} else {
-			// Copy.
-			r.regexp = &routeRegexpGroup{
-				host:    regexp.host,
-				path:    regexp.path,
-				queries: regexp.queries,
-			}
-		}
-	}
-	return r.regexp
-}

+ 0 - 19
vendor/github.com/gorilla/mux/test_helpers.go

@@ -1,19 +0,0 @@
-// Copyright 2012 The Gorilla 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 mux
-
-import "net/http"
-
-// SetURLVars sets the URL variables for the given request, to be accessed via
-// mux.Vars for testing route behaviour. Arguments are not modified, a shallow
-// copy is returned.
-//
-// This API should only be used for testing purposes; it provides a way to
-// inject variables into the request context. Alternatively, URL variables
-// can be set by making a route that captures the required variables,
-// starting a server and sending the request to that server.
-func SetURLVars(r *http.Request, val map[string]string) *http.Request {
-	return setVars(r, val)
-}

+ 0 - 25
vendor/github.com/gorilla/websocket/.gitignore

@@ -1,25 +0,0 @@
-# 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
-
-.idea/
-*.iml

+ 0 - 19
vendor/github.com/gorilla/websocket/.travis.yml

@@ -1,19 +0,0 @@
-language: go
-sudo: false
-
-matrix:
-  include:
-    - go: 1.7.x
-    - go: 1.8.x
-    - go: 1.9.x
-    - go: 1.10.x
-    - go: 1.11.x
-    - go: tip
-  allow_failures:
-    - go: tip
-
-script:
-  - go get -t -v ./...
-  - diff -u <(echo -n) <(gofmt -d .)
-  - go vet $(go list ./... | grep -v /vendor/)
-  - go test -v -race ./...

+ 0 - 9
vendor/github.com/gorilla/websocket/AUTHORS

@@ -1,9 +0,0 @@
-# This is the official list of Gorilla WebSocket authors for copyright
-# purposes.
-#
-# Please keep the list sorted.
-
-Gary Burd <gary@beagledreams.com>
-Google LLC (https://opensource.google.com/)
-Joachim Bauch <mail@joachim-bauch.de>
-

+ 0 - 22
vendor/github.com/gorilla/websocket/LICENSE

@@ -1,22 +0,0 @@
-Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-  Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-  Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 64
vendor/github.com/gorilla/websocket/README.md

@@ -1,64 +0,0 @@
-# Gorilla WebSocket
-
-Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
-[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
-
-[![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket)
-[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket)
-
-### Documentation
-
-* [API Reference](http://godoc.org/github.com/gorilla/websocket)
-* [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat)
-* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command)
-* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo)
-* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch)
-
-### Status
-
-The Gorilla WebSocket package provides a complete and tested implementation of
-the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The
-package API is stable.
-
-### Installation
-
-    go get github.com/gorilla/websocket
-
-### Protocol Compliance
-
-The Gorilla WebSocket package passes the server tests in the [Autobahn Test
-Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn
-subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).
-
-### Gorilla WebSocket compared with other packages
-
-<table>
-<tr>
-<th></th>
-<th><a href="http://godoc.org/github.com/gorilla/websocket">github.com/gorilla</a></th>
-<th><a href="http://godoc.org/golang.org/x/net/websocket">golang.org/x/net</a></th>
-</tr>
-<tr>
-<tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr>
-<tr><td>Passes <a href="http://autobahn.ws/testsuite/">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr>
-<tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr>
-<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr>
-<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr>
-<tr><td>Get the <a href="https://tools.ietf.org/html/rfc6455#section-5.6">type</a> of a received data message</td><td>Yes</td><td>Yes, see note 2</td></tr>
-<tr><td colspan="3">Other Features</tr></td>
-<tr><td><a href="https://tools.ietf.org/html/rfc7692">Compression Extensions</a></td><td>Experimental</td><td>No</td></tr>
-<tr><td>Read message using io.Reader</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextReader">Yes</a></td><td>No, see note 3</td></tr>
-<tr><td>Write message using io.WriteCloser</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextWriter">Yes</a></td><td>No, see note 3</td></tr>
-</table>
-
-Notes:
-
-1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html).
-2. The application can get the type of a received data message by implementing
-   a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal)
-   function.
-3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries.
-  Read returns when the input buffer is full or a frame boundary is
-  encountered. Each call to Write sends a single frame message. The Gorilla
-  io.Reader and io.WriteCloser operate on a single WebSocket message.
-

+ 0 - 395
vendor/github.com/gorilla/websocket/client.go

@@ -1,395 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket 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 websocket
-
-import (
-	"bytes"
-	"context"
-	"crypto/tls"
-	"errors"
-	"io"
-	"io/ioutil"
-	"net"
-	"net/http"
-	"net/http/httptrace"
-	"net/url"
-	"strings"
-	"time"
-)
-
-// ErrBadHandshake is returned when the server response to opening handshake is
-// invalid.
-var ErrBadHandshake = errors.New("websocket: bad handshake")
-
-var errInvalidCompression = errors.New("websocket: invalid compression negotiation")
-
-// NewClient creates a new client connection using the given net connection.
-// The URL u specifies the host and request URI. Use requestHeader to specify
-// the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies
-// (Cookie). Use the response.Header to get the selected subprotocol
-// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
-//
-// If the WebSocket handshake fails, ErrBadHandshake is returned along with a
-// non-nil *http.Response so that callers can handle redirects, authentication,
-// etc.
-//
-// Deprecated: Use Dialer instead.
-func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int) (c *Conn, response *http.Response, err error) {
-	d := Dialer{
-		ReadBufferSize:  readBufSize,
-		WriteBufferSize: writeBufSize,
-		NetDial: func(net, addr string) (net.Conn, error) {
-			return netConn, nil
-		},
-	}
-	return d.Dial(u.String(), requestHeader)
-}
-
-// A Dialer contains options for connecting to WebSocket server.
-type Dialer struct {
-	// NetDial specifies the dial function for creating TCP connections. If
-	// NetDial is nil, net.Dial is used.
-	NetDial func(network, addr string) (net.Conn, error)
-
-	// NetDialContext specifies the dial function for creating TCP connections. If
-	// NetDialContext is nil, net.DialContext is used.
-	NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error)
-
-	// Proxy specifies a function to return a proxy for a given
-	// Request. If the function returns a non-nil error, the
-	// request is aborted with the provided error.
-	// If Proxy is nil or returns a nil *URL, no proxy is used.
-	Proxy func(*http.Request) (*url.URL, error)
-
-	// TLSClientConfig specifies the TLS configuration to use with tls.Client.
-	// If nil, the default configuration is used.
-	TLSClientConfig *tls.Config
-
-	// HandshakeTimeout specifies the duration for the handshake to complete.
-	HandshakeTimeout time.Duration
-
-	// ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer
-	// size is zero, then a useful default size is used. The I/O buffer sizes
-	// do not limit the size of the messages that can be sent or received.
-	ReadBufferSize, WriteBufferSize int
-
-	// WriteBufferPool is a pool of buffers for write operations. If the value
-	// is not set, then write buffers are allocated to the connection for the
-	// lifetime of the connection.
-	//
-	// A pool is most useful when the application has a modest volume of writes
-	// across a large number of connections.
-	//
-	// Applications should use a single pool for each unique value of
-	// WriteBufferSize.
-	WriteBufferPool BufferPool
-
-	// Subprotocols specifies the client's requested subprotocols.
-	Subprotocols []string
-
-	// EnableCompression specifies if the client should attempt to negotiate
-	// per message compression (RFC 7692). Setting this value to true does not
-	// guarantee that compression will be supported. Currently only "no context
-	// takeover" modes are supported.
-	EnableCompression bool
-
-	// Jar specifies the cookie jar.
-	// If Jar is nil, cookies are not sent in requests and ignored
-	// in responses.
-	Jar http.CookieJar
-}
-
-// Dial creates a new client connection by calling DialContext with a background context.
-func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) {
-	return d.DialContext(context.Background(), urlStr, requestHeader)
-}
-
-var errMalformedURL = errors.New("malformed ws or wss URL")
-
-func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) {
-	hostPort = u.Host
-	hostNoPort = u.Host
-	if i := strings.LastIndex(u.Host, ":"); i > strings.LastIndex(u.Host, "]") {
-		hostNoPort = hostNoPort[:i]
-	} else {
-		switch u.Scheme {
-		case "wss":
-			hostPort += ":443"
-		case "https":
-			hostPort += ":443"
-		default:
-			hostPort += ":80"
-		}
-	}
-	return hostPort, hostNoPort
-}
-
-// DefaultDialer is a dialer with all fields set to the default values.
-var DefaultDialer = &Dialer{
-	Proxy:            http.ProxyFromEnvironment,
-	HandshakeTimeout: 45 * time.Second,
-}
-
-// nilDialer is dialer to use when receiver is nil.
-var nilDialer = *DefaultDialer
-
-// DialContext creates a new client connection. Use requestHeader to specify the
-// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie).
-// Use the response.Header to get the selected subprotocol
-// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
-//
-// The context will be used in the request and in the Dialer
-//
-// If the WebSocket handshake fails, ErrBadHandshake is returned along with a
-// non-nil *http.Response so that callers can handle redirects, authentication,
-// etcetera. The response body may not contain the entire response and does not
-// need to be closed by the application.
-func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) {
-	if d == nil {
-		d = &nilDialer
-	}
-
-	challengeKey, err := generateChallengeKey()
-	if err != nil {
-		return nil, nil, err
-	}
-
-	u, err := url.Parse(urlStr)
-	if err != nil {
-		return nil, nil, err
-	}
-
-	switch u.Scheme {
-	case "ws":
-		u.Scheme = "http"
-	case "wss":
-		u.Scheme = "https"
-	default:
-		return nil, nil, errMalformedURL
-	}
-
-	if u.User != nil {
-		// User name and password are not allowed in websocket URIs.
-		return nil, nil, errMalformedURL
-	}
-
-	req := &http.Request{
-		Method:     "GET",
-		URL:        u,
-		Proto:      "HTTP/1.1",
-		ProtoMajor: 1,
-		ProtoMinor: 1,
-		Header:     make(http.Header),
-		Host:       u.Host,
-	}
-	req = req.WithContext(ctx)
-
-	// Set the cookies present in the cookie jar of the dialer
-	if d.Jar != nil {
-		for _, cookie := range d.Jar.Cookies(u) {
-			req.AddCookie(cookie)
-		}
-	}
-
-	// Set the request headers using the capitalization for names and values in
-	// RFC examples. Although the capitalization shouldn't matter, there are
-	// servers that depend on it. The Header.Set method is not used because the
-	// method canonicalizes the header names.
-	req.Header["Upgrade"] = []string{"websocket"}
-	req.Header["Connection"] = []string{"Upgrade"}
-	req.Header["Sec-WebSocket-Key"] = []string{challengeKey}
-	req.Header["Sec-WebSocket-Version"] = []string{"13"}
-	if len(d.Subprotocols) > 0 {
-		req.Header["Sec-WebSocket-Protocol"] = []string{strings.Join(d.Subprotocols, ", ")}
-	}
-	for k, vs := range requestHeader {
-		switch {
-		case k == "Host":
-			if len(vs) > 0 {
-				req.Host = vs[0]
-			}
-		case k == "Upgrade" ||
-			k == "Connection" ||
-			k == "Sec-Websocket-Key" ||
-			k == "Sec-Websocket-Version" ||
-			k == "Sec-Websocket-Extensions" ||
-			(k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0):
-			return nil, nil, errors.New("websocket: duplicate header not allowed: " + k)
-		case k == "Sec-Websocket-Protocol":
-			req.Header["Sec-WebSocket-Protocol"] = vs
-		default:
-			req.Header[k] = vs
-		}
-	}
-
-	if d.EnableCompression {
-		req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"}
-	}
-
-	if d.HandshakeTimeout != 0 {
-		var cancel func()
-		ctx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout)
-		defer cancel()
-	}
-
-	// Get network dial function.
-	var netDial func(network, add string) (net.Conn, error)
-
-	if d.NetDialContext != nil {
-		netDial = func(network, addr string) (net.Conn, error) {
-			return d.NetDialContext(ctx, network, addr)
-		}
-	} else if d.NetDial != nil {
-		netDial = d.NetDial
-	} else {
-		netDialer := &net.Dialer{}
-		netDial = func(network, addr string) (net.Conn, error) {
-			return netDialer.DialContext(ctx, network, addr)
-		}
-	}
-
-	// If needed, wrap the dial function to set the connection deadline.
-	if deadline, ok := ctx.Deadline(); ok {
-		forwardDial := netDial
-		netDial = func(network, addr string) (net.Conn, error) {
-			c, err := forwardDial(network, addr)
-			if err != nil {
-				return nil, err
-			}
-			err = c.SetDeadline(deadline)
-			if err != nil {
-				c.Close()
-				return nil, err
-			}
-			return c, nil
-		}
-	}
-
-	// If needed, wrap the dial function to connect through a proxy.
-	if d.Proxy != nil {
-		proxyURL, err := d.Proxy(req)
-		if err != nil {
-			return nil, nil, err
-		}
-		if proxyURL != nil {
-			dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial))
-			if err != nil {
-				return nil, nil, err
-			}
-			netDial = dialer.Dial
-		}
-	}
-
-	hostPort, hostNoPort := hostPortNoPort(u)
-	trace := httptrace.ContextClientTrace(ctx)
-	if trace != nil && trace.GetConn != nil {
-		trace.GetConn(hostPort)
-	}
-
-	netConn, err := netDial("tcp", hostPort)
-	if trace != nil && trace.GotConn != nil {
-		trace.GotConn(httptrace.GotConnInfo{
-			Conn: netConn,
-		})
-	}
-	if err != nil {
-		return nil, nil, err
-	}
-
-	defer func() {
-		if netConn != nil {
-			netConn.Close()
-		}
-	}()
-
-	if u.Scheme == "https" {
-		cfg := cloneTLSConfig(d.TLSClientConfig)
-		if cfg.ServerName == "" {
-			cfg.ServerName = hostNoPort
-		}
-		tlsConn := tls.Client(netConn, cfg)
-		netConn = tlsConn
-
-		var err error
-		if trace != nil {
-			err = doHandshakeWithTrace(trace, tlsConn, cfg)
-		} else {
-			err = doHandshake(tlsConn, cfg)
-		}
-
-		if err != nil {
-			return nil, nil, err
-		}
-	}
-
-	conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize, d.WriteBufferPool, nil, nil)
-
-	if err := req.Write(netConn); err != nil {
-		return nil, nil, err
-	}
-
-	if trace != nil && trace.GotFirstResponseByte != nil {
-		if peek, err := conn.br.Peek(1); err == nil && len(peek) == 1 {
-			trace.GotFirstResponseByte()
-		}
-	}
-
-	resp, err := http.ReadResponse(conn.br, req)
-	if err != nil {
-		return nil, nil, err
-	}
-
-	if d.Jar != nil {
-		if rc := resp.Cookies(); len(rc) > 0 {
-			d.Jar.SetCookies(u, rc)
-		}
-	}
-
-	if resp.StatusCode != 101 ||
-		!strings.EqualFold(resp.Header.Get("Upgrade"), "websocket") ||
-		!strings.EqualFold(resp.Header.Get("Connection"), "upgrade") ||
-		resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) {
-		// Before closing the network connection on return from this
-		// function, slurp up some of the response to aid application
-		// debugging.
-		buf := make([]byte, 1024)
-		n, _ := io.ReadFull(resp.Body, buf)
-		resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n]))
-		return nil, resp, ErrBadHandshake
-	}
-
-	for _, ext := range parseExtensions(resp.Header) {
-		if ext[""] != "permessage-deflate" {
-			continue
-		}
-		_, snct := ext["server_no_context_takeover"]
-		_, cnct := ext["client_no_context_takeover"]
-		if !snct || !cnct {
-			return nil, resp, errInvalidCompression
-		}
-		conn.newCompressionWriter = compressNoContextTakeover
-		conn.newDecompressionReader = decompressNoContextTakeover
-		break
-	}
-
-	resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
-	conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol")
-
-	netConn.SetDeadline(time.Time{})
-	netConn = nil // to avoid close in defer.
-	return conn, resp, nil
-}
-
-func doHandshake(tlsConn *tls.Conn, cfg *tls.Config) error {
-	if err := tlsConn.Handshake(); err != nil {
-		return err
-	}
-	if !cfg.InsecureSkipVerify {
-		if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil {
-			return err
-		}
-	}
-	return nil
-}

+ 0 - 16
vendor/github.com/gorilla/websocket/client_clone.go

@@ -1,16 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.8
-
-package websocket
-
-import "crypto/tls"
-
-func cloneTLSConfig(cfg *tls.Config) *tls.Config {
-	if cfg == nil {
-		return &tls.Config{}
-	}
-	return cfg.Clone()
-}

+ 0 - 38
vendor/github.com/gorilla/websocket/client_clone_legacy.go

@@ -1,38 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.8
-
-package websocket
-
-import "crypto/tls"
-
-// cloneTLSConfig clones all public fields except the fields
-// SessionTicketsDisabled and SessionTicketKey. This avoids copying the
-// sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a
-// config in active use.
-func cloneTLSConfig(cfg *tls.Config) *tls.Config {
-	if cfg == nil {
-		return &tls.Config{}
-	}
-	return &tls.Config{
-		Rand:                     cfg.Rand,
-		Time:                     cfg.Time,
-		Certificates:             cfg.Certificates,
-		NameToCertificate:        cfg.NameToCertificate,
-		GetCertificate:           cfg.GetCertificate,
-		RootCAs:                  cfg.RootCAs,
-		NextProtos:               cfg.NextProtos,
-		ServerName:               cfg.ServerName,
-		ClientAuth:               cfg.ClientAuth,
-		ClientCAs:                cfg.ClientCAs,
-		InsecureSkipVerify:       cfg.InsecureSkipVerify,
-		CipherSuites:             cfg.CipherSuites,
-		PreferServerCipherSuites: cfg.PreferServerCipherSuites,
-		ClientSessionCache:       cfg.ClientSessionCache,
-		MinVersion:               cfg.MinVersion,
-		MaxVersion:               cfg.MaxVersion,
-		CurvePreferences:         cfg.CurvePreferences,
-	}
-}

+ 0 - 148
vendor/github.com/gorilla/websocket/compression.go

@@ -1,148 +0,0 @@
-// Copyright 2017 The Gorilla WebSocket 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 websocket
-
-import (
-	"compress/flate"
-	"errors"
-	"io"
-	"strings"
-	"sync"
-)
-
-const (
-	minCompressionLevel     = -2 // flate.HuffmanOnly not defined in Go < 1.6
-	maxCompressionLevel     = flate.BestCompression
-	defaultCompressionLevel = 1
-)
-
-var (
-	flateWriterPools [maxCompressionLevel - minCompressionLevel + 1]sync.Pool
-	flateReaderPool  = sync.Pool{New: func() interface{} {
-		return flate.NewReader(nil)
-	}}
-)
-
-func decompressNoContextTakeover(r io.Reader) io.ReadCloser {
-	const tail =
-	// Add four bytes as specified in RFC
-	"\x00\x00\xff\xff" +
-		// Add final block to squelch unexpected EOF error from flate reader.
-		"\x01\x00\x00\xff\xff"
-
-	fr, _ := flateReaderPool.Get().(io.ReadCloser)
-	fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil)
-	return &flateReadWrapper{fr}
-}
-
-func isValidCompressionLevel(level int) bool {
-	return minCompressionLevel <= level && level <= maxCompressionLevel
-}
-
-func compressNoContextTakeover(w io.WriteCloser, level int) io.WriteCloser {
-	p := &flateWriterPools[level-minCompressionLevel]
-	tw := &truncWriter{w: w}
-	fw, _ := p.Get().(*flate.Writer)
-	if fw == nil {
-		fw, _ = flate.NewWriter(tw, level)
-	} else {
-		fw.Reset(tw)
-	}
-	return &flateWriteWrapper{fw: fw, tw: tw, p: p}
-}
-
-// truncWriter is an io.Writer that writes all but the last four bytes of the
-// stream to another io.Writer.
-type truncWriter struct {
-	w io.WriteCloser
-	n int
-	p [4]byte
-}
-
-func (w *truncWriter) Write(p []byte) (int, error) {
-	n := 0
-
-	// fill buffer first for simplicity.
-	if w.n < len(w.p) {
-		n = copy(w.p[w.n:], p)
-		p = p[n:]
-		w.n += n
-		if len(p) == 0 {
-			return n, nil
-		}
-	}
-
-	m := len(p)
-	if m > len(w.p) {
-		m = len(w.p)
-	}
-
-	if nn, err := w.w.Write(w.p[:m]); err != nil {
-		return n + nn, err
-	}
-
-	copy(w.p[:], w.p[m:])
-	copy(w.p[len(w.p)-m:], p[len(p)-m:])
-	nn, err := w.w.Write(p[:len(p)-m])
-	return n + nn, err
-}
-
-type flateWriteWrapper struct {
-	fw *flate.Writer
-	tw *truncWriter
-	p  *sync.Pool
-}
-
-func (w *flateWriteWrapper) Write(p []byte) (int, error) {
-	if w.fw == nil {
-		return 0, errWriteClosed
-	}
-	return w.fw.Write(p)
-}
-
-func (w *flateWriteWrapper) Close() error {
-	if w.fw == nil {
-		return errWriteClosed
-	}
-	err1 := w.fw.Flush()
-	w.p.Put(w.fw)
-	w.fw = nil
-	if w.tw.p != [4]byte{0, 0, 0xff, 0xff} {
-		return errors.New("websocket: internal error, unexpected bytes at end of flate stream")
-	}
-	err2 := w.tw.w.Close()
-	if err1 != nil {
-		return err1
-	}
-	return err2
-}
-
-type flateReadWrapper struct {
-	fr io.ReadCloser
-}
-
-func (r *flateReadWrapper) Read(p []byte) (int, error) {
-	if r.fr == nil {
-		return 0, io.ErrClosedPipe
-	}
-	n, err := r.fr.Read(p)
-	if err == io.EOF {
-		// Preemptively place the reader back in the pool. This helps with
-		// scenarios where the application does not call NextReader() soon after
-		// this final read.
-		r.Close()
-	}
-	return n, err
-}
-
-func (r *flateReadWrapper) Close() error {
-	if r.fr == nil {
-		return io.ErrClosedPipe
-	}
-	err := r.fr.Close()
-	flateReaderPool.Put(r.fr)
-	r.fr = nil
-	return err
-}

+ 0 - 1165
vendor/github.com/gorilla/websocket/conn.go

@@ -1,1165 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket 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 websocket
-
-import (
-	"bufio"
-	"encoding/binary"
-	"errors"
-	"io"
-	"io/ioutil"
-	"math/rand"
-	"net"
-	"strconv"
-	"sync"
-	"time"
-	"unicode/utf8"
-)
-
-const (
-	// Frame header byte 0 bits from Section 5.2 of RFC 6455
-	finalBit = 1 << 7
-	rsv1Bit  = 1 << 6
-	rsv2Bit  = 1 << 5
-	rsv3Bit  = 1 << 4
-
-	// Frame header byte 1 bits from Section 5.2 of RFC 6455
-	maskBit = 1 << 7
-
-	maxFrameHeaderSize         = 2 + 8 + 4 // Fixed header + length + mask
-	maxControlFramePayloadSize = 125
-
-	writeWait = time.Second
-
-	defaultReadBufferSize  = 4096
-	defaultWriteBufferSize = 4096
-
-	continuationFrame = 0
-	noFrame           = -1
-)
-
-// Close codes defined in RFC 6455, section 11.7.
-const (
-	CloseNormalClosure           = 1000
-	CloseGoingAway               = 1001
-	CloseProtocolError           = 1002
-	CloseUnsupportedData         = 1003
-	CloseNoStatusReceived        = 1005
-	CloseAbnormalClosure         = 1006
-	CloseInvalidFramePayloadData = 1007
-	ClosePolicyViolation         = 1008
-	CloseMessageTooBig           = 1009
-	CloseMandatoryExtension      = 1010
-	CloseInternalServerErr       = 1011
-	CloseServiceRestart          = 1012
-	CloseTryAgainLater           = 1013
-	CloseTLSHandshake            = 1015
-)
-
-// The message types are defined in RFC 6455, section 11.8.
-const (
-	// TextMessage denotes a text data message. The text message payload is
-	// interpreted as UTF-8 encoded text data.
-	TextMessage = 1
-
-	// BinaryMessage denotes a binary data message.
-	BinaryMessage = 2
-
-	// CloseMessage denotes a close control message. The optional message
-	// payload contains a numeric code and text. Use the FormatCloseMessage
-	// function to format a close message payload.
-	CloseMessage = 8
-
-	// PingMessage denotes a ping control message. The optional message payload
-	// is UTF-8 encoded text.
-	PingMessage = 9
-
-	// PongMessage denotes a pong control message. The optional message payload
-	// is UTF-8 encoded text.
-	PongMessage = 10
-)
-
-// ErrCloseSent is returned when the application writes a message to the
-// connection after sending a close message.
-var ErrCloseSent = errors.New("websocket: close sent")
-
-// ErrReadLimit is returned when reading a message that is larger than the
-// read limit set for the connection.
-var ErrReadLimit = errors.New("websocket: read limit exceeded")
-
-// netError satisfies the net Error interface.
-type netError struct {
-	msg       string
-	temporary bool
-	timeout   bool
-}
-
-func (e *netError) Error() string   { return e.msg }
-func (e *netError) Temporary() bool { return e.temporary }
-func (e *netError) Timeout() bool   { return e.timeout }
-
-// CloseError represents a close message.
-type CloseError struct {
-	// Code is defined in RFC 6455, section 11.7.
-	Code int
-
-	// Text is the optional text payload.
-	Text string
-}
-
-func (e *CloseError) Error() string {
-	s := []byte("websocket: close ")
-	s = strconv.AppendInt(s, int64(e.Code), 10)
-	switch e.Code {
-	case CloseNormalClosure:
-		s = append(s, " (normal)"...)
-	case CloseGoingAway:
-		s = append(s, " (going away)"...)
-	case CloseProtocolError:
-		s = append(s, " (protocol error)"...)
-	case CloseUnsupportedData:
-		s = append(s, " (unsupported data)"...)
-	case CloseNoStatusReceived:
-		s = append(s, " (no status)"...)
-	case CloseAbnormalClosure:
-		s = append(s, " (abnormal closure)"...)
-	case CloseInvalidFramePayloadData:
-		s = append(s, " (invalid payload data)"...)
-	case ClosePolicyViolation:
-		s = append(s, " (policy violation)"...)
-	case CloseMessageTooBig:
-		s = append(s, " (message too big)"...)
-	case CloseMandatoryExtension:
-		s = append(s, " (mandatory extension missing)"...)
-	case CloseInternalServerErr:
-		s = append(s, " (internal server error)"...)
-	case CloseTLSHandshake:
-		s = append(s, " (TLS handshake error)"...)
-	}
-	if e.Text != "" {
-		s = append(s, ": "...)
-		s = append(s, e.Text...)
-	}
-	return string(s)
-}
-
-// IsCloseError returns boolean indicating whether the error is a *CloseError
-// with one of the specified codes.
-func IsCloseError(err error, codes ...int) bool {
-	if e, ok := err.(*CloseError); ok {
-		for _, code := range codes {
-			if e.Code == code {
-				return true
-			}
-		}
-	}
-	return false
-}
-
-// IsUnexpectedCloseError returns boolean indicating whether the error is a
-// *CloseError with a code not in the list of expected codes.
-func IsUnexpectedCloseError(err error, expectedCodes ...int) bool {
-	if e, ok := err.(*CloseError); ok {
-		for _, code := range expectedCodes {
-			if e.Code == code {
-				return false
-			}
-		}
-		return true
-	}
-	return false
-}
-
-var (
-	errWriteTimeout        = &netError{msg: "websocket: write timeout", timeout: true, temporary: true}
-	errUnexpectedEOF       = &CloseError{Code: CloseAbnormalClosure, Text: io.ErrUnexpectedEOF.Error()}
-	errBadWriteOpCode      = errors.New("websocket: bad write message type")
-	errWriteClosed         = errors.New("websocket: write closed")
-	errInvalidControlFrame = errors.New("websocket: invalid control frame")
-)
-
-func newMaskKey() [4]byte {
-	n := rand.Uint32()
-	return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)}
-}
-
-func hideTempErr(err error) error {
-	if e, ok := err.(net.Error); ok && e.Temporary() {
-		err = &netError{msg: e.Error(), timeout: e.Timeout()}
-	}
-	return err
-}
-
-func isControl(frameType int) bool {
-	return frameType == CloseMessage || frameType == PingMessage || frameType == PongMessage
-}
-
-func isData(frameType int) bool {
-	return frameType == TextMessage || frameType == BinaryMessage
-}
-
-var validReceivedCloseCodes = map[int]bool{
-	// see http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number
-
-	CloseNormalClosure:           true,
-	CloseGoingAway:               true,
-	CloseProtocolError:           true,
-	CloseUnsupportedData:         true,
-	CloseNoStatusReceived:        false,
-	CloseAbnormalClosure:         false,
-	CloseInvalidFramePayloadData: true,
-	ClosePolicyViolation:         true,
-	CloseMessageTooBig:           true,
-	CloseMandatoryExtension:      true,
-	CloseInternalServerErr:       true,
-	CloseServiceRestart:          true,
-	CloseTryAgainLater:           true,
-	CloseTLSHandshake:            false,
-}
-
-func isValidReceivedCloseCode(code int) bool {
-	return validReceivedCloseCodes[code] || (code >= 3000 && code <= 4999)
-}
-
-// BufferPool represents a pool of buffers. The *sync.Pool type satisfies this
-// interface.  The type of the value stored in a pool is not specified.
-type BufferPool interface {
-	// Get gets a value from the pool or returns nil if the pool is empty.
-	Get() interface{}
-	// Put adds a value to the pool.
-	Put(interface{})
-}
-
-// writePoolData is the type added to the write buffer pool. This wrapper is
-// used to prevent applications from peeking at and depending on the values
-// added to the pool.
-type writePoolData struct{ buf []byte }
-
-// The Conn type represents a WebSocket connection.
-type Conn struct {
-	conn        net.Conn
-	isServer    bool
-	subprotocol string
-
-	// Write fields
-	mu            chan bool // used as mutex to protect write to conn
-	writeBuf      []byte    // frame is constructed in this buffer.
-	writePool     BufferPool
-	writeBufSize  int
-	writeDeadline time.Time
-	writer        io.WriteCloser // the current writer returned to the application
-	isWriting     bool           // for best-effort concurrent write detection
-
-	writeErrMu sync.Mutex
-	writeErr   error
-
-	enableWriteCompression bool
-	compressionLevel       int
-	newCompressionWriter   func(io.WriteCloser, int) io.WriteCloser
-
-	// Read fields
-	reader        io.ReadCloser // the current reader returned to the application
-	readErr       error
-	br            *bufio.Reader
-	readRemaining int64 // bytes remaining in current frame.
-	readFinal     bool  // true the current message has more frames.
-	readLength    int64 // Message size.
-	readLimit     int64 // Maximum message size.
-	readMaskPos   int
-	readMaskKey   [4]byte
-	handlePong    func(string) error
-	handlePing    func(string) error
-	handleClose   func(int, string) error
-	readErrCount  int
-	messageReader *messageReader // the current low-level reader
-
-	readDecompress         bool // whether last read frame had RSV1 set
-	newDecompressionReader func(io.Reader) io.ReadCloser
-}
-
-func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, writeBufferPool BufferPool, br *bufio.Reader, writeBuf []byte) *Conn {
-
-	if br == nil {
-		if readBufferSize == 0 {
-			readBufferSize = defaultReadBufferSize
-		} else if readBufferSize < maxControlFramePayloadSize {
-			// must be large enough for control frame
-			readBufferSize = maxControlFramePayloadSize
-		}
-		br = bufio.NewReaderSize(conn, readBufferSize)
-	}
-
-	if writeBufferSize <= 0 {
-		writeBufferSize = defaultWriteBufferSize
-	}
-	writeBufferSize += maxFrameHeaderSize
-
-	if writeBuf == nil && writeBufferPool == nil {
-		writeBuf = make([]byte, writeBufferSize)
-	}
-
-	mu := make(chan bool, 1)
-	mu <- true
-	c := &Conn{
-		isServer:               isServer,
-		br:                     br,
-		conn:                   conn,
-		mu:                     mu,
-		readFinal:              true,
-		writeBuf:               writeBuf,
-		writePool:              writeBufferPool,
-		writeBufSize:           writeBufferSize,
-		enableWriteCompression: true,
-		compressionLevel:       defaultCompressionLevel,
-	}
-	c.SetCloseHandler(nil)
-	c.SetPingHandler(nil)
-	c.SetPongHandler(nil)
-	return c
-}
-
-// Subprotocol returns the negotiated protocol for the connection.
-func (c *Conn) Subprotocol() string {
-	return c.subprotocol
-}
-
-// Close closes the underlying network connection without sending or waiting
-// for a close message.
-func (c *Conn) Close() error {
-	return c.conn.Close()
-}
-
-// LocalAddr returns the local network address.
-func (c *Conn) LocalAddr() net.Addr {
-	return c.conn.LocalAddr()
-}
-
-// RemoteAddr returns the remote network address.
-func (c *Conn) RemoteAddr() net.Addr {
-	return c.conn.RemoteAddr()
-}
-
-// Write methods
-
-func (c *Conn) writeFatal(err error) error {
-	err = hideTempErr(err)
-	c.writeErrMu.Lock()
-	if c.writeErr == nil {
-		c.writeErr = err
-	}
-	c.writeErrMu.Unlock()
-	return err
-}
-
-func (c *Conn) read(n int) ([]byte, error) {
-	p, err := c.br.Peek(n)
-	if err == io.EOF {
-		err = errUnexpectedEOF
-	}
-	c.br.Discard(len(p))
-	return p, err
-}
-
-func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error {
-	<-c.mu
-	defer func() { c.mu <- true }()
-
-	c.writeErrMu.Lock()
-	err := c.writeErr
-	c.writeErrMu.Unlock()
-	if err != nil {
-		return err
-	}
-
-	c.conn.SetWriteDeadline(deadline)
-	if len(buf1) == 0 {
-		_, err = c.conn.Write(buf0)
-	} else {
-		err = c.writeBufs(buf0, buf1)
-	}
-	if err != nil {
-		return c.writeFatal(err)
-	}
-	if frameType == CloseMessage {
-		c.writeFatal(ErrCloseSent)
-	}
-	return nil
-}
-
-// WriteControl writes a control message with the given deadline. The allowed
-// message types are CloseMessage, PingMessage and PongMessage.
-func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error {
-	if !isControl(messageType) {
-		return errBadWriteOpCode
-	}
-	if len(data) > maxControlFramePayloadSize {
-		return errInvalidControlFrame
-	}
-
-	b0 := byte(messageType) | finalBit
-	b1 := byte(len(data))
-	if !c.isServer {
-		b1 |= maskBit
-	}
-
-	buf := make([]byte, 0, maxFrameHeaderSize+maxControlFramePayloadSize)
-	buf = append(buf, b0, b1)
-
-	if c.isServer {
-		buf = append(buf, data...)
-	} else {
-		key := newMaskKey()
-		buf = append(buf, key[:]...)
-		buf = append(buf, data...)
-		maskBytes(key, 0, buf[6:])
-	}
-
-	d := time.Hour * 1000
-	if !deadline.IsZero() {
-		d = deadline.Sub(time.Now())
-		if d < 0 {
-			return errWriteTimeout
-		}
-	}
-
-	timer := time.NewTimer(d)
-	select {
-	case <-c.mu:
-		timer.Stop()
-	case <-timer.C:
-		return errWriteTimeout
-	}
-	defer func() { c.mu <- true }()
-
-	c.writeErrMu.Lock()
-	err := c.writeErr
-	c.writeErrMu.Unlock()
-	if err != nil {
-		return err
-	}
-
-	c.conn.SetWriteDeadline(deadline)
-	_, err = c.conn.Write(buf)
-	if err != nil {
-		return c.writeFatal(err)
-	}
-	if messageType == CloseMessage {
-		c.writeFatal(ErrCloseSent)
-	}
-	return err
-}
-
-func (c *Conn) prepWrite(messageType int) error {
-	// Close previous writer if not already closed by the application. It's
-	// probably better to return an error in this situation, but we cannot
-	// change this without breaking existing applications.
-	if c.writer != nil {
-		c.writer.Close()
-		c.writer = nil
-	}
-
-	if !isControl(messageType) && !isData(messageType) {
-		return errBadWriteOpCode
-	}
-
-	c.writeErrMu.Lock()
-	err := c.writeErr
-	c.writeErrMu.Unlock()
-	if err != nil {
-		return err
-	}
-
-	if c.writeBuf == nil {
-		wpd, ok := c.writePool.Get().(writePoolData)
-		if ok {
-			c.writeBuf = wpd.buf
-		} else {
-			c.writeBuf = make([]byte, c.writeBufSize)
-		}
-	}
-	return nil
-}
-
-// NextWriter returns a writer for the next message to send. The writer's Close
-// method flushes the complete message to the network.
-//
-// There can be at most one open writer on a connection. NextWriter closes the
-// previous writer if the application has not already done so.
-//
-// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and
-// PongMessage) are supported.
-func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) {
-	if err := c.prepWrite(messageType); err != nil {
-		return nil, err
-	}
-
-	mw := &messageWriter{
-		c:         c,
-		frameType: messageType,
-		pos:       maxFrameHeaderSize,
-	}
-	c.writer = mw
-	if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) {
-		w := c.newCompressionWriter(c.writer, c.compressionLevel)
-		mw.compress = true
-		c.writer = w
-	}
-	return c.writer, nil
-}
-
-type messageWriter struct {
-	c         *Conn
-	compress  bool // whether next call to flushFrame should set RSV1
-	pos       int  // end of data in writeBuf.
-	frameType int  // type of the current frame.
-	err       error
-}
-
-func (w *messageWriter) fatal(err error) error {
-	if w.err != nil {
-		w.err = err
-		w.c.writer = nil
-	}
-	return err
-}
-
-// flushFrame writes buffered data and extra as a frame to the network. The
-// final argument indicates that this is the last frame in the message.
-func (w *messageWriter) flushFrame(final bool, extra []byte) error {
-	c := w.c
-	length := w.pos - maxFrameHeaderSize + len(extra)
-
-	// Check for invalid control frames.
-	if isControl(w.frameType) &&
-		(!final || length > maxControlFramePayloadSize) {
-		return w.fatal(errInvalidControlFrame)
-	}
-
-	b0 := byte(w.frameType)
-	if final {
-		b0 |= finalBit
-	}
-	if w.compress {
-		b0 |= rsv1Bit
-	}
-	w.compress = false
-
-	b1 := byte(0)
-	if !c.isServer {
-		b1 |= maskBit
-	}
-
-	// Assume that the frame starts at beginning of c.writeBuf.
-	framePos := 0
-	if c.isServer {
-		// Adjust up if mask not included in the header.
-		framePos = 4
-	}
-
-	switch {
-	case length >= 65536:
-		c.writeBuf[framePos] = b0
-		c.writeBuf[framePos+1] = b1 | 127
-		binary.BigEndian.PutUint64(c.writeBuf[framePos+2:], uint64(length))
-	case length > 125:
-		framePos += 6
-		c.writeBuf[framePos] = b0
-		c.writeBuf[framePos+1] = b1 | 126
-		binary.BigEndian.PutUint16(c.writeBuf[framePos+2:], uint16(length))
-	default:
-		framePos += 8
-		c.writeBuf[framePos] = b0
-		c.writeBuf[framePos+1] = b1 | byte(length)
-	}
-
-	if !c.isServer {
-		key := newMaskKey()
-		copy(c.writeBuf[maxFrameHeaderSize-4:], key[:])
-		maskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos])
-		if len(extra) > 0 {
-			return c.writeFatal(errors.New("websocket: internal error, extra used in client mode"))
-		}
-	}
-
-	// Write the buffers to the connection with best-effort detection of
-	// concurrent writes. See the concurrency section in the package
-	// documentation for more info.
-
-	if c.isWriting {
-		panic("concurrent write to websocket connection")
-	}
-	c.isWriting = true
-
-	err := c.write(w.frameType, c.writeDeadline, c.writeBuf[framePos:w.pos], extra)
-
-	if !c.isWriting {
-		panic("concurrent write to websocket connection")
-	}
-	c.isWriting = false
-
-	if err != nil {
-		return w.fatal(err)
-	}
-
-	if final {
-		c.writer = nil
-		if c.writePool != nil {
-			c.writePool.Put(writePoolData{buf: c.writeBuf})
-			c.writeBuf = nil
-		}
-		return nil
-	}
-
-	// Setup for next frame.
-	w.pos = maxFrameHeaderSize
-	w.frameType = continuationFrame
-	return nil
-}
-
-func (w *messageWriter) ncopy(max int) (int, error) {
-	n := len(w.c.writeBuf) - w.pos
-	if n <= 0 {
-		if err := w.flushFrame(false, nil); err != nil {
-			return 0, err
-		}
-		n = len(w.c.writeBuf) - w.pos
-	}
-	if n > max {
-		n = max
-	}
-	return n, nil
-}
-
-func (w *messageWriter) Write(p []byte) (int, error) {
-	if w.err != nil {
-		return 0, w.err
-	}
-
-	if len(p) > 2*len(w.c.writeBuf) && w.c.isServer {
-		// Don't buffer large messages.
-		err := w.flushFrame(false, p)
-		if err != nil {
-			return 0, err
-		}
-		return len(p), nil
-	}
-
-	nn := len(p)
-	for len(p) > 0 {
-		n, err := w.ncopy(len(p))
-		if err != nil {
-			return 0, err
-		}
-		copy(w.c.writeBuf[w.pos:], p[:n])
-		w.pos += n
-		p = p[n:]
-	}
-	return nn, nil
-}
-
-func (w *messageWriter) WriteString(p string) (int, error) {
-	if w.err != nil {
-		return 0, w.err
-	}
-
-	nn := len(p)
-	for len(p) > 0 {
-		n, err := w.ncopy(len(p))
-		if err != nil {
-			return 0, err
-		}
-		copy(w.c.writeBuf[w.pos:], p[:n])
-		w.pos += n
-		p = p[n:]
-	}
-	return nn, nil
-}
-
-func (w *messageWriter) ReadFrom(r io.Reader) (nn int64, err error) {
-	if w.err != nil {
-		return 0, w.err
-	}
-	for {
-		if w.pos == len(w.c.writeBuf) {
-			err = w.flushFrame(false, nil)
-			if err != nil {
-				break
-			}
-		}
-		var n int
-		n, err = r.Read(w.c.writeBuf[w.pos:])
-		w.pos += n
-		nn += int64(n)
-		if err != nil {
-			if err == io.EOF {
-				err = nil
-			}
-			break
-		}
-	}
-	return nn, err
-}
-
-func (w *messageWriter) Close() error {
-	if w.err != nil {
-		return w.err
-	}
-	if err := w.flushFrame(true, nil); err != nil {
-		return err
-	}
-	w.err = errWriteClosed
-	return nil
-}
-
-// WritePreparedMessage writes prepared message into connection.
-func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error {
-	frameType, frameData, err := pm.frame(prepareKey{
-		isServer:         c.isServer,
-		compress:         c.newCompressionWriter != nil && c.enableWriteCompression && isData(pm.messageType),
-		compressionLevel: c.compressionLevel,
-	})
-	if err != nil {
-		return err
-	}
-	if c.isWriting {
-		panic("concurrent write to websocket connection")
-	}
-	c.isWriting = true
-	err = c.write(frameType, c.writeDeadline, frameData, nil)
-	if !c.isWriting {
-		panic("concurrent write to websocket connection")
-	}
-	c.isWriting = false
-	return err
-}
-
-// WriteMessage is a helper method for getting a writer using NextWriter,
-// writing the message and closing the writer.
-func (c *Conn) WriteMessage(messageType int, data []byte) error {
-
-	if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) {
-		// Fast path with no allocations and single frame.
-
-		if err := c.prepWrite(messageType); err != nil {
-			return err
-		}
-		mw := messageWriter{c: c, frameType: messageType, pos: maxFrameHeaderSize}
-		n := copy(c.writeBuf[mw.pos:], data)
-		mw.pos += n
-		data = data[n:]
-		return mw.flushFrame(true, data)
-	}
-
-	w, err := c.NextWriter(messageType)
-	if err != nil {
-		return err
-	}
-	if _, err = w.Write(data); err != nil {
-		return err
-	}
-	return w.Close()
-}
-
-// SetWriteDeadline sets the write deadline on the underlying network
-// connection. After a write has timed out, the websocket state is corrupt and
-// all future writes will return an error. A zero value for t means writes will
-// not time out.
-func (c *Conn) SetWriteDeadline(t time.Time) error {
-	c.writeDeadline = t
-	return nil
-}
-
-// Read methods
-
-func (c *Conn) advanceFrame() (int, error) {
-	// 1. Skip remainder of previous frame.
-
-	if c.readRemaining > 0 {
-		if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil {
-			return noFrame, err
-		}
-	}
-
-	// 2. Read and parse first two bytes of frame header.
-
-	p, err := c.read(2)
-	if err != nil {
-		return noFrame, err
-	}
-
-	final := p[0]&finalBit != 0
-	frameType := int(p[0] & 0xf)
-	mask := p[1]&maskBit != 0
-	c.readRemaining = int64(p[1] & 0x7f)
-
-	c.readDecompress = false
-	if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 {
-		c.readDecompress = true
-		p[0] &^= rsv1Bit
-	}
-
-	if rsv := p[0] & (rsv1Bit | rsv2Bit | rsv3Bit); rsv != 0 {
-		return noFrame, c.handleProtocolError("unexpected reserved bits 0x" + strconv.FormatInt(int64(rsv), 16))
-	}
-
-	switch frameType {
-	case CloseMessage, PingMessage, PongMessage:
-		if c.readRemaining > maxControlFramePayloadSize {
-			return noFrame, c.handleProtocolError("control frame length > 125")
-		}
-		if !final {
-			return noFrame, c.handleProtocolError("control frame not final")
-		}
-	case TextMessage, BinaryMessage:
-		if !c.readFinal {
-			return noFrame, c.handleProtocolError("message start before final message frame")
-		}
-		c.readFinal = final
-	case continuationFrame:
-		if c.readFinal {
-			return noFrame, c.handleProtocolError("continuation after final message frame")
-		}
-		c.readFinal = final
-	default:
-		return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType))
-	}
-
-	// 3. Read and parse frame length.
-
-	switch c.readRemaining {
-	case 126:
-		p, err := c.read(2)
-		if err != nil {
-			return noFrame, err
-		}
-		c.readRemaining = int64(binary.BigEndian.Uint16(p))
-	case 127:
-		p, err := c.read(8)
-		if err != nil {
-			return noFrame, err
-		}
-		c.readRemaining = int64(binary.BigEndian.Uint64(p))
-	}
-
-	// 4. Handle frame masking.
-
-	if mask != c.isServer {
-		return noFrame, c.handleProtocolError("incorrect mask flag")
-	}
-
-	if mask {
-		c.readMaskPos = 0
-		p, err := c.read(len(c.readMaskKey))
-		if err != nil {
-			return noFrame, err
-		}
-		copy(c.readMaskKey[:], p)
-	}
-
-	// 5. For text and binary messages, enforce read limit and return.
-
-	if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage {
-
-		c.readLength += c.readRemaining
-		if c.readLimit > 0 && c.readLength > c.readLimit {
-			c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait))
-			return noFrame, ErrReadLimit
-		}
-
-		return frameType, nil
-	}
-
-	// 6. Read control frame payload.
-
-	var payload []byte
-	if c.readRemaining > 0 {
-		payload, err = c.read(int(c.readRemaining))
-		c.readRemaining = 0
-		if err != nil {
-			return noFrame, err
-		}
-		if c.isServer {
-			maskBytes(c.readMaskKey, 0, payload)
-		}
-	}
-
-	// 7. Process control frame payload.
-
-	switch frameType {
-	case PongMessage:
-		if err := c.handlePong(string(payload)); err != nil {
-			return noFrame, err
-		}
-	case PingMessage:
-		if err := c.handlePing(string(payload)); err != nil {
-			return noFrame, err
-		}
-	case CloseMessage:
-		closeCode := CloseNoStatusReceived
-		closeText := ""
-		if len(payload) >= 2 {
-			closeCode = int(binary.BigEndian.Uint16(payload))
-			if !isValidReceivedCloseCode(closeCode) {
-				return noFrame, c.handleProtocolError("invalid close code")
-			}
-			closeText = string(payload[2:])
-			if !utf8.ValidString(closeText) {
-				return noFrame, c.handleProtocolError("invalid utf8 payload in close frame")
-			}
-		}
-		if err := c.handleClose(closeCode, closeText); err != nil {
-			return noFrame, err
-		}
-		return noFrame, &CloseError{Code: closeCode, Text: closeText}
-	}
-
-	return frameType, nil
-}
-
-func (c *Conn) handleProtocolError(message string) error {
-	c.WriteControl(CloseMessage, FormatCloseMessage(CloseProtocolError, message), time.Now().Add(writeWait))
-	return errors.New("websocket: " + message)
-}
-
-// NextReader returns the next data message received from the peer. The
-// returned messageType is either TextMessage or BinaryMessage.
-//
-// There can be at most one open reader on a connection. NextReader discards
-// the previous message if the application has not already consumed it.
-//
-// Applications must break out of the application's read loop when this method
-// returns a non-nil error value. Errors returned from this method are
-// permanent. Once this method returns a non-nil error, all subsequent calls to
-// this method return the same error.
-func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
-	// Close previous reader, only relevant for decompression.
-	if c.reader != nil {
-		c.reader.Close()
-		c.reader = nil
-	}
-
-	c.messageReader = nil
-	c.readLength = 0
-
-	for c.readErr == nil {
-		frameType, err := c.advanceFrame()
-		if err != nil {
-			c.readErr = hideTempErr(err)
-			break
-		}
-		if frameType == TextMessage || frameType == BinaryMessage {
-			c.messageReader = &messageReader{c}
-			c.reader = c.messageReader
-			if c.readDecompress {
-				c.reader = c.newDecompressionReader(c.reader)
-			}
-			return frameType, c.reader, nil
-		}
-	}
-
-	// Applications that do handle the error returned from this method spin in
-	// tight loop on connection failure. To help application developers detect
-	// this error, panic on repeated reads to the failed connection.
-	c.readErrCount++
-	if c.readErrCount >= 1000 {
-		panic("repeated read on failed websocket connection")
-	}
-
-	return noFrame, nil, c.readErr
-}
-
-type messageReader struct{ c *Conn }
-
-func (r *messageReader) Read(b []byte) (int, error) {
-	c := r.c
-	if c.messageReader != r {
-		return 0, io.EOF
-	}
-
-	for c.readErr == nil {
-
-		if c.readRemaining > 0 {
-			if int64(len(b)) > c.readRemaining {
-				b = b[:c.readRemaining]
-			}
-			n, err := c.br.Read(b)
-			c.readErr = hideTempErr(err)
-			if c.isServer {
-				c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n])
-			}
-			c.readRemaining -= int64(n)
-			if c.readRemaining > 0 && c.readErr == io.EOF {
-				c.readErr = errUnexpectedEOF
-			}
-			return n, c.readErr
-		}
-
-		if c.readFinal {
-			c.messageReader = nil
-			return 0, io.EOF
-		}
-
-		frameType, err := c.advanceFrame()
-		switch {
-		case err != nil:
-			c.readErr = hideTempErr(err)
-		case frameType == TextMessage || frameType == BinaryMessage:
-			c.readErr = errors.New("websocket: internal error, unexpected text or binary in Reader")
-		}
-	}
-
-	err := c.readErr
-	if err == io.EOF && c.messageReader == r {
-		err = errUnexpectedEOF
-	}
-	return 0, err
-}
-
-func (r *messageReader) Close() error {
-	return nil
-}
-
-// ReadMessage is a helper method for getting a reader using NextReader and
-// reading from that reader to a buffer.
-func (c *Conn) ReadMessage() (messageType int, p []byte, err error) {
-	var r io.Reader
-	messageType, r, err = c.NextReader()
-	if err != nil {
-		return messageType, nil, err
-	}
-	p, err = ioutil.ReadAll(r)
-	return messageType, p, err
-}
-
-// SetReadDeadline sets the read deadline on the underlying network connection.
-// After a read has timed out, the websocket connection state is corrupt and
-// all future reads will return an error. A zero value for t means reads will
-// not time out.
-func (c *Conn) SetReadDeadline(t time.Time) error {
-	return c.conn.SetReadDeadline(t)
-}
-
-// SetReadLimit sets the maximum size for a message read from the peer. If a
-// message exceeds the limit, the connection sends a close message to the peer
-// and returns ErrReadLimit to the application.
-func (c *Conn) SetReadLimit(limit int64) {
-	c.readLimit = limit
-}
-
-// CloseHandler returns the current close handler
-func (c *Conn) CloseHandler() func(code int, text string) error {
-	return c.handleClose
-}
-
-// SetCloseHandler sets the handler for close messages received from the peer.
-// The code argument to h is the received close code or CloseNoStatusReceived
-// if the close message is empty. The default close handler sends a close
-// message back to the peer.
-//
-// The handler function is called from the NextReader, ReadMessage and message
-// reader Read methods. The application must read the connection to process
-// close messages as described in the section on Control Messages above.
-//
-// The connection read methods return a CloseError when a close message is
-// received. Most applications should handle close messages as part of their
-// normal error handling. Applications should only set a close handler when the
-// application must perform some action before sending a close message back to
-// the peer.
-func (c *Conn) SetCloseHandler(h func(code int, text string) error) {
-	if h == nil {
-		h = func(code int, text string) error {
-			message := FormatCloseMessage(code, "")
-			c.WriteControl(CloseMessage, message, time.Now().Add(writeWait))
-			return nil
-		}
-	}
-	c.handleClose = h
-}
-
-// PingHandler returns the current ping handler
-func (c *Conn) PingHandler() func(appData string) error {
-	return c.handlePing
-}
-
-// SetPingHandler sets the handler for ping messages received from the peer.
-// The appData argument to h is the PING message application data. The default
-// ping handler sends a pong to the peer.
-//
-// The handler function is called from the NextReader, ReadMessage and message
-// reader Read methods. The application must read the connection to process
-// ping messages as described in the section on Control Messages above.
-func (c *Conn) SetPingHandler(h func(appData string) error) {
-	if h == nil {
-		h = func(message string) error {
-			err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))
-			if err == ErrCloseSent {
-				return nil
-			} else if e, ok := err.(net.Error); ok && e.Temporary() {
-				return nil
-			}
-			return err
-		}
-	}
-	c.handlePing = h
-}
-
-// PongHandler returns the current pong handler
-func (c *Conn) PongHandler() func(appData string) error {
-	return c.handlePong
-}
-
-// SetPongHandler sets the handler for pong messages received from the peer.
-// The appData argument to h is the PONG message application data. The default
-// pong handler does nothing.
-//
-// The handler function is called from the NextReader, ReadMessage and message
-// reader Read methods. The application must read the connection to process
-// pong messages as described in the section on Control Messages above.
-func (c *Conn) SetPongHandler(h func(appData string) error) {
-	if h == nil {
-		h = func(string) error { return nil }
-	}
-	c.handlePong = h
-}
-
-// UnderlyingConn returns the internal net.Conn. This can be used to further
-// modifications to connection specific flags.
-func (c *Conn) UnderlyingConn() net.Conn {
-	return c.conn
-}
-
-// EnableWriteCompression enables and disables write compression of
-// subsequent text and binary messages. This function is a noop if
-// compression was not negotiated with the peer.
-func (c *Conn) EnableWriteCompression(enable bool) {
-	c.enableWriteCompression = enable
-}
-
-// SetCompressionLevel sets the flate compression level for subsequent text and
-// binary messages. This function is a noop if compression was not negotiated
-// with the peer. See the compress/flate package for a description of
-// compression levels.
-func (c *Conn) SetCompressionLevel(level int) error {
-	if !isValidCompressionLevel(level) {
-		return errors.New("websocket: invalid compression level")
-	}
-	c.compressionLevel = level
-	return nil
-}
-
-// FormatCloseMessage formats closeCode and text as a WebSocket close message.
-// An empty message is returned for code CloseNoStatusReceived.
-func FormatCloseMessage(closeCode int, text string) []byte {
-	if closeCode == CloseNoStatusReceived {
-		// Return empty message because it's illegal to send
-		// CloseNoStatusReceived. Return non-nil value in case application
-		// checks for nil.
-		return []byte{}
-	}
-	buf := make([]byte, 2+len(text))
-	binary.BigEndian.PutUint16(buf, uint16(closeCode))
-	copy(buf[2:], text)
-	return buf
-}

+ 0 - 15
vendor/github.com/gorilla/websocket/conn_write.go

@@ -1,15 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.8
-
-package websocket
-
-import "net"
-
-func (c *Conn) writeBufs(bufs ...[]byte) error {
-	b := net.Buffers(bufs)
-	_, err := b.WriteTo(c.conn)
-	return err
-}

+ 0 - 18
vendor/github.com/gorilla/websocket/conn_write_legacy.go

@@ -1,18 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.8
-
-package websocket
-
-func (c *Conn) writeBufs(bufs ...[]byte) error {
-	for _, buf := range bufs {
-		if len(buf) > 0 {
-			if _, err := c.conn.Write(buf); err != nil {
-				return err
-			}
-		}
-	}
-	return nil
-}

+ 0 - 180
vendor/github.com/gorilla/websocket/doc.go

@@ -1,180 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket 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 websocket implements the WebSocket protocol defined in RFC 6455.
-//
-// Overview
-//
-// The Conn type represents a WebSocket connection. A server application calls
-// the Upgrader.Upgrade method from an HTTP request handler to get a *Conn:
-//
-//  var upgrader = websocket.Upgrader{
-//      ReadBufferSize:  1024,
-//      WriteBufferSize: 1024,
-//  }
-//
-//  func handler(w http.ResponseWriter, r *http.Request) {
-//      conn, err := upgrader.Upgrade(w, r, nil)
-//      if err != nil {
-//          log.Println(err)
-//          return
-//      }
-//      ... Use conn to send and receive messages.
-//  }
-//
-// Call the connection's WriteMessage and ReadMessage methods to send and
-// receive messages as a slice of bytes. This snippet of code shows how to echo
-// messages using these methods:
-//
-//  for {
-//      messageType, p, err := conn.ReadMessage()
-//      if err != nil {
-//          log.Println(err)
-//          return
-//      }
-//      if err := conn.WriteMessage(messageType, p); err != nil {
-//          log.Println(err)
-//          return
-//      }
-//  }
-//
-// In above snippet of code, p is a []byte and messageType is an int with value
-// websocket.BinaryMessage or websocket.TextMessage.
-//
-// An application can also send and receive messages using the io.WriteCloser
-// and io.Reader interfaces. To send a message, call the connection NextWriter
-// method to get an io.WriteCloser, write the message to the writer and close
-// the writer when done. To receive a message, call the connection NextReader
-// method to get an io.Reader and read until io.EOF is returned. This snippet
-// shows how to echo messages using the NextWriter and NextReader methods:
-//
-//  for {
-//      messageType, r, err := conn.NextReader()
-//      if err != nil {
-//          return
-//      }
-//      w, err := conn.NextWriter(messageType)
-//      if err != nil {
-//          return err
-//      }
-//      if _, err := io.Copy(w, r); err != nil {
-//          return err
-//      }
-//      if err := w.Close(); err != nil {
-//          return err
-//      }
-//  }
-//
-// Data Messages
-//
-// The WebSocket protocol distinguishes between text and binary data messages.
-// Text messages are interpreted as UTF-8 encoded text. The interpretation of
-// binary messages is left to the application.
-//
-// This package uses the TextMessage and BinaryMessage integer constants to
-// identify the two data message types. The ReadMessage and NextReader methods
-// return the type of the received message. The messageType argument to the
-// WriteMessage and NextWriter methods specifies the type of a sent message.
-//
-// It is the application's responsibility to ensure that text messages are
-// valid UTF-8 encoded text.
-//
-// Control Messages
-//
-// The WebSocket protocol defines three types of control messages: close, ping
-// and pong. Call the connection WriteControl, WriteMessage or NextWriter
-// methods to send a control message to the peer.
-//
-// Connections handle received close messages by calling the handler function
-// set with the SetCloseHandler method and by returning a *CloseError from the
-// NextReader, ReadMessage or the message Read method. The default close
-// handler sends a close message to the peer.
-//
-// Connections handle received ping messages by calling the handler function
-// set with the SetPingHandler method. The default ping handler sends a pong
-// message to the peer.
-//
-// Connections handle received pong messages by calling the handler function
-// set with the SetPongHandler method. The default pong handler does nothing.
-// If an application sends ping messages, then the application should set a
-// pong handler to receive the corresponding pong.
-//
-// The control message handler functions are called from the NextReader,
-// ReadMessage and message reader Read methods. The default close and ping
-// handlers can block these methods for a short time when the handler writes to
-// the connection.
-//
-// The application must read the connection to process close, ping and pong
-// messages sent from the peer. If the application is not otherwise interested
-// in messages from the peer, then the application should start a goroutine to
-// read and discard messages from the peer. A simple example is:
-//
-//  func readLoop(c *websocket.Conn) {
-//      for {
-//          if _, _, err := c.NextReader(); err != nil {
-//              c.Close()
-//              break
-//          }
-//      }
-//  }
-//
-// Concurrency
-//
-// Connections support one concurrent reader and one concurrent writer.
-//
-// Applications are responsible for ensuring that no more than one goroutine
-// calls the write methods (NextWriter, SetWriteDeadline, WriteMessage,
-// WriteJSON, EnableWriteCompression, SetCompressionLevel) concurrently and
-// that no more than one goroutine calls the read methods (NextReader,
-// SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler)
-// concurrently.
-//
-// The Close and WriteControl methods can be called concurrently with all other
-// methods.
-//
-// Origin Considerations
-//
-// Web browsers allow Javascript applications to open a WebSocket connection to
-// any host. It's up to the server to enforce an origin policy using the Origin
-// request header sent by the browser.
-//
-// The Upgrader calls the function specified in the CheckOrigin field to check
-// the origin. If the CheckOrigin function returns false, then the Upgrade
-// method fails the WebSocket handshake with HTTP status 403.
-//
-// If the CheckOrigin field is nil, then the Upgrader uses a safe default: fail
-// the handshake if the Origin request header is present and the Origin host is
-// not equal to the Host request header.
-//
-// The deprecated package-level Upgrade function does not perform origin
-// checking. The application is responsible for checking the Origin header
-// before calling the Upgrade function.
-//
-// Compression EXPERIMENTAL
-//
-// Per message compression extensions (RFC 7692) are experimentally supported
-// by this package in a limited capacity. Setting the EnableCompression option
-// to true in Dialer or Upgrader will attempt to negotiate per message deflate
-// support.
-//
-//  var upgrader = websocket.Upgrader{
-//      EnableCompression: true,
-//  }
-//
-// If compression was successfully negotiated with the connection's peer, any
-// message received in compressed form will be automatically decompressed.
-// All Read methods will return uncompressed bytes.
-//
-// Per message compression of messages written to a connection can be enabled
-// or disabled by calling the corresponding Conn method:
-//
-//  conn.EnableWriteCompression(false)
-//
-// Currently this package does not support compression with "context takeover".
-// This means that messages must be compressed and decompressed in isolation,
-// without retaining sliding window or dictionary state across messages. For
-// more details refer to RFC 7692.
-//
-// Use of compression is experimental and may result in decreased performance.
-package websocket

+ 0 - 60
vendor/github.com/gorilla/websocket/json.go

@@ -1,60 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket 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 websocket
-
-import (
-	"encoding/json"
-	"io"
-)
-
-// WriteJSON writes the JSON encoding of v as a message.
-//
-// Deprecated: Use c.WriteJSON instead.
-func WriteJSON(c *Conn, v interface{}) error {
-	return c.WriteJSON(v)
-}
-
-// WriteJSON writes the JSON encoding of v as a message.
-//
-// See the documentation for encoding/json Marshal for details about the
-// conversion of Go values to JSON.
-func (c *Conn) WriteJSON(v interface{}) error {
-	w, err := c.NextWriter(TextMessage)
-	if err != nil {
-		return err
-	}
-	err1 := json.NewEncoder(w).Encode(v)
-	err2 := w.Close()
-	if err1 != nil {
-		return err1
-	}
-	return err2
-}
-
-// ReadJSON reads the next JSON-encoded message from the connection and stores
-// it in the value pointed to by v.
-//
-// Deprecated: Use c.ReadJSON instead.
-func ReadJSON(c *Conn, v interface{}) error {
-	return c.ReadJSON(v)
-}
-
-// ReadJSON reads the next JSON-encoded message from the connection and stores
-// it in the value pointed to by v.
-//
-// See the documentation for the encoding/json Unmarshal function for details
-// about the conversion of JSON to a Go value.
-func (c *Conn) ReadJSON(v interface{}) error {
-	_, r, err := c.NextReader()
-	if err != nil {
-		return err
-	}
-	err = json.NewDecoder(r).Decode(v)
-	if err == io.EOF {
-		// One value is expected in the message.
-		err = io.ErrUnexpectedEOF
-	}
-	return err
-}

+ 0 - 54
vendor/github.com/gorilla/websocket/mask.go

@@ -1,54 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.  Use of
-// this source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-// +build !appengine
-
-package websocket
-
-import "unsafe"
-
-const wordSize = int(unsafe.Sizeof(uintptr(0)))
-
-func maskBytes(key [4]byte, pos int, b []byte) int {
-	// Mask one byte at a time for small buffers.
-	if len(b) < 2*wordSize {
-		for i := range b {
-			b[i] ^= key[pos&3]
-			pos++
-		}
-		return pos & 3
-	}
-
-	// Mask one byte at a time to word boundary.
-	if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 {
-		n = wordSize - n
-		for i := range b[:n] {
-			b[i] ^= key[pos&3]
-			pos++
-		}
-		b = b[n:]
-	}
-
-	// Create aligned word size key.
-	var k [wordSize]byte
-	for i := range k {
-		k[i] = key[(pos+i)&3]
-	}
-	kw := *(*uintptr)(unsafe.Pointer(&k))
-
-	// Mask one word at a time.
-	n := (len(b) / wordSize) * wordSize
-	for i := 0; i < n; i += wordSize {
-		*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw
-	}
-
-	// Mask one byte at a time for remaining bytes.
-	b = b[n:]
-	for i := range b {
-		b[i] ^= key[pos&3]
-		pos++
-	}
-
-	return pos & 3
-}

+ 0 - 15
vendor/github.com/gorilla/websocket/mask_safe.go

@@ -1,15 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.  Use of
-// this source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-// +build appengine
-
-package websocket
-
-func maskBytes(key [4]byte, pos int, b []byte) int {
-	for i := range b {
-		b[i] ^= key[pos&3]
-		pos++
-	}
-	return pos & 3
-}

+ 0 - 102
vendor/github.com/gorilla/websocket/prepared.go

@@ -1,102 +0,0 @@
-// Copyright 2017 The Gorilla WebSocket 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 websocket
-
-import (
-	"bytes"
-	"net"
-	"sync"
-	"time"
-)
-
-// PreparedMessage caches on the wire representations of a message payload.
-// Use PreparedMessage to efficiently send a message payload to multiple
-// connections. PreparedMessage is especially useful when compression is used
-// because the CPU and memory expensive compression operation can be executed
-// once for a given set of compression options.
-type PreparedMessage struct {
-	messageType int
-	data        []byte
-	mu          sync.Mutex
-	frames      map[prepareKey]*preparedFrame
-}
-
-// prepareKey defines a unique set of options to cache prepared frames in PreparedMessage.
-type prepareKey struct {
-	isServer         bool
-	compress         bool
-	compressionLevel int
-}
-
-// preparedFrame contains data in wire representation.
-type preparedFrame struct {
-	once sync.Once
-	data []byte
-}
-
-// NewPreparedMessage returns an initialized PreparedMessage. You can then send
-// it to connection using WritePreparedMessage method. Valid wire
-// representation will be calculated lazily only once for a set of current
-// connection options.
-func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) {
-	pm := &PreparedMessage{
-		messageType: messageType,
-		frames:      make(map[prepareKey]*preparedFrame),
-		data:        data,
-	}
-
-	// Prepare a plain server frame.
-	_, frameData, err := pm.frame(prepareKey{isServer: true, compress: false})
-	if err != nil {
-		return nil, err
-	}
-
-	// To protect against caller modifying the data argument, remember the data
-	// copied to the plain server frame.
-	pm.data = frameData[len(frameData)-len(data):]
-	return pm, nil
-}
-
-func (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) {
-	pm.mu.Lock()
-	frame, ok := pm.frames[key]
-	if !ok {
-		frame = &preparedFrame{}
-		pm.frames[key] = frame
-	}
-	pm.mu.Unlock()
-
-	var err error
-	frame.once.Do(func() {
-		// Prepare a frame using a 'fake' connection.
-		// TODO: Refactor code in conn.go to allow more direct construction of
-		// the frame.
-		mu := make(chan bool, 1)
-		mu <- true
-		var nc prepareConn
-		c := &Conn{
-			conn:                   &nc,
-			mu:                     mu,
-			isServer:               key.isServer,
-			compressionLevel:       key.compressionLevel,
-			enableWriteCompression: true,
-			writeBuf:               make([]byte, defaultWriteBufferSize+maxFrameHeaderSize),
-		}
-		if key.compress {
-			c.newCompressionWriter = compressNoContextTakeover
-		}
-		err = c.WriteMessage(pm.messageType, pm.data)
-		frame.data = nc.buf.Bytes()
-	})
-	return pm.messageType, frame.data, err
-}
-
-type prepareConn struct {
-	buf bytes.Buffer
-	net.Conn
-}
-
-func (pc *prepareConn) Write(p []byte) (int, error)        { return pc.buf.Write(p) }
-func (pc *prepareConn) SetWriteDeadline(t time.Time) error { return nil }

+ 0 - 77
vendor/github.com/gorilla/websocket/proxy.go

@@ -1,77 +0,0 @@
-// Copyright 2017 The Gorilla WebSocket 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 websocket
-
-import (
-	"bufio"
-	"encoding/base64"
-	"errors"
-	"net"
-	"net/http"
-	"net/url"
-	"strings"
-)
-
-type netDialerFunc func(network, addr string) (net.Conn, error)
-
-func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) {
-	return fn(network, addr)
-}
-
-func init() {
-	proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {
-		return &httpProxyDialer{proxyURL: proxyURL, fowardDial: forwardDialer.Dial}, nil
-	})
-}
-
-type httpProxyDialer struct {
-	proxyURL   *url.URL
-	fowardDial func(network, addr string) (net.Conn, error)
-}
-
-func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) {
-	hostPort, _ := hostPortNoPort(hpd.proxyURL)
-	conn, err := hpd.fowardDial(network, hostPort)
-	if err != nil {
-		return nil, err
-	}
-
-	connectHeader := make(http.Header)
-	if user := hpd.proxyURL.User; user != nil {
-		proxyUser := user.Username()
-		if proxyPassword, passwordSet := user.Password(); passwordSet {
-			credential := base64.StdEncoding.EncodeToString([]byte(proxyUser + ":" + proxyPassword))
-			connectHeader.Set("Proxy-Authorization", "Basic "+credential)
-		}
-	}
-
-	connectReq := &http.Request{
-		Method: "CONNECT",
-		URL:    &url.URL{Opaque: addr},
-		Host:   addr,
-		Header: connectHeader,
-	}
-
-	if err := connectReq.Write(conn); err != nil {
-		conn.Close()
-		return nil, err
-	}
-
-	// Read response. It's OK to use and discard buffered reader here becaue
-	// the remote server does not speak until spoken to.
-	br := bufio.NewReader(conn)
-	resp, err := http.ReadResponse(br, connectReq)
-	if err != nil {
-		conn.Close()
-		return nil, err
-	}
-
-	if resp.StatusCode != 200 {
-		conn.Close()
-		f := strings.SplitN(resp.Status, " ", 2)
-		return nil, errors.New(f[1])
-	}
-	return conn, nil
-}

+ 0 - 363
vendor/github.com/gorilla/websocket/server.go

@@ -1,363 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket 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 websocket
-
-import (
-	"bufio"
-	"errors"
-	"io"
-	"net/http"
-	"net/url"
-	"strings"
-	"time"
-)
-
-// HandshakeError describes an error with the handshake from the peer.
-type HandshakeError struct {
-	message string
-}
-
-func (e HandshakeError) Error() string { return e.message }
-
-// Upgrader specifies parameters for upgrading an HTTP connection to a
-// WebSocket connection.
-type Upgrader struct {
-	// HandshakeTimeout specifies the duration for the handshake to complete.
-	HandshakeTimeout time.Duration
-
-	// ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer
-	// size is zero, then buffers allocated by the HTTP server are used. The
-	// I/O buffer sizes do not limit the size of the messages that can be sent
-	// or received.
-	ReadBufferSize, WriteBufferSize int
-
-	// WriteBufferPool is a pool of buffers for write operations. If the value
-	// is not set, then write buffers are allocated to the connection for the
-	// lifetime of the connection.
-	//
-	// A pool is most useful when the application has a modest volume of writes
-	// across a large number of connections.
-	//
-	// Applications should use a single pool for each unique value of
-	// WriteBufferSize.
-	WriteBufferPool BufferPool
-
-	// Subprotocols specifies the server's supported protocols in order of
-	// preference. If this field is not nil, then the Upgrade method negotiates a
-	// subprotocol by selecting the first match in this list with a protocol
-	// requested by the client. If there's no match, then no protocol is
-	// negotiated (the Sec-Websocket-Protocol header is not included in the
-	// handshake response).
-	Subprotocols []string
-
-	// Error specifies the function for generating HTTP error responses. If Error
-	// is nil, then http.Error is used to generate the HTTP response.
-	Error func(w http.ResponseWriter, r *http.Request, status int, reason error)
-
-	// CheckOrigin returns true if the request Origin header is acceptable. If
-	// CheckOrigin is nil, then a safe default is used: return false if the
-	// Origin request header is present and the origin host is not equal to
-	// request Host header.
-	//
-	// A CheckOrigin function should carefully validate the request origin to
-	// prevent cross-site request forgery.
-	CheckOrigin func(r *http.Request) bool
-
-	// EnableCompression specify if the server should attempt to negotiate per
-	// message compression (RFC 7692). Setting this value to true does not
-	// guarantee that compression will be supported. Currently only "no context
-	// takeover" modes are supported.
-	EnableCompression bool
-}
-
-func (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) {
-	err := HandshakeError{reason}
-	if u.Error != nil {
-		u.Error(w, r, status, err)
-	} else {
-		w.Header().Set("Sec-Websocket-Version", "13")
-		http.Error(w, http.StatusText(status), status)
-	}
-	return nil, err
-}
-
-// checkSameOrigin returns true if the origin is not set or is equal to the request host.
-func checkSameOrigin(r *http.Request) bool {
-	origin := r.Header["Origin"]
-	if len(origin) == 0 {
-		return true
-	}
-	u, err := url.Parse(origin[0])
-	if err != nil {
-		return false
-	}
-	return equalASCIIFold(u.Host, r.Host)
-}
-
-func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string {
-	if u.Subprotocols != nil {
-		clientProtocols := Subprotocols(r)
-		for _, serverProtocol := range u.Subprotocols {
-			for _, clientProtocol := range clientProtocols {
-				if clientProtocol == serverProtocol {
-					return clientProtocol
-				}
-			}
-		}
-	} else if responseHeader != nil {
-		return responseHeader.Get("Sec-Websocket-Protocol")
-	}
-	return ""
-}
-
-// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
-//
-// The responseHeader is included in the response to the client's upgrade
-// request. Use the responseHeader to specify cookies (Set-Cookie) and the
-// application negotiated subprotocol (Sec-WebSocket-Protocol).
-//
-// If the upgrade fails, then Upgrade replies to the client with an HTTP error
-// response.
-func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) {
-	const badHandshake = "websocket: the client is not using the websocket protocol: "
-
-	if !tokenListContainsValue(r.Header, "Connection", "upgrade") {
-		return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'upgrade' token not found in 'Connection' header")
-	}
-
-	if !tokenListContainsValue(r.Header, "Upgrade", "websocket") {
-		return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'websocket' token not found in 'Upgrade' header")
-	}
-
-	if r.Method != "GET" {
-		return u.returnError(w, r, http.StatusMethodNotAllowed, badHandshake+"request method is not GET")
-	}
-
-	if !tokenListContainsValue(r.Header, "Sec-Websocket-Version", "13") {
-		return u.returnError(w, r, http.StatusBadRequest, "websocket: unsupported version: 13 not found in 'Sec-Websocket-Version' header")
-	}
-
-	if _, ok := responseHeader["Sec-Websocket-Extensions"]; ok {
-		return u.returnError(w, r, http.StatusInternalServerError, "websocket: application specific 'Sec-WebSocket-Extensions' headers are unsupported")
-	}
-
-	checkOrigin := u.CheckOrigin
-	if checkOrigin == nil {
-		checkOrigin = checkSameOrigin
-	}
-	if !checkOrigin(r) {
-		return u.returnError(w, r, http.StatusForbidden, "websocket: request origin not allowed by Upgrader.CheckOrigin")
-	}
-
-	challengeKey := r.Header.Get("Sec-Websocket-Key")
-	if challengeKey == "" {
-		return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-WebSocket-Key' header is missing or blank")
-	}
-
-	subprotocol := u.selectSubprotocol(r, responseHeader)
-
-	// Negotiate PMCE
-	var compress bool
-	if u.EnableCompression {
-		for _, ext := range parseExtensions(r.Header) {
-			if ext[""] != "permessage-deflate" {
-				continue
-			}
-			compress = true
-			break
-		}
-	}
-
-	h, ok := w.(http.Hijacker)
-	if !ok {
-		return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker")
-	}
-	var brw *bufio.ReadWriter
-	netConn, brw, err := h.Hijack()
-	if err != nil {
-		return u.returnError(w, r, http.StatusInternalServerError, err.Error())
-	}
-
-	if brw.Reader.Buffered() > 0 {
-		netConn.Close()
-		return nil, errors.New("websocket: client sent data before handshake is complete")
-	}
-
-	var br *bufio.Reader
-	if u.ReadBufferSize == 0 && bufioReaderSize(netConn, brw.Reader) > 256 {
-		// Reuse hijacked buffered reader as connection reader.
-		br = brw.Reader
-	}
-
-	buf := bufioWriterBuffer(netConn, brw.Writer)
-
-	var writeBuf []byte
-	if u.WriteBufferPool == nil && u.WriteBufferSize == 0 && len(buf) >= maxFrameHeaderSize+256 {
-		// Reuse hijacked write buffer as connection buffer.
-		writeBuf = buf
-	}
-
-	c := newConn(netConn, true, u.ReadBufferSize, u.WriteBufferSize, u.WriteBufferPool, br, writeBuf)
-	c.subprotocol = subprotocol
-
-	if compress {
-		c.newCompressionWriter = compressNoContextTakeover
-		c.newDecompressionReader = decompressNoContextTakeover
-	}
-
-	// Use larger of hijacked buffer and connection write buffer for header.
-	p := buf
-	if len(c.writeBuf) > len(p) {
-		p = c.writeBuf
-	}
-	p = p[:0]
-
-	p = append(p, "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "...)
-	p = append(p, computeAcceptKey(challengeKey)...)
-	p = append(p, "\r\n"...)
-	if c.subprotocol != "" {
-		p = append(p, "Sec-WebSocket-Protocol: "...)
-		p = append(p, c.subprotocol...)
-		p = append(p, "\r\n"...)
-	}
-	if compress {
-		p = append(p, "Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n"...)
-	}
-	for k, vs := range responseHeader {
-		if k == "Sec-Websocket-Protocol" {
-			continue
-		}
-		for _, v := range vs {
-			p = append(p, k...)
-			p = append(p, ": "...)
-			for i := 0; i < len(v); i++ {
-				b := v[i]
-				if b <= 31 {
-					// prevent response splitting.
-					b = ' '
-				}
-				p = append(p, b)
-			}
-			p = append(p, "\r\n"...)
-		}
-	}
-	p = append(p, "\r\n"...)
-
-	// Clear deadlines set by HTTP server.
-	netConn.SetDeadline(time.Time{})
-
-	if u.HandshakeTimeout > 0 {
-		netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout))
-	}
-	if _, err = netConn.Write(p); err != nil {
-		netConn.Close()
-		return nil, err
-	}
-	if u.HandshakeTimeout > 0 {
-		netConn.SetWriteDeadline(time.Time{})
-	}
-
-	return c, nil
-}
-
-// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
-//
-// Deprecated: Use websocket.Upgrader instead.
-//
-// Upgrade does not perform origin checking. The application is responsible for
-// checking the Origin header before calling Upgrade. An example implementation
-// of the same origin policy check is:
-//
-//	if req.Header.Get("Origin") != "http://"+req.Host {
-//		http.Error(w, "Origin not allowed", http.StatusForbidden)
-//		return
-//	}
-//
-// If the endpoint supports subprotocols, then the application is responsible
-// for negotiating the protocol used on the connection. Use the Subprotocols()
-// function to get the subprotocols requested by the client. Use the
-// Sec-Websocket-Protocol response header to specify the subprotocol selected
-// by the application.
-//
-// The responseHeader is included in the response to the client's upgrade
-// request. Use the responseHeader to specify cookies (Set-Cookie) and the
-// negotiated subprotocol (Sec-Websocket-Protocol).
-//
-// The connection buffers IO to the underlying network connection. The
-// readBufSize and writeBufSize parameters specify the size of the buffers to
-// use. Messages can be larger than the buffers.
-//
-// If the request is not a valid WebSocket handshake, then Upgrade returns an
-// error of type HandshakeError. Applications should handle this error by
-// replying to the client with an HTTP error response.
-func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, readBufSize, writeBufSize int) (*Conn, error) {
-	u := Upgrader{ReadBufferSize: readBufSize, WriteBufferSize: writeBufSize}
-	u.Error = func(w http.ResponseWriter, r *http.Request, status int, reason error) {
-		// don't return errors to maintain backwards compatibility
-	}
-	u.CheckOrigin = func(r *http.Request) bool {
-		// allow all connections by default
-		return true
-	}
-	return u.Upgrade(w, r, responseHeader)
-}
-
-// Subprotocols returns the subprotocols requested by the client in the
-// Sec-Websocket-Protocol header.
-func Subprotocols(r *http.Request) []string {
-	h := strings.TrimSpace(r.Header.Get("Sec-Websocket-Protocol"))
-	if h == "" {
-		return nil
-	}
-	protocols := strings.Split(h, ",")
-	for i := range protocols {
-		protocols[i] = strings.TrimSpace(protocols[i])
-	}
-	return protocols
-}
-
-// IsWebSocketUpgrade returns true if the client requested upgrade to the
-// WebSocket protocol.
-func IsWebSocketUpgrade(r *http.Request) bool {
-	return tokenListContainsValue(r.Header, "Connection", "upgrade") &&
-		tokenListContainsValue(r.Header, "Upgrade", "websocket")
-}
-
-// bufioReaderSize size returns the size of a bufio.Reader.
-func bufioReaderSize(originalReader io.Reader, br *bufio.Reader) int {
-	// This code assumes that peek on a reset reader returns
-	// bufio.Reader.buf[:0].
-	// TODO: Use bufio.Reader.Size() after Go 1.10
-	br.Reset(originalReader)
-	if p, err := br.Peek(0); err == nil {
-		return cap(p)
-	}
-	return 0
-}
-
-// writeHook is an io.Writer that records the last slice passed to it vio
-// io.Writer.Write.
-type writeHook struct {
-	p []byte
-}
-
-func (wh *writeHook) Write(p []byte) (int, error) {
-	wh.p = p
-	return len(p), nil
-}
-
-// bufioWriterBuffer grabs the buffer from a bufio.Writer.
-func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte {
-	// This code assumes that bufio.Writer.buf[:1] is passed to the
-	// bufio.Writer's underlying writer.
-	var wh writeHook
-	bw.Reset(&wh)
-	bw.WriteByte(0)
-	bw.Flush()
-
-	bw.Reset(originalWriter)
-
-	return wh.p[:cap(wh.p)]
-}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно