auth.pb.go 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. // Code generated by protoc-gen-gogo.
  2. // source: auth.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package authpb is a generated protocol buffer package.
  6. It is generated from these files:
  7. auth.proto
  8. It has these top-level messages:
  9. User
  10. */
  11. package authpb
  12. import (
  13. "fmt"
  14. proto "github.com/gogo/protobuf/proto"
  15. )
  16. import math "math"
  17. import io "io"
  18. // Reference imports to suppress errors if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = fmt.Errorf
  21. var _ = math.Inf
  22. // User is a single entry in the bucket authUsers
  23. type User struct {
  24. Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
  25. Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
  26. Tombstone int64 `protobuf:"varint,3,opt,name=tombstone,proto3" json:"tombstone,omitempty"`
  27. }
  28. func (m *User) Reset() { *m = User{} }
  29. func (m *User) String() string { return proto.CompactTextString(m) }
  30. func (*User) ProtoMessage() {}
  31. func init() {
  32. proto.RegisterType((*User)(nil), "authpb.User")
  33. }
  34. func (m *User) Marshal() (data []byte, err error) {
  35. size := m.Size()
  36. data = make([]byte, size)
  37. n, err := m.MarshalTo(data)
  38. if err != nil {
  39. return nil, err
  40. }
  41. return data[:n], nil
  42. }
  43. func (m *User) MarshalTo(data []byte) (int, error) {
  44. var i int
  45. _ = i
  46. var l int
  47. _ = l
  48. if m.Name != nil {
  49. if len(m.Name) > 0 {
  50. data[i] = 0xa
  51. i++
  52. i = encodeVarintAuth(data, i, uint64(len(m.Name)))
  53. i += copy(data[i:], m.Name)
  54. }
  55. }
  56. if m.Password != nil {
  57. if len(m.Password) > 0 {
  58. data[i] = 0x12
  59. i++
  60. i = encodeVarintAuth(data, i, uint64(len(m.Password)))
  61. i += copy(data[i:], m.Password)
  62. }
  63. }
  64. if m.Tombstone != 0 {
  65. data[i] = 0x18
  66. i++
  67. i = encodeVarintAuth(data, i, uint64(m.Tombstone))
  68. }
  69. return i, nil
  70. }
  71. func encodeFixed64Auth(data []byte, offset int, v uint64) int {
  72. data[offset] = uint8(v)
  73. data[offset+1] = uint8(v >> 8)
  74. data[offset+2] = uint8(v >> 16)
  75. data[offset+3] = uint8(v >> 24)
  76. data[offset+4] = uint8(v >> 32)
  77. data[offset+5] = uint8(v >> 40)
  78. data[offset+6] = uint8(v >> 48)
  79. data[offset+7] = uint8(v >> 56)
  80. return offset + 8
  81. }
  82. func encodeFixed32Auth(data []byte, offset int, v uint32) int {
  83. data[offset] = uint8(v)
  84. data[offset+1] = uint8(v >> 8)
  85. data[offset+2] = uint8(v >> 16)
  86. data[offset+3] = uint8(v >> 24)
  87. return offset + 4
  88. }
  89. func encodeVarintAuth(data []byte, offset int, v uint64) int {
  90. for v >= 1<<7 {
  91. data[offset] = uint8(v&0x7f | 0x80)
  92. v >>= 7
  93. offset++
  94. }
  95. data[offset] = uint8(v)
  96. return offset + 1
  97. }
  98. func (m *User) Size() (n int) {
  99. var l int
  100. _ = l
  101. if m.Name != nil {
  102. l = len(m.Name)
  103. if l > 0 {
  104. n += 1 + l + sovAuth(uint64(l))
  105. }
  106. }
  107. if m.Password != nil {
  108. l = len(m.Password)
  109. if l > 0 {
  110. n += 1 + l + sovAuth(uint64(l))
  111. }
  112. }
  113. if m.Tombstone != 0 {
  114. n += 1 + sovAuth(uint64(m.Tombstone))
  115. }
  116. return n
  117. }
  118. func sovAuth(x uint64) (n int) {
  119. for {
  120. n++
  121. x >>= 7
  122. if x == 0 {
  123. break
  124. }
  125. }
  126. return n
  127. }
  128. func sozAuth(x uint64) (n int) {
  129. return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  130. }
  131. func (m *User) Unmarshal(data []byte) error {
  132. l := len(data)
  133. iNdEx := 0
  134. for iNdEx < l {
  135. preIndex := iNdEx
  136. var wire uint64
  137. for shift := uint(0); ; shift += 7 {
  138. if shift >= 64 {
  139. return ErrIntOverflowAuth
  140. }
  141. if iNdEx >= l {
  142. return io.ErrUnexpectedEOF
  143. }
  144. b := data[iNdEx]
  145. iNdEx++
  146. wire |= (uint64(b) & 0x7F) << shift
  147. if b < 0x80 {
  148. break
  149. }
  150. }
  151. fieldNum := int32(wire >> 3)
  152. wireType := int(wire & 0x7)
  153. if wireType == 4 {
  154. return fmt.Errorf("proto: User: wiretype end group for non-group")
  155. }
  156. if fieldNum <= 0 {
  157. return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire)
  158. }
  159. switch fieldNum {
  160. case 1:
  161. if wireType != 2 {
  162. return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
  163. }
  164. var byteLen int
  165. for shift := uint(0); ; shift += 7 {
  166. if shift >= 64 {
  167. return ErrIntOverflowAuth
  168. }
  169. if iNdEx >= l {
  170. return io.ErrUnexpectedEOF
  171. }
  172. b := data[iNdEx]
  173. iNdEx++
  174. byteLen |= (int(b) & 0x7F) << shift
  175. if b < 0x80 {
  176. break
  177. }
  178. }
  179. if byteLen < 0 {
  180. return ErrInvalidLengthAuth
  181. }
  182. postIndex := iNdEx + byteLen
  183. if postIndex > l {
  184. return io.ErrUnexpectedEOF
  185. }
  186. m.Name = append(m.Name[:0], data[iNdEx:postIndex]...)
  187. if m.Name == nil {
  188. m.Name = []byte{}
  189. }
  190. iNdEx = postIndex
  191. case 2:
  192. if wireType != 2 {
  193. return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
  194. }
  195. var byteLen int
  196. for shift := uint(0); ; shift += 7 {
  197. if shift >= 64 {
  198. return ErrIntOverflowAuth
  199. }
  200. if iNdEx >= l {
  201. return io.ErrUnexpectedEOF
  202. }
  203. b := data[iNdEx]
  204. iNdEx++
  205. byteLen |= (int(b) & 0x7F) << shift
  206. if b < 0x80 {
  207. break
  208. }
  209. }
  210. if byteLen < 0 {
  211. return ErrInvalidLengthAuth
  212. }
  213. postIndex := iNdEx + byteLen
  214. if postIndex > l {
  215. return io.ErrUnexpectedEOF
  216. }
  217. m.Password = append(m.Password[:0], data[iNdEx:postIndex]...)
  218. if m.Password == nil {
  219. m.Password = []byte{}
  220. }
  221. iNdEx = postIndex
  222. case 3:
  223. if wireType != 0 {
  224. return fmt.Errorf("proto: wrong wireType = %d for field Tombstone", wireType)
  225. }
  226. m.Tombstone = 0
  227. for shift := uint(0); ; shift += 7 {
  228. if shift >= 64 {
  229. return ErrIntOverflowAuth
  230. }
  231. if iNdEx >= l {
  232. return io.ErrUnexpectedEOF
  233. }
  234. b := data[iNdEx]
  235. iNdEx++
  236. m.Tombstone |= (int64(b) & 0x7F) << shift
  237. if b < 0x80 {
  238. break
  239. }
  240. }
  241. default:
  242. iNdEx = preIndex
  243. skippy, err := skipAuth(data[iNdEx:])
  244. if err != nil {
  245. return err
  246. }
  247. if skippy < 0 {
  248. return ErrInvalidLengthAuth
  249. }
  250. if (iNdEx + skippy) > l {
  251. return io.ErrUnexpectedEOF
  252. }
  253. iNdEx += skippy
  254. }
  255. }
  256. if iNdEx > l {
  257. return io.ErrUnexpectedEOF
  258. }
  259. return nil
  260. }
  261. func skipAuth(data []byte) (n int, err error) {
  262. l := len(data)
  263. iNdEx := 0
  264. for iNdEx < l {
  265. var wire uint64
  266. for shift := uint(0); ; shift += 7 {
  267. if shift >= 64 {
  268. return 0, ErrIntOverflowAuth
  269. }
  270. if iNdEx >= l {
  271. return 0, io.ErrUnexpectedEOF
  272. }
  273. b := data[iNdEx]
  274. iNdEx++
  275. wire |= (uint64(b) & 0x7F) << shift
  276. if b < 0x80 {
  277. break
  278. }
  279. }
  280. wireType := int(wire & 0x7)
  281. switch wireType {
  282. case 0:
  283. for shift := uint(0); ; shift += 7 {
  284. if shift >= 64 {
  285. return 0, ErrIntOverflowAuth
  286. }
  287. if iNdEx >= l {
  288. return 0, io.ErrUnexpectedEOF
  289. }
  290. iNdEx++
  291. if data[iNdEx-1] < 0x80 {
  292. break
  293. }
  294. }
  295. return iNdEx, nil
  296. case 1:
  297. iNdEx += 8
  298. return iNdEx, nil
  299. case 2:
  300. var length int
  301. for shift := uint(0); ; shift += 7 {
  302. if shift >= 64 {
  303. return 0, ErrIntOverflowAuth
  304. }
  305. if iNdEx >= l {
  306. return 0, io.ErrUnexpectedEOF
  307. }
  308. b := data[iNdEx]
  309. iNdEx++
  310. length |= (int(b) & 0x7F) << shift
  311. if b < 0x80 {
  312. break
  313. }
  314. }
  315. iNdEx += length
  316. if length < 0 {
  317. return 0, ErrInvalidLengthAuth
  318. }
  319. return iNdEx, nil
  320. case 3:
  321. for {
  322. var innerWire uint64
  323. var start int = iNdEx
  324. for shift := uint(0); ; shift += 7 {
  325. if shift >= 64 {
  326. return 0, ErrIntOverflowAuth
  327. }
  328. if iNdEx >= l {
  329. return 0, io.ErrUnexpectedEOF
  330. }
  331. b := data[iNdEx]
  332. iNdEx++
  333. innerWire |= (uint64(b) & 0x7F) << shift
  334. if b < 0x80 {
  335. break
  336. }
  337. }
  338. innerWireType := int(innerWire & 0x7)
  339. if innerWireType == 4 {
  340. break
  341. }
  342. next, err := skipAuth(data[start:])
  343. if err != nil {
  344. return 0, err
  345. }
  346. iNdEx = start + next
  347. }
  348. return iNdEx, nil
  349. case 4:
  350. return iNdEx, nil
  351. case 5:
  352. iNdEx += 4
  353. return iNdEx, nil
  354. default:
  355. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  356. }
  357. }
  358. panic("unreachable")
  359. }
  360. var (
  361. ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling")
  362. ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow")
  363. )